Skip to content

Commit

Permalink
Do not issue docker pull if imagename contains rhel
Browse files Browse the repository at this point in the history
Signed-off-by: Stewart X Addison <[email protected]>
  • Loading branch information
sxa committed Feb 13, 2023
1 parent fe2f881 commit b495fe6
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1729,30 +1729,31 @@ class Build {
throw new Exception("[ERROR] Controller clean workspace timeout (${buildTimeouts.CONTROLLER_CLEAN_TIMEOUT} HOURS) has been reached. Exiting...")
}
}

// Pull the docker image from DockerHub
try {
context.timeout(time: buildTimeouts.DOCKER_PULL_TIMEOUT, unit: 'HOURS') {
if (buildConfig.DOCKER_CREDENTIAL) {
context.docker.withRegistry(buildConfig.DOCKER_REGISTRY, buildConfig.DOCKER_CREDENTIAL) {
if (!("${buildConfig.DOCKER_IMAGE}".contains('rhel'))) {
// Pull the docker image from DockerHub
try {
context.timeout(time: buildTimeouts.DOCKER_PULL_TIMEOUT, unit: 'HOURS') {
if (buildConfig.DOCKER_CREDENTIAL) {
context.docker.withRegistry(buildConfig.DOCKER_REGISTRY, buildConfig.DOCKER_CREDENTIAL) {
if (buildConfig.DOCKER_ARGS) {
context.sh(script: "docker pull ${buildConfig.DOCKER_IMAGE} ${buildConfig.DOCKER_ARGS}")
} else {
context.docker.image(buildConfig.DOCKER_IMAGE).pull()
}
}
} else {
if (buildConfig.DOCKER_ARGS) {
context.sh(script: "docker pull ${buildConfig.DOCKER_IMAGE} ${buildConfig.DOCKER_ARGS}")
} else {
context.docker.image(buildConfig.DOCKER_IMAGE).pull()
}
}
} else {
if (buildConfig.DOCKER_ARGS) {
context.sh(script: "docker pull ${buildConfig.DOCKER_IMAGE} ${buildConfig.DOCKER_ARGS}")
} else {
context.docker.image(buildConfig.DOCKER_IMAGE).pull()
}
// Store the pulled docker image digest as 'buildinfo'
dockerImageDigest = context.sh(script: "docker inspect --format='{{.RepoDigests}}' ${buildConfig.DOCKER_IMAGE}", returnStdout:true)
}
// Store the pulled docker image digest as 'buildinfo'
dockerImageDigest = context.sh(script: "docker inspect --format='{{.RepoDigests}}' ${buildConfig.DOCKER_IMAGE}", returnStdout:true)
} catch (FlowInterruptedException e) {
throw new Exception("[ERROR] Controller docker image pull timeout (${buildTimeouts.DOCKER_PULL_TIMEOUT} HOURS) has been reached. Exiting...")
}
} catch (FlowInterruptedException e) {
throw new Exception("[ERROR] Controller docker image pull timeout (${buildTimeouts.DOCKER_PULL_TIMEOUT} HOURS) has been reached. Exiting...")
}

// Use our dockerfile if DOCKER_FILE is defined
Expand Down

0 comments on commit b495fe6

Please sign in to comment.