Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the usage of build ENV USE_LOCAL_IMAGES (backport #828) #830

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading