Skip to content

fix(owlbot-postprocessor): ensure GCR digest has sha256 prefix - #462

Merged
quartzmo merged 1 commit into
googleapis:mainfrom
quartzmo:fix-cloudbuild-digest-format
Aug 17, 2026
Merged

fix(owlbot-postprocessor): ensure GCR digest has sha256 prefix#462
quartzmo merged 1 commit into
googleapis:mainfrom
quartzmo:fix-cloudbuild-digest-format

Conversation

@quartzmo

Copy link
Copy Markdown
Member

This PR was dry-run tested with the following script locally:

#!/bin/bash
# Local dry-run verification script to test the cloudbuild.yaml bash logic.
# Execute this in your gMac terminal.

echo "=== 1. Testing GCR query for latest image ==="
PREV_DIGEST=$(gcloud container images list-tags gcr.io/cloud-devrel-public-resources/owlbot-ruby --filter="tags=latest" --format="value(digest)" 2>/dev/null || true)

if [ -z "$PREV_DIGEST" ]; then
  echo "Error: Could not retrieve the previous latest digest from GCR. Are you authenticated?"
  exit 1
fi

echo "Raw GCR query returned: '$PREV_DIGEST'"

echo "=== 2. Parsing Digest and formatting ==="
HEX_DIGEST=${PREV_DIGEST#sha256:}
FULL_PREV_DIGEST="sha256:$HEX_DIGEST"

echo "Parsed HEX_DIGEST: '$HEX_DIGEST'"
echo "Formatted FULL_PREV_DIGEST: '$FULL_PREV_DIGEST'"

echo "=== 3. Dry-running gcloud add-tag command ==="
echo "If this were live, it would execute:"
echo "  gcloud container images add-tag gcr.io/cloud-devrel-public-resources/owlbot-ruby@$FULL_PREV_DIGEST gcr.io/cloud-devrel-public-resources/owlbot-ruby:deprecated-public-image-$HEX_DIGEST --quiet"

echo "=== 4. Syntax validation ==="
if [[ "$FULL_PREV_DIGEST" =~ ^sha256:[a-f0-9]{12,64}$ ]]; then
  echo "Success: Digest format '$FULL_PREV_DIGEST' is valid."
else
  echo "Fail: Digest format '$FULL_PREV_DIGEST' is invalid. Must match sha256:<hex>."
  exit 1
fi

@quartzmo
quartzmo requested a review from a team as a code owner August 17, 2026 23:03
@quartzmo
quartzmo merged commit 84cd693 into googleapis:main Aug 17, 2026
14 checks passed
@quartzmo
quartzmo deleted the fix-cloudbuild-digest-format branch August 17, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants