Loading .gitlab-ci.yml +61 −84 Original line number Diff line number Diff line Loading @@ -716,7 +716,7 @@ nightly_compare_failed_images_job: # Maps an image registry path to the variable containing # the GitLab API URL for that project's registry repositories. get_repository_api_url() { get_tags_api_url() { case "$1" in */fabric-api-jvm) printf '%s\n' "${FABRIC_API_URL:-}" Loading Loading @@ -767,84 +767,33 @@ nightly_compare_failed_images_job: # Finds the 8-character commit tag whose registry digest # matches failed-nightly-YYYY-MM-DD. find_commit_for_failed_image() { IMAGE_PATH="$1" FAILED_TAG="$2" REPOSITORIES_URL="$3" FAILED_TAG="$1" TAGS_API_URL="$2" echo "Commit lookup for: $IMAGE_PATH" >&2 echo "Repository API URL: $REPOSITORIES_URL" >&2 echo "Commit lookup using: $TAGS_API_URL" >&2 if [ -z "$REPOSITORIES_URL" ]; then echo "Commit lookup failed: repository API URL is empty." >&2 if [ -z "$TAGS_API_URL" ]; then echo "Commit lookup failed: tags API URL is empty." >&2 printf '%s\n' "Unknown" return fi REPOSITORIES_JSON=$( curl \ --fail \ --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "$REPOSITORIES_URL" ) || { echo "Commit lookup failed: could not list registry repositories." >&2 printf '%s\n' "Unknown" return } echo "Repositories returned by API:" >&2 printf '%s\n' "$REPOSITORIES_JSON" | jq -r '.[] | " id=\(.id) project_id=\(.project_id) location=\(.location)"' \ >&2 REPOSITORY_DATA=$( printf '%s' "$REPOSITORIES_JSON" | jq -r \ --arg IMAGE_PATH "$IMAGE_PATH" \ ' .[] | select( .location == $IMAGE_PATH or ($IMAGE_PATH | endswith(.path)) ) | "\(.id) \(.project_id)" ' | head -n 1 ) # Remove existing query parameters such as: # ?page=1&per_page=500 TAGS_API_BASE="${TAGS_API_URL%%\?*}" REPOSITORY_ID=$( printf '%s\n' "$REPOSITORY_DATA" | awk '{print $1}' ) PROJECT_ID=$( printf '%s\n' "$REPOSITORY_DATA" | awk '{print $2}' ) if [ -z "$REPOSITORY_ID" ] || [ "$REPOSITORY_ID" = "null" ] || [ -z "$PROJECT_ID" ] || [ "$PROJECT_ID" = "null" ]; then echo "Commit lookup failed: matching registry repository was not found." >&2 printf '%s\n' "Unknown" return fi echo "Repository ID: $REPOSITORY_ID" >&2 echo "Project ID: $PROJECT_ID" >&2 echo "Tags API base: $TAGS_API_BASE" >&2 # Get the digest of the failed-nightly tag. FAILED_TAG_JSON=$( curl \ --fail \ --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "${CI_API_V4_URL}/projects/${PROJECT_ID}/registry/repositories/${REPOSITORY_ID}/tags/${FAILED_TAG}" --url "${TAGS_API_BASE}/${FAILED_TAG}" ) || { echo "Commit lookup failed: could not retrieve tag $FAILED_TAG." >&2 echo "Could not retrieve failed tag: $FAILED_TAG" >&2 printf '%s\n' "Unknown" return } Loading @@ -855,7 +804,7 @@ nightly_compare_failed_images_job: ) if [ -z "$FAILED_DIGEST" ]; then echo "Commit lookup failed: failed tag has no digest." >&2 echo "Failed tag has no digest: $FAILED_TAG" >&2 printf '%s\n' "Unknown" return fi Loading @@ -871,9 +820,9 @@ nightly_compare_failed_images_job: --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "${CI_API_V4_URL}/projects/${PROJECT_ID}/registry/repositories/${REPOSITORY_ID}/tags?per_page=100&page=${PAGE}" --url "${TAGS_API_BASE}?page=${PAGE}&per_page=100" ) || { echo "Commit lookup failed: could not list registry tags." >&2 echo "Could not retrieve registry tags." >&2 printf '%s\n' "Unknown" return } Loading @@ -887,38 +836,66 @@ nightly_compare_failed_images_job: break fi # Keep only tags that look like CI_COMMIT_SHORT_SHA. # # Examples kept: # 0c7443d8 # 207c82b8 # 35f7071b # # Examples ignored: # latest # dev-latest # 1.0.0 # failed-nightly-2026-07-22 COMMIT_TAGS=$( printf '%s' "$TAGS_JSON" | jq -r '.[].name' | jq -r ' .[] | ( .name // (.location | split(":") | last) ) ' | grep -E '^[0-9a-fA-F]{8}$' || true ) for TAG in $COMMIT_TAGS; do echo "Checking commit tag: $TAG" >&2 echo "Commit tags found on page $PAGE:" >&2 TAG_JSON=$( if [ -n "$COMMIT_TAGS" ]; then printf '%s\n' "$COMMIT_TAGS" | sed 's/^/ /' >&2 else echo " none" >&2 fi for COMMIT_TAG in $COMMIT_TAGS; do COMMIT_TAG_JSON=$( curl \ --fail \ --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "${CI_API_V4_URL}/projects/${PROJECT_ID}/registry/repositories/${REPOSITORY_ID}/tags/${TAG}" --url "${TAGS_API_BASE}/${COMMIT_TAG}" ) || { echo "Could not retrieve tag details for $TAG." >&2 echo "Could not retrieve commit tag: $COMMIT_TAG" >&2 continue } TAG_DIGEST=$( printf '%s' "$TAG_JSON" | COMMIT_DIGEST=$( printf '%s' "$COMMIT_TAG_JSON" | jq -r '.digest // empty' ) echo "Tag $TAG digest: $TAG_DIGEST" >&2 echo "Checking commit tag:" >&2 echo " Tag: $COMMIT_TAG" >&2 echo " Digest: $COMMIT_DIGEST" >&2 if [ "$TAG_DIGEST" = "$FAILED_DIGEST" ]; then echo "Matching commit found: $TAG" >&2 printf '%s\n' "$TAG" if [ "$COMMIT_DIGEST" = "$FAILED_DIGEST" ]; then echo "Matching commit found: $COMMIT_TAG" >&2 printf '%s\n' "$COMMIT_TAG" return fi done Loading @@ -926,7 +903,7 @@ nightly_compare_failed_images_job: PAGE=$((PAGE + 1)) done echo "No matching commit tag found for digest $FAILED_DIGEST." >&2 echo "No commit tag matches digest: $FAILED_DIGEST" >&2 printf '%s\n' "Unknown" } Loading Loading @@ -1004,15 +981,15 @@ nightly_compare_failed_images_job: # Find the CI_COMMIT_SHORT_SHA tag that points # to the same registry digest as the failed image. REPOSITORIES_URL=$( get_repository_api_url "$IMAGE" TAGS_API_URL=$( get_tags_api_url "$IMAGE" ) COMMIT_SHORT_SHA=$( find_commit_for_failed_image \ "$IMAGE" \ "$FAILED_DATE_TAG" \ "$REPOSITORIES_URL" "$TAGS_API_URL" ) if [ -z "$COMMIT_SHORT_SHA" ]; then Loading Loading
.gitlab-ci.yml +61 −84 Original line number Diff line number Diff line Loading @@ -716,7 +716,7 @@ nightly_compare_failed_images_job: # Maps an image registry path to the variable containing # the GitLab API URL for that project's registry repositories. get_repository_api_url() { get_tags_api_url() { case "$1" in */fabric-api-jvm) printf '%s\n' "${FABRIC_API_URL:-}" Loading Loading @@ -767,84 +767,33 @@ nightly_compare_failed_images_job: # Finds the 8-character commit tag whose registry digest # matches failed-nightly-YYYY-MM-DD. find_commit_for_failed_image() { IMAGE_PATH="$1" FAILED_TAG="$2" REPOSITORIES_URL="$3" FAILED_TAG="$1" TAGS_API_URL="$2" echo "Commit lookup for: $IMAGE_PATH" >&2 echo "Repository API URL: $REPOSITORIES_URL" >&2 echo "Commit lookup using: $TAGS_API_URL" >&2 if [ -z "$REPOSITORIES_URL" ]; then echo "Commit lookup failed: repository API URL is empty." >&2 if [ -z "$TAGS_API_URL" ]; then echo "Commit lookup failed: tags API URL is empty." >&2 printf '%s\n' "Unknown" return fi REPOSITORIES_JSON=$( curl \ --fail \ --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "$REPOSITORIES_URL" ) || { echo "Commit lookup failed: could not list registry repositories." >&2 printf '%s\n' "Unknown" return } echo "Repositories returned by API:" >&2 printf '%s\n' "$REPOSITORIES_JSON" | jq -r '.[] | " id=\(.id) project_id=\(.project_id) location=\(.location)"' \ >&2 REPOSITORY_DATA=$( printf '%s' "$REPOSITORIES_JSON" | jq -r \ --arg IMAGE_PATH "$IMAGE_PATH" \ ' .[] | select( .location == $IMAGE_PATH or ($IMAGE_PATH | endswith(.path)) ) | "\(.id) \(.project_id)" ' | head -n 1 ) # Remove existing query parameters such as: # ?page=1&per_page=500 TAGS_API_BASE="${TAGS_API_URL%%\?*}" REPOSITORY_ID=$( printf '%s\n' "$REPOSITORY_DATA" | awk '{print $1}' ) PROJECT_ID=$( printf '%s\n' "$REPOSITORY_DATA" | awk '{print $2}' ) if [ -z "$REPOSITORY_ID" ] || [ "$REPOSITORY_ID" = "null" ] || [ -z "$PROJECT_ID" ] || [ "$PROJECT_ID" = "null" ]; then echo "Commit lookup failed: matching registry repository was not found." >&2 printf '%s\n' "Unknown" return fi echo "Repository ID: $REPOSITORY_ID" >&2 echo "Project ID: $PROJECT_ID" >&2 echo "Tags API base: $TAGS_API_BASE" >&2 # Get the digest of the failed-nightly tag. FAILED_TAG_JSON=$( curl \ --fail \ --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "${CI_API_V4_URL}/projects/${PROJECT_ID}/registry/repositories/${REPOSITORY_ID}/tags/${FAILED_TAG}" --url "${TAGS_API_BASE}/${FAILED_TAG}" ) || { echo "Commit lookup failed: could not retrieve tag $FAILED_TAG." >&2 echo "Could not retrieve failed tag: $FAILED_TAG" >&2 printf '%s\n' "Unknown" return } Loading @@ -855,7 +804,7 @@ nightly_compare_failed_images_job: ) if [ -z "$FAILED_DIGEST" ]; then echo "Commit lookup failed: failed tag has no digest." >&2 echo "Failed tag has no digest: $FAILED_TAG" >&2 printf '%s\n' "Unknown" return fi Loading @@ -871,9 +820,9 @@ nightly_compare_failed_images_job: --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "${CI_API_V4_URL}/projects/${PROJECT_ID}/registry/repositories/${REPOSITORY_ID}/tags?per_page=100&page=${PAGE}" --url "${TAGS_API_BASE}?page=${PAGE}&per_page=100" ) || { echo "Commit lookup failed: could not list registry tags." >&2 echo "Could not retrieve registry tags." >&2 printf '%s\n' "Unknown" return } Loading @@ -887,38 +836,66 @@ nightly_compare_failed_images_job: break fi # Keep only tags that look like CI_COMMIT_SHORT_SHA. # # Examples kept: # 0c7443d8 # 207c82b8 # 35f7071b # # Examples ignored: # latest # dev-latest # 1.0.0 # failed-nightly-2026-07-22 COMMIT_TAGS=$( printf '%s' "$TAGS_JSON" | jq -r '.[].name' | jq -r ' .[] | ( .name // (.location | split(":") | last) ) ' | grep -E '^[0-9a-fA-F]{8}$' || true ) for TAG in $COMMIT_TAGS; do echo "Checking commit tag: $TAG" >&2 echo "Commit tags found on page $PAGE:" >&2 TAG_JSON=$( if [ -n "$COMMIT_TAGS" ]; then printf '%s\n' "$COMMIT_TAGS" | sed 's/^/ /' >&2 else echo " none" >&2 fi for COMMIT_TAG in $COMMIT_TAGS; do COMMIT_TAG_JSON=$( curl \ --fail \ --silent \ --show-error \ --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" \ --url "${CI_API_V4_URL}/projects/${PROJECT_ID}/registry/repositories/${REPOSITORY_ID}/tags/${TAG}" --url "${TAGS_API_BASE}/${COMMIT_TAG}" ) || { echo "Could not retrieve tag details for $TAG." >&2 echo "Could not retrieve commit tag: $COMMIT_TAG" >&2 continue } TAG_DIGEST=$( printf '%s' "$TAG_JSON" | COMMIT_DIGEST=$( printf '%s' "$COMMIT_TAG_JSON" | jq -r '.digest // empty' ) echo "Tag $TAG digest: $TAG_DIGEST" >&2 echo "Checking commit tag:" >&2 echo " Tag: $COMMIT_TAG" >&2 echo " Digest: $COMMIT_DIGEST" >&2 if [ "$TAG_DIGEST" = "$FAILED_DIGEST" ]; then echo "Matching commit found: $TAG" >&2 printf '%s\n' "$TAG" if [ "$COMMIT_DIGEST" = "$FAILED_DIGEST" ]; then echo "Matching commit found: $COMMIT_TAG" >&2 printf '%s\n' "$COMMIT_TAG" return fi done Loading @@ -926,7 +903,7 @@ nightly_compare_failed_images_job: PAGE=$((PAGE + 1)) done echo "No matching commit tag found for digest $FAILED_DIGEST." >&2 echo "No commit tag matches digest: $FAILED_DIGEST" >&2 printf '%s\n' "Unknown" } Loading Loading @@ -1004,15 +981,15 @@ nightly_compare_failed_images_job: # Find the CI_COMMIT_SHORT_SHA tag that points # to the same registry digest as the failed image. REPOSITORIES_URL=$( get_repository_api_url "$IMAGE" TAGS_API_URL=$( get_tags_api_url "$IMAGE" ) COMMIT_SHORT_SHA=$( find_commit_for_failed_image \ "$IMAGE" \ "$FAILED_DATE_TAG" \ "$REPOSITORIES_URL" "$TAGS_API_URL" ) if [ -z "$COMMIT_SHORT_SHA" ]; then Loading