Skip to content

bin helpers: add script to verify version image tags against GitHub - #273

Merged
pawbhard merged 6 commits into
grpc:mainfrom
sergiitk:feat/bin/verify-version-image-tags
Aug 7, 2026
Merged

bin helpers: add script to verify version image tags against GitHub#273
pawbhard merged 6 commits into
grpc:mainfrom
sergiitk:feat/bin/verify-version-image-tags

Conversation

@sergiitk

Copy link
Copy Markdown
Member

Adds ./bin/verify_version_image_tags.sh helper script to check if docker images in Artifact Registry for gRPC release branches are tagged with the matching Git commit hash.

Usage:
  ./bin/verify_version_image_tags.sh [options]

Options:
  -n, --num-branches NUM   Number of recent version branches to verify (default: 3)
  -r, --registry REGISTRY  Artifact Registry path
  -l, --languages LANGS    Comma-separated list of languages (default: cpp,python,go,java)
  -m, --include-master     Include the master branch in verification

Examples:
  # Verify last 3 versions for all default languages
  ./bin/verify_version_image_tags.sh

  # Verify last 5 versions for C++ only
  ./bin/verify_version_image_tags.sh -n 5 -l cpp

  # Verify only the master branch for Go
  ./bin/verify_version_image_tags.sh -n 0 -m -l go

Disclaimer: AI generated under my supervision.

Adds `./bin/verify_version_image_tags.sh` helper script to check if
docker images in Artifact Registry for gRPC release branches are
tagged with the matching Git commit hash.

Usage:
  ./bin/verify_version_image_tags.sh [options]

Options:
  -n, --num-branches NUM   Number of recent version branches to verify (default: 3)
  -r, --registry REGISTRY  Artifact Registry path
  -l, --languages LANGS    Comma-separated list of languages (default: cpp,python,go,java)
  -m, --include-master     Include the master branch in verification

Examples:
  # Verify last 3 versions for all default languages
  ./bin/verify_version_image_tags.sh

  # Verify last 5 versions for C++ only
  ./bin/verify_version_image_tags.sh -n 5 -l cpp

  # Verify only the master branch for Go
  ./bin/verify_version_image_tags.sh -n 0 -m -l go
@sergiitk
sergiitk requested a review from a team as a code owner July 28, 2026 02:39
@sergiitk

Copy link
Copy Markdown
Member Author

Output sample, last 10 branches (./bin/verify_version_image_tags.sh -n 10)

Output
======================================================================
Verifying Image Tags for Last 10 Version Branches
Registry: us-docker.pkg.dev/grpc-testing/psm-interop
======================================================================

--- Language: CPP (repo: grpc/grpc) ---
Branch v1.83.x (Git SHA: c876f4da50f7da2f331888b88b2a7243514139fe)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.83.x -> c876f4da50f7da2f331888b88b2a7243514139fe
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.83.x -> c876f4da50f7da2f331888b88b2a7243514139fe

Branch v1.82.x (Git SHA: acccf84c0df20487d64101f528e5d426541ca4e5)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.82.x -> acccf84c0df20487d64101f528e5d426541ca4e5
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.82.x -> acccf84c0df20487d64101f528e5d426541ca4e5

Branch v1.81.x (Git SHA: a66af48307a887a70ff38aa078da2159d46112d1)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.81.x -> a66af48307a887a70ff38aa078da2159d46112d1
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.81.x -> a66af48307a887a70ff38aa078da2159d46112d1

Branch v1.80.x (Git SHA: d37a2895290b4ea431fb3a36baeccb5b28fde194)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.80.x -> d37a2895290b4ea431fb3a36baeccb5b28fde194
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.80.x -> d37a2895290b4ea431fb3a36baeccb5b28fde194

Branch v1.78.x (Git SHA: 201a13cf0aeed3a6d050605bb9356a32dc5e5b62)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.78.x -> 201a13cf0aeed3a6d050605bb9356a32dc5e5b62
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.78.x -> 201a13cf0aeed3a6d050605bb9356a32dc5e5b62

