-
Notifications
You must be signed in to change notification settings - Fork 1.1k
build: fall back to previous image version on release PRs #12848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
meltsufin
wants to merge
15
commits into
main
Choose a base branch
from
release-please--fix-12825
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3c59412
build: fall back to previous image version on release PRs
meltsufin 5fa7830
build: extract image name to variable in hermetic script
meltsufin 823b98c
build: improve robustness of fallback version extraction
meltsufin c1395d2
build: prevent script termination on empty fallback match
meltsufin 53d67a1
refactor: centralize generator docker execution and fallback logic
meltsufin 16cfa1b
refactor: extract fallback tag from versions.txt instead of workflow …
meltsufin ef92609
refactor: remove unused gapic_generator_version from generation_confi…
meltsufin 54269dc
fix: use remote ref origin/ for fallback tag extraction in CI
meltsufin b74fe50
Merge branch 'main' into release-please--fix-12825
meltsufin 1ae26cc
fix: fetch target branch to get fallback tag in CI
meltsufin d19bfbb
Merge branch 'release-please--fix-12825' of github.com:googleapis/goo…
meltsufin 43835e2
impl: add GENERATOR_VERSION to final stage of Dockerfile
meltsufin 68519fb
chore: pass GENERATOR_VERSION to validation container in CI
meltsufin 2cbaa3c
chore: pass GENERATOR_VERSION to hermetic_library_generation workflow
meltsufin 7dc57e7
chore: generate libraries at Tue Apr 21 11:18:32 UTC 2026
cloud-java-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/bin/bash | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set -exo pipefail | ||
|
|
||
| REQUESTED_TAG="$1" | ||
| TARGET_BRANCH="$2" | ||
| shift 2 | ||
|
|
||
| # Parse arguments using '--' as delimiter | ||
| DOCKER_OPTS=() | ||
| CONTAINER_CMD=() | ||
| found_delimiter=false | ||
|
|
||
| for arg in "$@"; do | ||
| if [ "$arg" == "--" ]; then | ||
| found_delimiter=true | ||
| continue | ||
| fi | ||
| if $found_delimiter; then | ||
| CONTAINER_CMD+=("$arg") | ||
| else | ||
| DOCKER_OPTS+=("$arg") | ||
| fi | ||
| done | ||
|
|
||
| IMAGE_NAME="gcr.io/cloud-devrel-public-resources/java-library-generation" | ||
| # Support both local git and GitHub Actions environment variables | ||
| CURRENT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-$(git branch --show-current)}}" | ||
| IMAGE_TAG="$REQUESTED_TAG" | ||
|
|
||
| # Fallback logic on Release PR branches | ||
| if [[ "$CURRENT_BRANCH" =~ ^release-please-- ]]; then | ||
| echo "Detected release PR branch: $CURRENT_BRANCH" | ||
| if ! docker pull "${IMAGE_NAME}:${IMAGE_TAG}"; then | ||
| echo "Image not found for version ${IMAGE_TAG}. Falling back to previous version from ${TARGET_BRANCH}." | ||
| # Extract tag from target branch's versions.txt using explicit fetch | ||
| git fetch origin "${TARGET_BRANCH}" --depth=1 || true | ||
| PREVIOUS_TAG=$(git show FETCH_HEAD:versions.txt | grep "^gapic-generator-java:" | cut -d ':' -f 2 || true) | ||
| if [ -n "$PREVIOUS_TAG" ]; then | ||
| echo "Using previous image version: $PREVIOUS_TAG" | ||
| IMAGE_TAG="$PREVIOUS_TAG" | ||
| else | ||
| echo "Failed to extract fallback tag. Proceeding with requested tag." | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| # Execute Docker run with proper ordering | ||
| docker run --rm "${DOCKER_OPTS[@]}" "${IMAGE_NAME}:${IMAGE_TAG}" "${CONTAINER_CMD[@]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,10 @@ ARG GRPC_VERSION=1.80.0 | |
| ENV HOME=/home | ||
| ENV OS_ARCHITECTURE="linux-x86_64" | ||
|
|
||
| # {x-version-update-start:gapic-generator-java:current} | ||
| ENV GENERATOR_VERSION="2.71.0" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is needed? |
||
| # {x-version-update-end} | ||
|
|
||
| # install OS tools | ||
| RUN apt update && apt install -y curl unzip rsync jq nodejs npm git openjdk-17-jdk | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blakeli0 Note that I'm removing this version declaration because it's confusing as it doesn't get updated, and it's not used anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. We used to update this version in the daily generation PR to trigger a full generation, but we always use the latest snapshot version now after monorepo migration.