Skip to content

Commit

Permalink
Merge branch 'main' into fix-httpjson-retry-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarquezp authored Oct 24, 2024
2 parents 5c11e10 + 5e44d21 commit 9b48dbe
Show file tree
Hide file tree
Showing 304 changed files with 3,254 additions and 1,060 deletions.
2 changes: 1 addition & 1 deletion .cloudbuild/graalvm/cloudbuild-test-a.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

timeout: 7200s # 2 hours
substitutions:
_SHARED_DEPENDENCIES_VERSION: '3.38.0' # {x-version-update:google-cloud-shared-dependencies:current}
_SHARED_DEPENDENCIES_VERSION: '3.38.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
options:
machineType: 'E2_HIGHCPU_8'
Expand Down
2 changes: 1 addition & 1 deletion .cloudbuild/graalvm/cloudbuild-test-b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

timeout: 7200s # 2 hours
substitutions:
_SHARED_DEPENDENCIES_VERSION: '3.38.0' # {x-version-update:google-cloud-shared-dependencies:current}
_SHARED_DEPENDENCIES_VERSION: '3.38.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
options:
machineType: 'E2_HIGHCPU_8'
Expand Down
2 changes: 1 addition & 1 deletion .cloudbuild/graalvm/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

timeout: 7200s # 2 hours
substitutions:
_SHARED_DEPENDENCIES_VERSION: '3.38.0' # {x-version-update:google-cloud-shared-dependencies:current}
_SHARED_DEPENDENCIES_VERSION: '3.38.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
steps:
# GraalVM A build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
timeout: 7200s # 2 hours
substitutions:
_IMAGE_NAME: "gcr.io/cloud-devrel-public-resources/java-library-generation"
_GAPIC_GENERATOR_JAVA_VERSION: '2.48.0' # {x-version-update:gapic-generator-java:current}
_GAPIC_GENERATOR_JAVA_VERSION: '2.48.1-SNAPSHOT' # {x-version-update:gapic-generator-java:current}
_SHA_IMAGE_ID: "${_IMAGE_NAME}:${COMMIT_SHA}"
_LATEST_IMAGE_ID: "${_IMAGE_NAME}:latest"
_VERSIONED_IMAGE_ID: "${_IMAGE_NAME}:${_GAPIC_GENERATOR_JAVA_VERSION}"
Expand Down
25 changes: 14 additions & 11 deletions .cloudbuild/library_generation/library_generation.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM gcr.io/cloud-devrel-public-resources/java21@sha256:2ceff5eeea72260258df56d4
WORKDIR /sdk-platform-java
COPY . .
# {x-version-update-start:gapic-generator-java:current}
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.48.0"
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.48.1-SNAPSHOT"
# {x-version-update-end}

RUN mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
Expand All @@ -45,19 +45,20 @@ RUN apt-get update && apt-get install -y \
&& apt-get clean

# copy source code
COPY library_generation /src
COPY hermetic_build/common /src/common
COPY hermetic_build/library_generation /src/library_generation

# install protoc
WORKDIR /protoc
RUN source /src/utils/utilities.sh \
RUN source /src/library_generation/utils/utilities.sh \
&& download_protoc "${PROTOC_VERSION}" "${OS_ARCHITECTURE}"
# we indicate protoc is available in the container via env vars
ENV DOCKER_PROTOC_LOCATION=/protoc
ENV DOCKER_PROTOC_VERSION="${PROTOC_VERSION}"

# install grpc
WORKDIR /grpc
RUN source /src/utils/utilities.sh \
RUN source /src/library_generation/utils/utilities.sh \
&& download_grpc_plugin "${GRPC_VERSION}" "${OS_ARCHITECTURE}"
# similar to protoc, we indicate grpc is available in the container via env vars
ENV DOCKER_GRPC_LOCATION="/grpc/protoc-gen-grpc-java-${GRPC_VERSION}-${OS_ARCHITECTURE}.exe"
Expand All @@ -71,16 +72,18 @@ ENV DOCKER_GRPC_VERSION="${GRPC_VERSION}"
COPY --from=ggj-build "/sdk-platform-java/gapic-generator-java.jar" "${HOME}/.library_generation/gapic-generator-java.jar"
RUN chmod 755 "${HOME}/.library_generation/gapic-generator-java.jar"

# use python 3.11 (the base image has several python versions; here we define the default one)
# use python 3.12 (the base image has several python versions; here we define the default one)
RUN rm $(which python3)
RUN ln -s $(which python3.11) /usr/local/bin/python
RUN ln -s $(which python3.11) /usr/local/bin/python3
RUN ln -s $(which python3.12) /usr/local/bin/python
RUN ln -s $(which python3.12) /usr/local/bin/python3
RUN python -m pip install --upgrade pip

# install main scripts as a python package
WORKDIR /src
RUN python -m pip install -r requirements.txt
RUN python -m pip install .
WORKDIR /
RUN python -m pip install --require-hashes -r src/common/requirements.txt
RUN python -m pip install src/common
RUN python -m pip install --require-hashes -r src/library_generation/requirements.txt
RUN python -m pip install src/library_generation

# Install nvm with node and npm
ENV NODE_VERSION 20.12.0
Expand Down Expand Up @@ -120,4 +123,4 @@ RUN chmod -R a+rw /home
RUN chmod -R a+rx /home/.nvm

