Skip to content

Commit

Permalink
handling sat img path update during 1.5 to 1.6 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaprasad-metimath committed Sep 30, 2024
1 parent b5a0d4a commit c297636
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion workflows/update_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,16 @@ function get_latest_tag_for_image() {
}

function get_filenames_referring_to_image() {
grep -RHl -e "${THIS_IMAGE}:" .
local fallback_image="artifactory.algol60.net/csm-docker/stable/cray-sat"
# Search for filenames referring to the image in the passed THIS_IMAGE value
filenames=$(grep -RHl -e "${THIS_IMAGE}:" .)
# If no files are found, search for the image in the fallback location
if [[ -z $filenames && ${THIS_IMAGE} =~ cray-sat ]]; then
#echo "No references found for ${THIS_IMAGE}, searching for ${fallback_image} instead."
filenames=$(grep -RHl -e "${fallback_image}:" .)
fi
# Return the list of filenames
echo "$filenames"
}

function update_tags_in_file() {
Expand All @@ -98,8 +107,22 @@ function update_tags_in_file() {
sed -i -e "s|${THIS_IMAGE}:.*|${THIS_IMAGE}:${LATEST_TAG}|g" $THIS_FILE
}

function update_cray_sat_image() {
THIS_IMAGE=$1
# Capture the output of the podman search for img & update the img if it doesnt exist
SEARCH_OUTPUT=$(podman search ${DEFAULT_REGISTRY_NAME}/${THIS_IMAGE} 2>&1)
if [[ -z ${SEARCH_OUTPUT} ]]; then
THIS_IMAGE="artifactory.algol60.net/sat-docker/stable/cray-sat"
fi
echo "$THIS_IMAGE"
}

# Look up the latest tag for each image found and update the references in every file.
for THIS_IMAGE in $(get_list_of_images_to_update); do
if [[ ${THIS_IMAGE} =~ cray-sat ]]; then
# CASMTRIAGE-7175 handle cray-sat image
THIS_IMAGE=$(update_cray_sat_image $THIS_IMAGE)
fi
LATEST_TAG=$(get_latest_tag_for_image $THIS_IMAGE)
# CASMTRIAGE-6188 retry for up to 60 seconds if LATEST_TAG is empty
i=1
Expand Down

0 comments on commit c297636

Please sign in to comment.