Skip to content

Commit

Permalink
Mirror __build_packages changes to __build_image
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Rift <anna.rift@hpe.com>
  • Loading branch information
arifthpe committed Feb 24, 2025
1 parent 8ea89a4 commit 6302848
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions util/packaging/common/build_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ __build_image() {
local chapel_version=$4
local package_version=$5
local docker_dir_name=$6
local docker_image_base=$7

# default to 1 core
local para=${7:-1}
Expand All @@ -112,10 +113,14 @@ __build_image() {
# Try to pull the latest version of this image, as a best effort.
docker pull $docker_image_base || true
# Whether we pulled successfully or not, use the image SHA256 digest to
# identify the copy of it we have locally, so build can proceed with an old
# version.
export DOCKER_IMAGE_NAME_FULL="$(docker inspect --format='{{index .RepoDigests 0}}' $docker_image_base)"
echo "Using image digest ${DOCKER_IMAGE_NAME_FULL} for $docker_image_base"
# identify the copy of it we have locally (if present), so build can proceed
# with that version.
if [ -z "$(docker image ls -q $docker_image_base)" ]; then
echo "Error: Failed to pull image $docker_image_base and a copy does not exist locally"
exit 1
fi
local docker_image_name_full="$(docker inspect --format='{{index .RepoDigests 0}}' $docker_image_base)"
echo "Using image digest ${docker_image_name_full} for $docker_image_base"

# if there is a template file, use it to generate the Dockerfile
if [ -f Dockerfile.template ]; then
Expand All @@ -130,7 +135,7 @@ __build_image() {
--build-arg "PACKAGE_VERSION=$package_version" \
--build-arg "OS_NAME=$os" \
--build-arg "DOCKER_DIR_NAME=$docker_dir_name" \
--build-arg "DOCKER_IMAGE_NAME_FULL=$DOCKER_IMAGE_NAME_FULL" \
--build-arg "DOCKER_IMAGE_NAME_FULL=$docker_image_name_full" \
--build-arg "PARALLEL=$para" \
-t $__docker_tag \
-f Dockerfile ../..
Expand Down

0 comments on commit 6302848

Please sign in to comment.