Skip to content

Commit

Permalink
Fix maker-image's circular build dependency
Browse files Browse the repository at this point in the history
This commit adjusts `scripts/build-image.sh` to avoid attempting to run
the maker-image while trying to build the maker-image. If a user is
attempting to build the maker-image and it is detected that the build
is running outside of the maker-image, then an attempt to run the
maker-image will not be made. Users will have to ensure that local
versions of the required tools are available.

The build-image.sh script will attempt to run crane within the
maker-image, in order to pull information about the target build image.
If the user is trying to build the maker-image, and a pre-existing
maker-image is not available, for instance if quay.io is down, then
the script will be unable to build a new maker-image. In this case,
the user is not expected to have a local copy of crane that the script
can use.

Signed-off-by: Ryan Drew <[email protected]>
  • Loading branch information
learnitall authored and tklauser committed Mar 20, 2024
1 parent bac1d10 commit 43f9da5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ for registry in "${registries[@]}" ; do
done

check_image_tag() {
if [ -n "${MAKER_CONTAINER+x}" ] ; then
if [ -n "${MAKER_CONTAINER+x}" ] || [ "${image_name}" == "image-maker" ] ; then
which crane || (echo "WARNING: crane expected but not found, unable to check if image tag exists" ; return 1)
crane digest "${1}" || (echo "error: crane returned $?" ; return 1)
else
# unlike with other utility scripts we don't want to self-re-exec inside the container, as native `docker buildx` is preferred
Expand Down

0 comments on commit 43f9da5

Please sign in to comment.