From 5b985dd8b2db302b173b1ad509e518c470de196d Mon Sep 17 00:00:00 2001 From: Andrew Leonard Date: Tue, 1 Sep 2026 11:34:55 +0100 Subject: [PATCH 1/2] fix: support BSD date and fix branch log lookup in stale check Co-authored-by: Bob --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f483e0b..add2658 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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()) { @@ -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() } From 95fcc3a985c2a7b7909eb05f54e3f994a35e9705 Mon Sep 17 00:00:00 2001 From: Andrew Leonard Date: Tue, 1 Sep 2026 11:44:21 +0100 Subject: [PATCH 2/2] feat: add optional SSH agent support for mirror step Co-authored-by: Bob --- Jenkinsfile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index add2658..d93ea0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,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() + } } } }