WORKDIR /workspace
ENTRYPOINT [ "python", "/src/cli/entry_point.py", "generate" ]
ENTRYPOINT [ "python", "/src/library_generation/cli/entry_point.py", "generate" ]
24 changes: 23 additions & 1 deletion .github/scripts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,33 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Copy python script
shell: bash
run: |
set -x
# repository root
cd ${{ github.action_path }}/../../
rsync -rv \
--exclude=tests \
hermetic_build "${GITHUB_WORKSPACE}"
- name: Copy shell script
shell: bash
run: |
cd ${{ github.action_path }}
cp hermetic_library_generation.sh $GITHUB_WORKSPACE
cp hermetic_library_generation.sh "${GITHUB_WORKSPACE}"
- name: Install python packages
shell: bash
run: |
cd "${GITHUB_WORKSPACE}"
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
pip install hermetic_build/release_note_generation
- name: Generate changed libraries
shell: bash
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ docker run \
--current-generation-config-path="${workspace_name}/${generation_config}" \
--api-definitions-path="${workspace_name}/googleapis"

python hermetic_build/release_note_generation/cli/generate_release_note.py generate \
--baseline-generation-config-path="${baseline_generation_config}" \
--current-generation-config-path="${generation_config}"

# remove api definitions after generation
rm -rf "${api_def_dir}"

# commit the change to the pull request.
rm -rdf output googleapis "${baseline_generation_config}"
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh' ':!hermetic_build'
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" != "" ]]; then
echo "Commit changes..."
Expand Down
65 changes: 32 additions & 33 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
git checkout -b "${head_ref}" fork/${head_ref}
changed_directories="$(git diff --name-only "fork/${head_ref}" "origin/${base_ref}")"
fi
if [[ ${changed_directories} =~ "library_generation/" ]]; then
if [[ ${changed_directories} =~ "hermetic_build/" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
Expand All @@ -46,32 +46,21 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: install pyenv
python-version: 3.12
- name: install python modules and dependencies
shell: bash
run: |
set -ex
curl https://pyenv.run | bash
# setup environment
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
echo "PYENV_ROOT=${PYENV_ROOT}" >> $GITHUB_ENV
echo "PATH=${PATH}" >> $GITHUB_ENV
set +ex
- name: install python dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.txt
pip install .
popd
pip install --upgrade pip
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
- name: Run integration tests
shell: bash
run: |
set -x
python -m unittest library_generation/test/integration_tests.py
python -m unittest hermetic_build/library_generation/tests/integration_tests.py
library-generation-unit-tests:
runs-on: ubuntu-22.04
needs: should-run-library-generation-tests
Expand All @@ -80,23 +69,26 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: install python dependencies
python-version: 3.12
- name: install python modules and dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.txt
pip install .
popd
pip install --upgrade pip
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
pip install hermetic_build/release_note_generation
- name: Run shell unit tests
run: |
set -x
library_generation/test/generate_library_unit_tests.sh
hermetic_build/library_generation/tests/generate_library_unit_tests.sh
- name: Run python unit tests
run: |
set -x
python -m unittest discover -s library_generation/test/ -p "*unit_tests.py"
python -m unittest discover -s hermetic_build -p "*unit_tests.py"
library-generation-lint-shell:
runs-on: ubuntu-22.04
needs: should-run-library-generation-tests
Expand All @@ -106,7 +98,7 @@ jobs:
- name: Run ShellCheck
uses: ludeeus/[email protected]
with:
scandir: 'library_generation'
scandir: 'hermetic_build'
format: tty
severity: error
library-generation-lint-python:
Expand All @@ -115,16 +107,23 @@ jobs:
if: needs.should-run-library-generation-tests.outputs.should_run == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.txt
popd
pip install --upgrade pip
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
pip install hermetic_build/release_note_generation
- name: Lint
shell: bash
run: |
# exclude generated golden files
# exclude owlbot until further refaction
black --check library_generation --exclude "(library_generation/test/resources/goldens)"
black --check hermetic_build --exclude "(library_generation/tests/resources/goldens)"
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_ARTIFACTS")
load("@io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS")

_gapic_generator_java_version = "2.48.0" # {x-version-update:gapic-generator-java:current}
_gapic_generator_java_version = "2.48.1-SNAPSHOT" # {x-version-update:gapic-generator-java:current}

maven_install(
artifacts = [
Expand Down
4 changes: 2 additions & 2 deletions api-common-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<packaging>jar</packaging>
<version>2.39.0</version><!-- {x-version-update:api-common:current} -->
<version>2.39.1-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
<name>API Common</name>
<description>Common utilities for Google APIs in Java</description>

<parent>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.48.0</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.48.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

Expand Down
8 changes: 4 additions & 4 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>2.56.0</version> <!-- {x-version-update:gax:current} -->
<version>2.56.1-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>2.56.0</version> <!-- {x-version-update:gax-grpc:current} -->
<version>2.56.1-SNAPSHOT</version> <!-- {x-version-update:gax-grpc:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>2.56.0</version> <!-- {x-version-update:gax:current} -->
<version>2.56.1-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<version>2.39.0</version> <!-- {x-version-update:api-common:current} -->
<version>2.39.1-SNAPSHOT</version> <!-- {x-version-update:api-common:current} -->
</dependency>
</dependencies>

Expand Down
Loading

0 comments on commit 9b48dbe

Please sign in to comment.