Branch v1.76.x (Git SHA: 719498daab2c2bd0bd77145750f3c2cb077af96a)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.76.x -> 719498daab2c2bd0bd77145750f3c2cb077af96a
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.76.x -> 719498daab2c2bd0bd77145750f3c2cb077af96a

Branch v1.75.x (Git SHA: 9b63ce0d513672c5daad4f28342f03863c5589e5)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.75.x -> 9b63ce0d513672c5daad4f28342f03863c5589e5
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.75.x -> 9b63ce0d513672c5daad4f28342f03863c5589e5

Branch v1.74.x (Git SHA: 893bdadd56dbb75fb156175afdaa2b0d47e1c15b)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.74.x -> 893bdadd56dbb75fb156175afdaa2b0d47e1c15b
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.74.x -> 893bdadd56dbb75fb156175afdaa2b0d47e1c15b

Branch v1.73.x (Git SHA: 6eae42baf0dc7950a8c25d227575a0d24c9aa286)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.73.x -> 6eae42baf0dc7950a8c25d227575a0d24c9aa286
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.73.x -> 6eae42baf0dc7950a8c25d227575a0d24c9aa286

Branch v1.72.x (Git SHA: d6b42b2fd3e522a60318c7e2f2021219c6b5c470)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.72.x -> d6b42b2fd3e522a60318c7e2f2021219c6b5c470
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.72.x -> d6b42b2fd3e522a60318c7e2f2021219c6b5c470

--- Language: PYTHON (repo: grpc/grpc) ---
Branch v1.83.x (Git SHA: c876f4da50f7da2f331888b88b2a7243514139fe)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.83.x -> c876f4da50f7da2f331888b88b2a7243514139fe
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.83.x -> c876f4da50f7da2f331888b88b2a7243514139fe

Branch v1.82.x (Git SHA: acccf84c0df20487d64101f528e5d426541ca4e5)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.82.x -> acccf84c0df20487d64101f528e5d426541ca4e5
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.82.x -> acccf84c0df20487d64101f528e5d426541ca4e5

Branch v1.81.x (Git SHA: a66af48307a887a70ff38aa078da2159d46112d1)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.81.x -> a66af48307a887a70ff38aa078da2159d46112d1
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.81.x -> a66af48307a887a70ff38aa078da2159d46112d1

Branch v1.80.x (Git SHA: d37a2895290b4ea431fb3a36baeccb5b28fde194)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.80.x -> d37a2895290b4ea431fb3a36baeccb5b28fde194
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.80.x -> d37a2895290b4ea431fb3a36baeccb5b28fde194

Branch v1.78.x (Git SHA: 201a13cf0aeed3a6d050605bb9356a32dc5e5b62)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.78.x -> 201a13cf0aeed3a6d050605bb9356a32dc5e5b62
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.78.x -> 201a13cf0aeed3a6d050605bb9356a32dc5e5b62

Branch v1.76.x (Git SHA: 719498daab2c2bd0bd77145750f3c2cb077af96a)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.76.x -> 719498daab2c2bd0bd77145750f3c2cb077af96a
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.76.x -> 719498daab2c2bd0bd77145750f3c2cb077af96a

Branch v1.75.x (Git SHA: 9b63ce0d513672c5daad4f28342f03863c5589e5)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.75.x -> 9b63ce0d513672c5daad4f28342f03863c5589e5
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.75.x -> 9b63ce0d513672c5daad4f28342f03863c5589e5

Branch v1.74.x (Git SHA: 893bdadd56dbb75fb156175afdaa2b0d47e1c15b)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.74.x -> 893bdadd56dbb75fb156175afdaa2b0d47e1c15b
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.74.x -> 893bdadd56dbb75fb156175afdaa2b0d47e1c15b

Branch v1.73.x (Git SHA: 6eae42baf0dc7950a8c25d227575a0d24c9aa286)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.73.x -> 6eae42baf0dc7950a8c25d227575a0d24c9aa286
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.73.x -> 6eae42baf0dc7950a8c25d227575a0d24c9aa286

Branch v1.72.x (Git SHA: d6b42b2fd3e522a60318c7e2f2021219c6b5c470)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-client:v1.72.x -> d6b42b2fd3e522a60318c7e2f2021219c6b5c470
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/python-server:v1.72.x -> d6b42b2fd3e522a60318c7e2f2021219c6b5c470

