ci: enable USE_PULLED_IMAGE to prevent image builds

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-11-02 17:08:09 +01:00 committed by mergify[bot]
parent 4ba6e51f85
commit 09c4191a6f
2 changed files with 11 additions and 9 deletions

View File

@ -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}'"
}
}

View File

@ -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}"
}
}
}