From fc0cf763cbed6bad910913f4a08842d42501fa11 Mon Sep 17 00:00:00 2001 From: Webb Scales Date: Tue, 17 Jan 2023 11:59:51 -0500 Subject: [PATCH] Replace internal/external with ci/public for registry references --- jenkins/Pipeline.gy | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/jenkins/Pipeline.gy b/jenkins/Pipeline.gy index 8937abd8c1..085b9291f2 100644 --- a/jenkins/Pipeline.gy +++ b/jenkins/Pipeline.gy @@ -11,12 +11,9 @@ pipeline { TERM='dumb' // Configuration for remote container registries - PODMAN_INTERNAL=credentials('12b404ca-3036-4960-9929-979148b9e49a') - PODMAN_EXTERNAL=credentials('87ad2797-02eb-464f-989f-8ab78d63cdf3') - PB_INTERNAL_CONTAINER_REG=credentials('c3e2d737-0e56-4c1e-a945-d86bc644384c') - PB_EXTERNAL_CONTAINER_REG=credentials('24a93506-ecd6-403a-b4f0-386f9cc943e9') + PB_CI_REGISTRY=credentials('c3e2d737-0e56-4c1e-a945-d86bc644384c') + PB_CI_REG_CRED=credentials('12b404ca-3036-4960-9929-979148b9e49a') PB_ORG_NAME="pbench" - PB_SERVER_IMAGE_NAME="pbench-server-ci" // If we are executing for a PR, as opposed to executing for a branch // like `main`, the CHANGE_ID will be defined to the PR number. If it // is defined we'll use its value for the container image tag; @@ -44,49 +41,31 @@ pipeline { stage('Build the Pbench Server Container') { environment { KEYCLOAK_CLIENT_SECRET=credentials('5cf0304d-8a00-48a4-ade5-9f59cb37ba68') + PB_SERVER_IMAGE_NAME="pbench-server-ci" PB_SERVER_IMAGE_TAG="${PB_IMAGE_TAG}" RPM_PATH="${WORKSPACE_TMP}/rpmbuild/RPMS/noarch/pbench-server-*.rpm" } steps { - sh 'buildah login -u="${PODMAN_INTERNAL_USR}" -p="${PODMAN_INTERNAL_PSW}" ${PB_INTERNAL_CONTAINER_REG}' + 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-ci.sh' - sh 'buildah push localhost/pbench-server:${PB_IMAGE_TAG} ${PB_INTERNAL_CONTAINER_REG}/${PB_ORG_NAME}/pbench-server:${PB_IMAGE_TAG}' - sh 'buildah push localhost/${PB_SERVER_IMAGE_NAME}:${PB_IMAGE_TAG} ${PB_INTERNAL_CONTAINER_REG}/${PB_ORG_NAME}/${PB_SERVER_IMAGE_NAME}:${PB_IMAGE_TAG}' + sh 'buildah push localhost/pbench-server:${PB_IMAGE_TAG} ${PB_CI_REGISTRY}/${PB_ORG_NAME}/pbench-server:${PB_IMAGE_TAG}' + sh 'buildah push localhost/${PB_SERVER_IMAGE_NAME}:${PB_IMAGE_TAG} ${PB_CI_REGISTRY}/${PB_ORG_NAME}/${PB_SERVER_IMAGE_NAME}:${PB_IMAGE_TAG}' } } stage('Build the Pbench Agent Containers') { environment { - // If CHANGE_ID is defined, then we are building a PR, so use - // the internal container registry; otherwise, we are building - // a branch (like `main`), so use the external registry. - PB_AGENT_CONTAINER_REG="${env.CHANGE_ID ? env.PB_INTERNAL_CONTAINER_REG : env.PB_EXTERNAL_CONTAINER_REG}" PB_AGENT_DISTRO="fedora-36" } - stages { - stage('Login to external container registry') { - when { equals expected: env.PB_EXTERNAL_CONTAINER_REG, actual: env.PB_AGENT_CONTAINER_REG } - steps { - sh 'buildah login -u="${PODMAN_EXTERNAL_USR}" -p="${PODMAN_EXTERNAL_PSW}" ${PB_EXTERNAL_CONTAINER_REG}' - } - } - stage('Login to internal container registry') { - when { equals expected: env.PB_INTERNAL_CONTAINER_REG, actual: env.PB_AGENT_CONTAINER_REG } - steps { - sh 'buildah login -u="${PODMAN_INTERNAL_USR}" -p="${PODMAN_INTERNAL_PSW}" ${PB_INTERNAL_CONTAINER_REG}' - } - } - stage('Do the build') { - steps { - sh '/usr/bin/python3 -m pip install --user jinja2-cli' - sh 'make -C agent/containers/images CI_RPM_ROOT=${WORKSPACE_TMP} clean ${PB_AGENT_DISTRO}-everything' - sh 'make -C agent/containers/images IMAGE_REPO=${PB_AGENT_CONTAINER_REG}/${PB_ORG_NAME} IMAGE_TAG=${PB_IMAGE_TAG} ${PB_AGENT_DISTRO}-push-ci' - } - } + steps { + sh 'buildah login -u="${PB_CI_REG_CRED_USR}" -p="${PB_CI_REG_CRED_PSW}" ${PB_CI_REGISTRY}' + sh '/usr/bin/python3 -m pip install --user jinja2-cli' + sh 'make -C agent/containers/images CI_RPM_ROOT=${WORKSPACE_TMP} clean ${PB_AGENT_DISTRO}-everything' + sh 'make -C agent/containers/images IMAGE_REPO=${PB_CI_REGISTRY}/${PB_ORG_NAME} IMAGE_TAG=${PB_IMAGE_TAG} ${PB_AGENT_DISTRO}-push-ci' } } stage('Deploy server and run functional tests') { environment { - PB_CONTAINER_REG="${PB_INTERNAL_CONTAINER_REG}" + PB_CONTAINER_REG="${PB_CI_REGISTRY}" PB_DASHBOARD_DIR="${WORKSPACE}/dashboard/build/" PB_SERVER_IMAGE_TAG="${PB_IMAGE_TAG}" }