--- Language: GO (repo: grpc/grpc-go) ---
Branch v1.83.x (Git SHA: 8ce3ebf24af3c206bacf279adcf9c3a88981df68)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.83.x -> 8ce3ebf24af3c206bacf279adcf9c3a88981df68
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.83.x -> 8ce3ebf24af3c206bacf279adcf9c3a88981df68

Branch v1.82.x (Git SHA: 4b63829cae8d7ecd9156712395fbf8a0dfbe4029)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.82.x -> 4b63829cae8d7ecd9156712395fbf8a0dfbe4029
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.82.x -> 4b63829cae8d7ecd9156712395fbf8a0dfbe4029

Branch v1.81.x (Git SHA: dd2f5a09f6fa28df853613ed0e7df309d38f0f75)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.81.x -> dd2f5a09f6fa28df853613ed0e7df309d38f0f75
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.81.x -> dd2f5a09f6fa28df853613ed0e7df309d38f0f75

Branch v1.80.x (Git SHA: 5c2bea7277bcb23a7f346207c50f20bfb8585126)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.80.x -> 5c2bea7277bcb23a7f346207c50f20bfb8585126
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.80.x -> 5c2bea7277bcb23a7f346207c50f20bfb8585126

Branch v1.79.x (Git SHA: b61d3ceb51cb0105080484a02a79b71755d73508)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.79.x -> b61d3ceb51cb0105080484a02a79b71755d73508
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.79.x -> b61d3ceb51cb0105080484a02a79b71755d73508

Branch v1.78.x (Git SHA: 2446aaf77c9f4c70ab4a3a7c8c6d82e05e9b3b1c)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.78.x -> 2446aaf77c9f4c70ab4a3a7c8c6d82e05e9b3b1c
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.78.x -> 2446aaf77c9f4c70ab4a3a7c8c6d82e05e9b3b1c

Branch v1.77.x (Git SHA: 83ad572fa3a1d19c092ae9a3906cce19c8c87d33)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.77.x -> 83ad572fa3a1d19c092ae9a3906cce19c8c87d33
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.77.x -> 83ad572fa3a1d19c092ae9a3906cce19c8c87d33

Branch v1.76.x (Git SHA: 972d479867fe9d9ec26959d66f4440151d72d0a0)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.76.x -> 972d479867fe9d9ec26959d66f4440151d72d0a0
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.76.x -> 972d479867fe9d9ec26959d66f4440151d72d0a0

Branch v1.75.x (Git SHA: d914122fcda78793435da09f96f989470862a3ca)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.75.x -> d914122fcda78793435da09f96f989470862a3ca
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.75.x -> d914122fcda78793435da09f96f989470862a3ca

Branch v1.74.x (Git SHA: 693962db0728faabef6fc9abc0f96c6090c7419d)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-client:v1.74.x -> 693962db0728faabef6fc9abc0f96c6090c7419d
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/go-server:v1.74.x -> 693962db0728faabef6fc9abc0f96c6090c7419d

--- Language: JAVA (repo: grpc/grpc-java) ---
Branch v1.83.x (Git SHA: b4ca099f30d8c362fad54b63f34cab87c11530f2)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.83.x -> b4ca099f30d8c362fad54b63f34cab87c11530f2
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.83.x -> b4ca099f30d8c362fad54b63f34cab87c11530f2

Branch v1.82.x (Git SHA: 96b6849577fd2efea6f1544779b928100249ffc7)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.82.x -> 96b6849577fd2efea6f1544779b928100249ffc7
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.82.x -> 96b6849577fd2efea6f1544779b928100249ffc7

Branch v1.81.x (Git SHA: 14c0058dca81076b8a34f3eb4f90e966ace03c53)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.81.x -> 14c0058dca81076b8a34f3eb4f90e966ace03c53
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.81.x -> 14c0058dca81076b8a34f3eb4f90e966ace03c53

Branch v1.80.x (Git SHA: d38301521ceaa237f750c977886839f0a1fc791b)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.80.x -> d38301521ceaa237f750c977886839f0a1fc791b
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.80.x -> d38301521ceaa237f750c977886839f0a1fc791b

