Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ pipeline {

try {
// Staleness threshold: 90 days ago as unix epoch
// GNU date (Linux): -d '90 days ago'; BSD date (macOS): -v-90d
def threeMonthsAgoStr = sh(
script: "date -d '90 days ago' +%s",
script: "date -d '90 days ago' +%s 2>/dev/null || date -v-90d +%s",
returnStdout: true
).trim()
if (!threeMonthsAgoStr.isLong()) {
Expand All @@ -91,7 +92,7 @@ pipeline {
if (branch.startsWith('pr/')) continue
def commitEpochStr = withEnv(["BRANCH_TO_CHECK=${branch}"]) {
sh(
script: "git -C '${tmpBareClone}' log -1 --format='%ct' -- \"\$BRANCH_TO_CHECK\"",
script: "git -C '${tmpBareClone}' log -1 --format='%ct' \"refs/heads/\$BRANCH_TO_CHECK\"",
returnStdout: true
).trim()
}
Expand Down Expand Up @@ -147,10 +148,19 @@ pipeline {
"SKARA_REPO_ARG=${params.SKARA_REPO}",
"MIRROR_REPO_ARG=${mirrorRepoArg}"
]) {
sh '''
git --version
bash ./skaraMirror.sh "$SKARA_REPO_ARG" "$MIRROR_REPO_ARG"
'''
def mirrorSteps = {
sh '''
git --version
bash ./skaraMirror.sh "$SKARA_REPO_ARG" "$MIRROR_REPO_ARG"
'''
}
if (params.SSH_CREDENTIAL_ID?.trim()) {
sshagent(credentials: [params.SSH_CREDENTIAL_ID]) {
mirrorSteps()
}
} else {
mirrorSteps()
}
}
}
}
Expand Down