@@ -258,66 +258,12 @@ jobs:
258258 if : github.ref == 'refs/heads/main'
259259 run : az acr login --name ${{ secrets.ACR_NAME }}
260260
261- - name : Tag All Repositories with new short commit hash
261+ - name : Tag all repositories with new short commit hash
262262 env :
263263 ACR_NAME : ${{ secrets.ACR_NAME }}
264264 SHORT_COMMIT_HASH : ${{ needs.build-and-push.outputs.short_commit_hash }}
265265 ENVIRONMENT_TAG : ${{ inputs.environment_tag }}
266-
267- run : |
268- echo "Attempting to tag all repositories in ACR $ACR_NAME with short commit hash: $SHORT_COMMIT_HASH"
269- echo "Source tag for import will be: $ENVIRONMENT_TAG"
270-
271- # Get list of repositories
272- repo_list=$(az acr repository list --name "$ACR_NAME" --output tsv)
273-
274- if [ -z "$repo_list" ]; then
275- echo "No repositories found in ACR $ACR_NAME. Nothing to tag."
276- exit 0
277- fi
278-
279- echo "Found repositories: $(echo $repo_list | wc -w)"
280- echo "---"
281-
282- exit_code=0
283-
284- for repo_name in $repo_list; do
285- source_image="${ACR_NAME}.azurecr.io/${repo_name}:${ENVIRONMENT_TAG}"
286- target_image="${repo_name}:${SHORT_COMMIT_HASH}"
287-
288- echo "Processing repository: $repo_name"
289-
290- echo " Checking for existing target tag: $SHORT_COMMIT_HASH"
291- target_tag_check_output=$(az acr manifest list-metadata --registry "$ACR_NAME" --name "$repo_name" --query "[?tags.contains(@, '${SHORT_COMMIT_HASH}')]" --output tsv)
292- target_tag_check_status=$?
293-
294- if [ $target_tag_check_status -eq 0 ] && [ -n "$target_tag_check_output" ]; then
295- echo " Target tag '$SHORT_COMMIT_HASH' already exists. Skipping import for this repository."
296- echo "---"
297- continue
298- fi
299-
300- echo " Proceeding with import attempt: $source_image -> $target_image"
301-
302- az acr import \
303- --name "$ACR_NAME" \
304- --source "$source_image" \
305- --image "$target_image" \
306- --force
307-
308- import_status=$?
309-
310- if [ $import_status -ne 0 ]; then
311- echo " ⚠️ Warning: ACR import command failed for repository '$repo_name' (Exit Code: $import_status)."
312- exit_code=1 # Record import failure
313- else
314- echo " Import successful for '$repo_name'."
315- fi
316- echo "---"
317- done
318-
319- echo "Finished processing all repositories."
320- exit $exit_code
266+ run : bash ./templates/scripts/deployments/append-commit-hash.sh
321267
322268 aggregate-json :
323269 runs-on : ubuntu-latest
0 commit comments