Branch v1.79.x (Git SHA: 2b746c0e588ad485893628b1067dfc1b3b018b27)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.79.x -> 2b746c0e588ad485893628b1067dfc1b3b018b27
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.79.x -> 2b746c0e588ad485893628b1067dfc1b3b018b27

Branch v1.78.x (Git SHA: 4497e2bfd54becc3f74932e07b399ba49fa0b2e6)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.78.x -> 4497e2bfd54becc3f74932e07b399ba49fa0b2e6
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.78.x -> 4497e2bfd54becc3f74932e07b399ba49fa0b2e6

Branch v1.77.x (Git SHA: 3d733e707cf165a62cfb3d6e2008879e2b384685)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.77.x -> 3d733e707cf165a62cfb3d6e2008879e2b384685
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.77.x -> 3d733e707cf165a62cfb3d6e2008879e2b384685

Branch v1.76.x (Git SHA: c80f062543fa501de5cde0d9c9a6936c0471d198)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.76.x -> c80f062543fa501de5cde0d9c9a6936c0471d198
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.76.x -> c80f062543fa501de5cde0d9c9a6936c0471d198

Branch v1.75.x (Git SHA: 96e454b2e4833b2e10c47def03639acafffb667e)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.75.x -> 96e454b2e4833b2e10c47def03639acafffb667e
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.75.x -> 96e454b2e4833b2e10c47def03639acafffb667e

Branch v1.74.x (Git SHA: 2c8fc26d15a2ee9048553b8ee95d81b703386fa1)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-client:v1.74.x -> 2c8fc26d15a2ee9048553b8ee95d81b703386fa1
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/java-server:v1.74.x -> 2c8fc26d15a2ee9048553b8ee95d81b703386fa1
======================================================================
🎉 RESULT: ALL IMAGE TAG VERIFICATIONS PASSED 🎉

@sergiitk

sergiitk commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Fail/pass messages sample, checking current cpp master and the latest version branch (./bin/verify_version_image_tags.sh -l cpp -m -n 1)

======================================================================
Verifying Image Tags for Last 1 Version Branches
Registry: us-docker.pkg.dev/grpc-testing/psm-interop
======================================================================

--- Language: CPP (repo: grpc/grpc) ---
Branch master (Git SHA: e3faa8e6bbbeaa7337244a03d6dfa7e3c5a8a92f)
❌ [FAIL] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:master -> false (Expected e3faa8e6bbbeaa7337244a03d6dfa7e3c5a8a92f)
❌ [FAIL] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:master -> false (Expected e3faa8e6bbbeaa7337244a03d6dfa7e3c5a8a92f)

Branch v1.83.x (Git SHA: c876f4da50f7da2f331888b88b2a7243514139fe)
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-client:v1.83.x -> c876f4da50f7da2f331888b88b2a7243514139fe
✅ [PASS] https://us-docker.pkg.dev/grpc-testing/psm-interop/cpp-server:v1.83.x -> c876f4da50f7da2f331888b88b2a7243514139fe
======================================================================
💥 RESULT: IMAGE TAG VERIFICATION FAILED 💥

@sergiitk
sergiitk requested review from pawbhard and removed request for kannanjgithub July 28, 2026 02:46
@sergiitk

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new bash script, bin/verify_version_image_tags.sh, which verifies that Docker images in Artifact Registry for the last N version branches of gRPC languages are tagged with their matching Git commit hashes. The review feedback highlights compatibility issues with macOS and older environments due to the use of associative arrays (declare -A), which require Bash 4.0+. Additionally, the feedback recommends removing || true error suppressions on several commands (such as gh and jq) to ensure the script fails fast with clear error messages, and suggests using printf instead of echo for safer JSON handling.

Comment thread bin/verify_version_image_tags.sh
Comment thread bin/verify_version_image_tags.sh
Comment thread bin/verify_version_image_tags.sh Outdated
Comment thread bin/verify_version_image_tags.sh Outdated
Comment thread bin/verify_version_image_tags.sh Outdated
Address PR review feedback and debugging findings across script:
- Remove error suppression (`|| true` and `|| echo '[]'`) on GitHub
  and Google Cloud CLI command substitutions to enforce fail-fast
  error visibility under `set -eo pipefail`.
