From 386c25665671b7333072004cb9801bbe6de0b49b Mon Sep 17 00:00:00 2001 From: Webb Scales <7795764+webbnh@users.noreply.github.com> Date: Wed, 29 Mar 2023 09:33:24 -0400 Subject: [PATCH] Move set-expiration of Server container to a conditional pipeline stage (#3357) Move the setting of the expiration date to its own pipeline stage which is executed only for PRs, so that branch builds will not expire. PBENCH-1113 --- jenkins/Pipeline.gy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jenkins/Pipeline.gy b/jenkins/Pipeline.gy index 4937b58912..93cd6355e1 100644 --- a/jenkins/Pipeline.gy +++ b/jenkins/Pipeline.gy @@ -43,12 +43,19 @@ pipeline { KEYCLOAK_CLIENT_SECRET=credentials('5cf0304d-8a00-48a4-ade5-9f59cb37ba68') PB_SERVER_IMAGE_TAG="${PB_IMAGE_TAG}" RPM_PATH="${WORKSPACE_TMP}/rpmbuild/RPMS/noarch/pbench-server-*.rpm" - EXPIRATION="""${sh(returnStdout: true, script: 'date --date "3 weeks" "+%s"').trim()}""" } steps { sh 'buildah login -u="${PB_CI_REG_CRED_USR}" -p="${PB_CI_REG_CRED_PSW}" ${PB_CI_REGISTRY}' sh 'bash -ex ./server/pbenchinacan/container-build.sh' sh 'buildah push ${PB_CONTAINER_REG}/${PB_SERVER_IMAGE_NAME}:${PB_IMAGE_TAG}' + } + } + stage('For PRs, set the Pbench Server container image expiration') { + when { changeRequest() } + environment { + EXPIRATION="""${sh(returnStdout: true, script: 'date --date "3 weeks" "+%s"').trim()}""" + } + steps { sh './jenkins/set-expiration \ ${EXPIRATION} \ ${PB_CI_REGISTRY} \