From 09c4191a6f4897b5c88aab0fd2525674a39b364c Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 2 Nov 2020 17:08:09 +0100 Subject: [PATCH] ci: enable USE_PULLED_IMAGE to prevent image builds Signed-off-by: Niels de Vos --- ci-job-validation.groovy | 4 +++- containerized-tests.groovy | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ci-job-validation.groovy b/ci-job-validation.groovy index 3be69f321..8aefae4ca 100644 --- a/ci-job-validation.groovy +++ b/ci-job-validation.groovy @@ -9,6 +9,7 @@ def base = '' def doc_change = 0 // private, internal container image repository def cached_image = 'registry-ceph-csi.apps.ocp.ci.centos.org/ceph-csi' +def use_pulled_image = 'USE_PULLED_IMAGE=yes' node('cico-workspace') { stage('checkout ci repository') { @@ -76,6 +77,7 @@ node('cico-workspace') { returnStatus: true) if (rebuild_container == 10) { // container needs rebuild, don't pull + use_pulled_image = 'USE_PULLED_IMAGE=no' return } @@ -84,7 +86,7 @@ node('cico-workspace') { } } stage('test') { - sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} 'cd /opt/build/go/src/github.com/ceph/ceph-csi && make ENV_CSI_IMAGE_NAME=${cached_image} USE_PULLED_IMAGE=yes'" + sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} 'cd /opt/build/go/src/github.com/ceph/ceph-csi && make ENV_CSI_IMAGE_NAME=${cached_image} ${use_pulled_image}'" } } diff --git a/containerized-tests.groovy b/containerized-tests.groovy index 91c948388..7c68e3aca 100644 --- a/containerized-tests.groovy +++ b/containerized-tests.groovy @@ -7,10 +7,10 @@ def ref = "master" def git_since = 'master' def workdir = '/opt/build/go/src/github.com/ceph/ceph-csi' def doc_change = 0 -def rebuild_test_container = 0 -def rebuild_devel_container = 0 // private, internal container image repository def cached_image = 'registry-ceph-csi.apps.ocp.ci.centos.org/ceph-csi' +def use_test_image = 'USE_PULLED_IMAGE=yes' +def use_build_image = 'USE_PULLED_IMAGE=yes' def ssh(cmd) { sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} '${cmd}'" @@ -77,11 +77,11 @@ node('cico-workspace') { // - pull the container image from the repository of no // modifications are detected stage('pull container images') { - rebuild_test_container = sh( + def rebuild_test_container = sh( script: "cd ~/build/ceph-csi && \${OLDPWD}/scripts/container-needs-rebuild.sh test origin/${git_since}", returnStatus: true) - rebuild_devel_container = sh( + def rebuild_devel_container = sh( script: "cd ~/build/ceph-csi && \${OLDPWD}/scripts/container-needs-rebuild.sh devel origin/${git_since}", returnStatus: true) @@ -89,12 +89,12 @@ node('cico-workspace') { node('cico-workspace') { if (rebuild_test_container == 10) { // container needs rebuild, don't pull + use_test_image = 'USE_PULLED_IMAGE=no' return } withCredentials([usernamePassword(credentialsId: 'container-registry-auth', usernameVariable: 'CREDS_USER', passwordVariable: 'CREDS_PASSWD')]) { ssh "podman pull --creds=${CREDS_USER}:${CREDS_PASSWD} ${cached_image}:test" - ssh "podman inspect -f \"{{.Id}}\" ${cached_image}:test > /opt/build/go/src/github.com/ceph/ceph-csi/.test-container-id" } } }, @@ -102,12 +102,12 @@ node('cico-workspace') { node('cico-workspace') { if (rebuild_devel_container == 10) { // container needs rebuild, don't pull + use_build_image = 'USE_PULLED_IMAGE=no' return } withCredentials([usernamePassword(credentialsId: 'container-registry-auth', usernameVariable: 'CREDS_USER', passwordVariable: 'CREDS_PASSWD')]) { ssh "podman pull --creds=${CREDS_USER}:${CREDS_PASSWD} ${cached_image}:devel" - ssh "podman inspect -f \"{{.Id}}\" ${cached_image}:devel > /opt/build/go/src/github.com/ceph/ceph-csi/.devel-container-id" } } } @@ -115,12 +115,12 @@ node('cico-workspace') { stage('test & build') { parallel test: { node ('cico-workspace') { - ssh "cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-test CONTAINER_CMD=podman ENV_CSI_IMAGE_NAME=${cached_image}" + ssh "cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-test CONTAINER_CMD=podman ENV_CSI_IMAGE_NAME=${cached_image} ${use_test_image}" } }, build: { node('cico-workspace') { - ssh "cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-build CONTAINER_CMD=podman ENV_CSI_IMAGE_NAME=${cached_image}" + ssh "cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-build CONTAINER_CMD=podman ENV_CSI_IMAGE_NAME=${cached_image} ${use_build_image}" } } }