- Switch variable piping from `echo` to `printf '%s\n'` for reliable
  multiline branch list and JSON evaluation.
- Replace array unfolding in `jq` tag assertions with scalar index
  evaluations (`index(...) != null`) and switch from tab `\t` to pipe
  `|` unit delimiters (`IFS='|'`) to prevent whitespace collapsing
  when images lack commit SHA tags.
@sergiitk

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new bash script, bin/verify_version_image_tags.sh, designed to verify that Docker images in the Artifact Registry for recent gRPC language version branches are correctly tagged with their corresponding Git commit hashes. The review feedback highlights several critical improvements: resolving potential runtime crashes in jq when dealing with untagged images, ensuring compatibility with macOS's default Bash 3.2 by removing associative arrays, optimizing GitHub API calls when the branch count is zero, and adding input validation for the --num-branches argument.

Comment thread bin/verify_version_image_tags.sh Outdated
Comment thread bin/verify_version_image_tags.sh
Comment thread bin/verify_version_image_tags.sh
Comment thread bin/verify_version_image_tags.sh Outdated
Comment thread bin/verify_version_image_tags.sh
- Skip GraphQL query in fetch_version_branches when count is 0.

- Guard printf sorting pipeline against empty branch string outputs.

- Add null-coalescing operators (.tags // []) in verify_image_tag
  to prevent jq errors on untagged image manifests.

- Validate that --num-branches is a non-negative integer in main.
@sergiitk

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new bash script, bin/verify_version_image_tags.sh, designed to verify that Docker images in the Artifact Registry for recent gRPC version branches are correctly tagged with their corresponding Git commit hashes. The review feedback highlights two important issues: first, the GraphQL query should use query variables instead of shell string interpolation to prevent syntax errors and improve robustness; second, the command-line argument parsing needs validation to prevent the script from crashing due to unsafe shifts when options are provided without arguments.

Comment thread bin/verify_version_image_tags.sh Outdated
Comment thread bin/verify_version_image_tags.sh Outdated
- Use GraphQL variables (-F owner, -F name) in fetch_version_branches.

- Add jq optional chaining (.data.repository?.refs?.nodes[]?) to
  handle null repository payloads safely.

- Group CLI parameter flags (-n, -r, -l) and add bounds validation
  ([[ 0 -ge 2 ]]) in main to prevent raw $2 unbound variable errors.
@sergiitk

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Bash script, bin/verify_version_image_tags.sh, designed to verify that Docker images in Artifact Registry for the last N version branches of gRPC languages are tagged with their matching Git commit hashes. The code review feedback is highly constructive and suggests optimizing JSON parsing using here-strings to avoid ARG_MAX limits, replacing associative arrays with indirect variable references to ensure compatibility with Bash 3 (particularly for macOS users), and gracefully handling gcloud command failures to prevent abrupt script termination under set -e.

Comment thread bin/verify_version_image_tags.sh Outdated
Comment thread bin/verify_version_image_tags.sh
Comment thread bin/verify_version_image_tags.sh
Comment thread bin/verify_version_image_tags.sh Outdated
sergiitk added 2 commits July 28, 2026 01:22
- Stream tags JSON via here-string (<<< "${tags_json}") to eliminate
  unnecessary subshell pipeline creation in verify_image_tag.

- Add compound error check (||) around gcloud list-tags invocations
  to emit clean diagnostic messages to stderr upon failure.
- Replace inline single-quoted query string with quoted heredoc
  assignment (read -r -d '' gql_query << 'QUERY').

- Remove # shellcheck disable=SC2016 annotation while preserving
  literal GraphQL variable syntax and static lint compliance.
@arjan-bal
arjan-bal removed their request for review July 28, 2026 16:33

@pawbhard pawbhard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pawbhard
pawbhard merged commit df36028 into grpc:main Aug 7, 2026
6 checks passed
@sergiitk
sergiitk deleted the feat/bin/verify-version-image-tags branch August 10, 2026 19:17
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