Skip to content

Commit

Permalink
Extend the usage of build ENV USE_LOCAL_IMAGES
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Wang <jian.wang@suse.com>
  • Loading branch information
w13915984028 authored and bk201 committed Sep 5, 2024
1 parent f0b21b9 commit cfd268f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/lib/image
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,24 @@ pull_images() {
return
fi

# If a tag is specified via the ENV USE_LOCAL_IMAGES, then directly check this image and continue.
# For example: export USE_LOCAL_IMAGES=fix6486-head
# This will let `make build-iso` from Harvester local development much easier.

# If an image is in the exlcude list or its tag ends with "-head", we always pull it.
# Otherwise, we check if the image exists on the system. If yes, we do nothing.
for image in $(cat $image_list); do
repository=$(echo $image | awk -F ':' '{print $1}')
tag=$(echo $image | awk -F ':' '{print $2}')

if [[ $USE_LOCAL_IMAGES == $tag ]]; then
echo "[ImageCache] $image meets the specified tag from USE_LOCAL_IMAGES."
if docker image inspect $image &>/dev/null; then
echo "[ImageCache] $image exists."
continue
fi
fi

if yq -e e ".exclude.repos[] | select(. == \"${repository}\")" $image_cache_db &>/dev/null; then
echo "[ImageCache] $image is in the exclude.repos list."
elif [[ $tag == *"-head" ]]; then
Expand Down

0 comments on commit cfd268f

Please sign in to comment.