diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 085dbcec2565..862add9f8a30 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -321,13 +321,13 @@ jobs: - name: validate generation configuration shell: bash run: | - docker run \ - --rm \ + bash generation/run_generator_docker.sh "${library_generation_image_tag}" "${{ github.base_ref || 'main' }}" \ + -e GENERATOR_VERSION="${library_generation_image_tag}" \ --quiet \ -u "$(id -u):$(id -g)" \ -v "$(pwd):${workspace_name}" \ --entrypoint python \ - gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \ + -- \ /src/library_generation/cli/entry_point.py validate-generation-config env: library_generation_image_tag: 2.68.0 diff --git a/.github/workflows/generated_files_sync.yaml b/.github/workflows/generated_files_sync.yaml index 3143a317c9e3..75bc9a306850 100644 --- a/.github/workflows/generated_files_sync.yaml +++ b/.github/workflows/generated_files_sync.yaml @@ -27,13 +27,12 @@ jobs: - name: Generate root pom.xml file shell: bash run: | - docker run \ - --rm \ + bash generation/run_generator_docker.sh "${library_generation_image_tag}" "${{ github.base_ref }}" \ --quiet \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/workspace" \ --entrypoint python \ - gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \ + -- \ /src/library_generation/cli/generate_monorepo_root_pom.py \ generate \ --repository-path=/workspace @@ -48,13 +47,12 @@ jobs: - name: Generate gapic-libraries-bom/pom.xml shell: bash run: | - docker run \ - --rm \ + bash generation/run_generator_docker.sh "${library_generation_image_tag}" "${{ github.base_ref }}" \ --quiet \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/workspace" \ --entrypoint python \ - gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \ + -- \ /src/library_generation/cli/generate_monorepo_gapic_bom.py \ generate \ --repository-path=/workspace \ diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml index 74fec93e13d8..42dcd405eeb4 100644 --- a/.github/workflows/hermetic_library_generation.yaml +++ b/.github/workflows/hermetic_library_generation.yaml @@ -20,6 +20,9 @@ on: env: REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }} GITHUB_REPOSITORY: ${{ github.repository }} + # {x-version-update-start:gapic-generator-java:current} + GENERATOR_VERSION: 2.71.0 + # {x-version-update-end} jobs: library_generation: runs-on: ubuntu-latest @@ -44,4 +47,4 @@ jobs: head_ref: ${{ github.head_ref }} token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }} force_regenerate_all: ${{ github.event.pull_request.head.ref == 'generate-libraries-main' }} - image_tag: 2.71.0 # {x-version-update:gapic-generator-java:current} + image_tag: ${{ env.GENERATOR_VERSION }} diff --git a/generation/run_generator_docker.sh b/generation/run_generator_docker.sh new file mode 100755 index 000000000000..4255747319da --- /dev/null +++ b/generation/run_generator_docker.sh @@ -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[@]}" diff --git a/generation_config.yaml b/generation_config.yaml index d10cf1c50168..add660b31a8b 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,4 +1,3 @@ -gapic_generator_version: 2.70.0 googleapis_commitish: 62e4ecb2f4390728990514fea14aad0431881a52 libraries_bom_version: 26.79.0 libraries: diff --git a/java-vectorsearch/README.md b/java-vectorsearch/README.md index 79c8a3179fb2..3563fa0a7466 100644 --- a/java-vectorsearch/README.md +++ b/java-vectorsearch/README.md @@ -45,20 +45,20 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-vectorsearch - 0.12.0 + 0.13.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-vectorsearch:0.12.0' +implementation 'com.google.cloud:google-cloud-vectorsearch:0.13.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-vectorsearch" % "0.12.0" +libraryDependencies += "com.google.cloud" % "google-cloud-vectorsearch" % "0.13.0" ``` ## Authentication @@ -181,7 +181,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-vectorsearch/latest/overview [stability-image]: https://img.shields.io/badge/stability-preview-yellow [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-vectorsearch.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-vectorsearch/0.12.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-vectorsearch/0.13.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/sdk-platform-java/.cloudbuild/library_generation/library_generation.Dockerfile b/sdk-platform-java/.cloudbuild/library_generation/library_generation.Dockerfile index dd805ecfc362..0712b8798c5d 100644 --- a/sdk-platform-java/.cloudbuild/library_generation/library_generation.Dockerfile +++ b/sdk-platform-java/.cloudbuild/library_generation/library_generation.Dockerfile @@ -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" +# {x-version-update-end} + # install OS tools RUN apt update && apt install -y curl unzip rsync jq nodejs npm git openjdk-17-jdk diff --git a/sdk-platform-java/.github/scripts/hermetic_library_generation.sh b/sdk-platform-java/.github/scripts/hermetic_library_generation.sh index fc991aa3e94d..c254aae64b3a 100755 --- a/sdk-platform-java/.github/scripts/hermetic_library_generation.sh +++ b/sdk-platform-java/.github/scripts/hermetic_library_generation.sh @@ -27,6 +27,7 @@ set -exo pipefail # the default value is generation_config.yaml in the repository root. # 5. [optional] showcase_mode, true if we wish to download the showcase api # definitions, which are necessary for generating the showcase library. +IMAGE_NAME="gcr.io/cloud-devrel-public-resources/java-library-generation" while [[ $# -gt 0 ]]; do key="$1" case "${key}" in @@ -123,13 +124,12 @@ changed_libraries="$(cat "${changed_libraries_file}")" echo "Changed libraries are: ${changed_libraries:-"No changed library"}." # run hermetic code generation docker image. -docker run \ - --rm \ +bash generation/run_generator_docker.sh "${image_tag}" "${target_branch}" \ -u "$(id -u):$(id -g)" \ -v "$(pwd):${workspace_name}" \ -v "${api_def_dir}:${workspace_name}/googleapis" \ -e GENERATOR_VERSION="${image_tag}" \ - gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \ + -- \ --generation-config-path="${workspace_name}/${generation_config}" \ --library-names="${changed_libraries}" \ --api-definitions-path="${workspace_name}/googleapis"