Skip to content

Commit

Permalink
avoids image name error when pulling from non-default registery
Browse files Browse the repository at this point in the history
when pulling from a non-default registery, you will have local image in full name include docker registery in it. But the whole pipeline works with DEFAULT behaviour when pulling from dockerhub that creates local image with image name only. This change, adds a tag to pulled local image with image_name only and avoids issue in continue.

Signed-off-by: [email protected]
  • Loading branch information
mahdipub committed Jul 9, 2024
1 parent d3d1287 commit 95e4911
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,9 @@ class Build {
}
}
// Store the pulled docker image digest as 'buildinfo'
dockerImageDigest = context.sh(script: "docker inspect --format='{{.RepoDigests}}' ${buildConfig.DOCKER_IMAGE}", returnStdout:true)
def long_docker_image_name = context.sh(script: "docker image ls | grep ${buildConfig.DOCKER_IMAGE} | head -n1 | awk '{print \$1}'", returnStdout:true).trim()
context.sh(script: "docker tag '${long_docker_image_name}' '${buildConfig.DOCKER_IMAGE}'", returnStdout:false)
dockerImageDigest = context.sh(script: "docker inspect --format='{{.RepoDigests}}' ${long_docker_image_name}", returnStdout:true)

// Use our dockerfile if DOCKER_FILE is defined
if (buildConfig.DOCKER_FILE) {
Expand Down

0 comments on commit 95e4911

Please sign in to comment.