Skip to content

build: fall back to previous image version on release PRs#12848

Open
meltsufin wants to merge 4 commits intomainfrom
release-please--fix-12825
Open

build: fall back to previous image version on release PRs#12848
meltsufin wants to merge 4 commits intomainfrom
release-please--fix-12825

Conversation

@meltsufin
Copy link
Copy Markdown
Member

The library generation pipeline fails on release PRs because it attempts to pull a Docker image version that has not yet been built or pushed to the registry.

This PR adds a fallback mechanism in hermetic_library_generation.sh to use the previous version of the image from the main branch if the requested version fails to pull on a release PR.

To verify this in CI, this branch is named with the prefix 'release-please--' to simulate a release PR.

Fixes #12825

@meltsufin meltsufin requested a review from a team as a code owner April 18, 2026 02:03
Copy link
Copy Markdown
Contributor

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

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 fallback mechanism for the hermetic library generation script. When a release PR branch is detected, the script attempts to pull the specified Docker image; if it fails, it tries to extract and use the image tag from the target branch's workflow configuration. The review feedback suggests improving the robustness of the tag extraction logic to better handle potential multiple matches, comments, or colons within the YAML file.

Comment thread sdk-platform-java/.github/scripts/hermetic_library_generation.sh Outdated
@meltsufin meltsufin force-pushed the release-please--fix-12825 branch from 6880d59 to def6f2d Compare April 18, 2026 02:16
The library generation pipeline fails on release PRs because it attempts to pull a Docker image version that has not yet been built or pushed to the registry.

This PR adds a fallback mechanism in hermetic_library_generation.sh to use the previous version of the image from the main branch if the requested version fails to pull on a release PR.

To verify this in CI, this branch is named with the prefix 'release-please--' to simulate a release PR.

Fixes #12825
@meltsufin
Copy link
Copy Markdown
Member Author

Fallback validated in a separate release simulation PR #12849:

+ [[ release-please--simulation =~ ^release-please-- ]]
+ echo 'Detected release PR branch: release-please--simulation'
+ docker pull gcr.io/cloud-devrel-public-resources/java-library-generation:9.99.9
Detected release PR branch: release-please--simulation
Error response from daemon: manifest for gcr.io/cloud-devrel-public-resources/java-library-generation:9.99.9 not found: manifest unknown: Failed to fetch "9.99.9"
+ echo 'Image not found for version 9.99.9. Falling back to previous version from main.'
Image not found for version 9.99.9. Falling back to previous version from main.
++ git show main:.github/workflows/hermetic_library_generation.yaml
++ grep -m 1 '^[[:space:]]*image_tag:'
++ cut -d : -f 2-
++ cut -d '#' -f 1
++ xargs
+ previous_tag=2.71.0
+ '[' -n 2.71.0 ']'
+ echo 'Using previous image version: 2.71.0'
+ image_tag=2.71.0
Using previous image version: 2.71.0
++ id -u
++ id -g
++ pwd
+ docker run --rm -u 1001:1001 -v /home/runner/work/google-cloud-java/google-cloud-java:/workspace -v /tmp/tmp.dG9h7KnPTo:/workspace/googleapis -e GENERATOR_VERSION=2.71.0 gcr.io/cloud-devrel-public-resources/java-library-generation:2.71.0 --generation-config-path=/workspace/generation_config.yaml --library-names= --api-definitions-path=/workspace/googleapis
Unable to find image 'gcr.io/cloud-devrel-public-resources/java-library-generation:2.71.0' locally
2.71.0: Pulling from cloud-devrel-public-resources/java-library-generation

@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

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.

Library-generation fails on release PRs

1 participant