Skip to content

Commit

Permalink
Skip unused images to pull from MCR (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraksh1 authored Mar 12, 2024
1 parent 7023a05 commit 9de9485
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions vsts/scripts/tagRunTimeImagesForRelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,26 @@ if [ -f "$outFilePmeMCR" ]; then
rm $outFilePmeMCR
fi

declare -r skipImages=("python:3.7" "dotnetcore:3" "dotnetcore:5" "php:7" "ruby")

# This is a temporary function that will be used to skip unused images and will save some space on the agent.
should_skip() {
local image="$1"
local matched=false
for word in "${skipImages[@]}"; do
if [[ "$image" == *"$word"* ]]; then
matched=true
break
fi
done
echo "$matched"
}

echo "Iterating over previously pushed images defined in new '$sourceFile' file..."

while read sourceImage; do
# Always use specific build number based tag and then use the same tag to create a 'latest' tag and push it
if [[ $sourceImage == *:*-* ]]; then
# Always use specific build number based tag and then use the same tag to create a 'latest' tag and push it
if [[ $sourceImage == *:*-* && $(should_skip "$sourceImage") == "false" ]]; then
echo "Pulling the source image $sourceImage ..."
docker pull "$sourceImage" | sed 's/^/ /'

Expand Down

0 comments on commit 9de9485

Please sign in to comment.