Skip to content

Commit 4b2f4c6

Browse files
authoredMay 3, 2024··
deps: update library generation image tag (#10758)
* deps: update library generation image tag * remove obsolate workflow * change docker run command * change docker run command * restore plugin version * change readme
1 parent 225768e commit 4b2f4c6

File tree

6 files changed

+50
-106
lines changed

6 files changed

+50
-106
lines changed
 

‎.github/workflows/generated_files_sync.yaml

+18-34
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,25 @@ on:
2020
pull_request:
2121
name: generation diff
2222
env:
23-
library_generation_image_tag: 2.39.0
24-
repo_volumes: "-v repo-google-cloud-java:/workspace/google-cloud-java"
23+
library_generation_image_tag: 2.40.0
2524
jobs:
2625
root-pom:
2726
# root pom.xml does not have diff from generated one
2827
runs-on: ubuntu-latest
2928
steps:
3029
- uses: actions/checkout@v4
31-
- name: setup docker environment
32-
shell: bash
33-
run: |
34-
# we create a volume pointing to `pwd` (google-cloud-java) that will
35-
# be referenced by the container and its children
36-
if [[ $(docker volume inspect repo-google-cloud-java) != '[]' ]]; then
37-
docker volume rm repo-google-cloud-java
38-
fi
39-
docker volume create --name "repo-google-cloud-java" --opt "type=none" --opt "device=$(pwd)" --opt "o=bind"
4030
- name: Generate root pom.xml file
4131
shell: bash
4232
run: |
43-
docker run --rm \
44-
${repo_volumes} \
45-
-v /tmp:/tmp \
46-
-v /var/run/docker.sock:/var/run/docker.sock \
47-
-e "RUNNING_IN_DOCKER=true" \
48-
-e "REPO_BINDING_VOLUMES=${repo_volumes}" \
33+
docker run \
34+
--rm \
35+
-u "$(id -u):$(id -g)" \
36+
-v "$(pwd):/workspace" \
37+
--entrypoint python \
4938
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
50-
python /src/cli/generate_monorepo_root_pom.py generate --repository-path=/workspace/google-cloud-java
39+
/src/cli/generate_monorepo_root_pom.py \
40+
generate \
41+
--repository-path=/workspace
5142
- name: Fail if there's any difference
5243
run: git --no-pager diff --exit-code
5344

@@ -56,26 +47,19 @@ jobs:
5647
runs-on: ubuntu-latest
5748
steps:
5849
- uses: actions/checkout@v4
59-
- name: setup docker environment
60-
shell: bash
61-
run: |
62-
# we create a volume pointing to `pwd` (google-cloud-java) that will
63-
# be referenced by the container and its children
64-
if [[ $(docker volume inspect repo-google-cloud-java) != '[]' ]]; then
65-
docker volume rm repo-google-cloud-java
66-
fi
67-
docker volume create --name "repo-google-cloud-java" --opt "type=none" --opt "device=$(pwd)" --opt "o=bind"
6850
- name: Generate gapic-libraries-bom/pom.xml
6951
shell: bash
7052
run: |
71-
docker run --rm \
72-
${repo_volumes} \
73-
-v /tmp:/tmp \
74-
-v /var/run/docker.sock:/var/run/docker.sock \
75-
-e "RUNNING_IN_DOCKER=true" \
76-
-e "REPO_BINDING_VOLUMES=${repo_volumes}" \
53+
docker run \
54+
--rm \
55+
-u "$(id -u):$(id -g)" \
56+
-v "$(pwd):/workspace" \
57+
--entrypoint python \
7758
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
78-
python /src/cli/generate_monorepo_gapic_bom.py generate --repository-path=/workspace/google-cloud-java --versions-file=/workspace/google-cloud-java/versions.txt
59+
/src/cli/generate_monorepo_gapic_bom.py \
60+
generate \
61+
--repository-path=/workspace \
62+
--versions-file=/workspace/versions.txt
7963
- name: Fail if there's any difference
8064
run: git --no-pager diff --exit-code
8165

‎.github/workflows/hermetic_library_generation.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
library_generation:
2222
runs-on: ubuntu-latest
2323
env:
24-
library_generation_image_tag: 2.39.0
24+
library_generation_image_tag: 2.40.0
2525
steps:
2626
- uses: actions/checkout@v4
2727
with:

‎generation/hermetic_library_generation.sh

+4-20
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ if [ -z "${generation_config}" ]; then
7070
echo "Use default generation config: ${generation_config}"
7171
fi
7272

73-
volume_name="repo"
74-
workspace_name="/workspace/repo"
75-
repo_volumes="${volume_name}:${workspace_name}"
73+
workspace_name="/workspace"
7674
baseline_generation_config="baseline_generation_config.yaml"
7775
message="chore: generate libraries at $(date)"
7876

@@ -89,28 +87,14 @@ fi
8987
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
9088
config_diff=$(diff "${generation_config}" "${baseline_generation_config}")
9189

92-
# bind docker volume to include the repository in docker running environment.
93-
if [[ $(docker volume inspect ${volume_name}) != '[]' ]]; then
94-
docker volume rm ${volume_name}
95-
fi
96-
docker volume create \
97-
--name ${volume_name} \
98-
--opt "type=none" \
99-
--opt "device=$(pwd)" \
100-
--opt "o=bind"
10190
# run hermetic code generation docker image.
10291
docker run \
10392
--rm \
104-
-v "${repo_volumes}" \
105-
-v /tmp:/tmp \
106-
-v /var/run/docker.sock:/var/run/docker.sock \
107-
-e "RUNNING_IN_DOCKER=true" \
108-
-e "REPO_BINDING_VOLUMES=-v ${repo_volumes}" \
93+
-u "$(id -u):$(id -g)" \
94+
-v "$(pwd):${workspace_name}" \
10995
gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
110-
python /src/cli/entry_point.py generate \
11196
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
112-
--current-generation-config-path="${workspace_name}/${generation_config}" \
113-
--repository-path="${workspace_name}"
97+
--current-generation-config-path="${workspace_name}/${generation_config}"
11498
# commit the change to the pull request.
11599
git add java-* pom.xml gapic-libraries-bom/pom.xml versions.txt
116100
changed_files=$(git diff --cached --name-only)

‎generation/new_client_hermetic_build/README.md

+10-34
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# New client generation (GitHub Action)
22
This new generation workflow enables generation of new libraries by
3-
1. appending a new library to our [generation_config.yaml](https://github.com/googleapis/google-cloud-java/blob/c7429c0eec419c01d4e2fe14d063b9335efb810b/generation_config.yaml).
4-
2. running the hermetic build scripts docker image and
5-
generate the newly added library.
6-
3. create a PR with the changes.
3+
1. Appending a new library to our [generation_config.yaml](/generation_config.yaml).
4+
2. Creating a PR with the changes.
5+
6+
The new client will be generated by [Hermetic library generation workflow](/.github/workflows/hermetic_library_generation.yaml).
77

88

99
## Components
@@ -14,18 +14,15 @@ A new entry will be added to `libraries` with the necessary generation
1414
configuration.
1515

1616
### `.github/workflows/generate_new_client_hermetic_build.yaml`
17-
This workflow orchestrates the `add-new-client-config.py` script and also uses our docker
18-
image
19-
([gcr.io/cloud-devrel-public-resources/java-library-generation](https://pantheon.corp.google.com/gcr/images/cloud-devrel-public-resources/global/java-library-generation))
20-
to generate a new library.
21-
It also creates the pull request.
17+
This workflow orchestrates the `add-new-client-config.py` script and creates
18+
a pull request.
2219

2320

2421
## Execute the GitHub Action
2522

2623
In order to run the
27-
[GitHub Action](https://github.com/googleapis/google-cloud-java/actions/workflows/generate_new_client_hermetic_build.yaml)
28-
, you need to specify a few parameters.
24+
[GitHub Action](/.github/workflows/generate_new_client_hermetic_build.yaml),
25+
you need to specify a few parameters.
2926
These parameters will be available in the Cloud Drop link (a YAML file) included
3027
in the Buganizer request.
3128
The example in this README uses AlloyDB's [Cloud Drop](https://github.com/googleapis/googleapis/blob/master/google/cloud/alloydb/v1/alloydb_v1.yaml)
@@ -156,26 +153,5 @@ python3.9 generation/new_client_hermetic_build/add-new-client-config.py generate
156153
After you run the script, you will see that the `generation_config.yaml` file
157154
was modified (or the script exited because the library already existed).
158155

159-
The last step you need is to `cd` into the root of `google-cloud-java` and run
160-
```
161-
docker volume create --name "repo-google-cloud-java" --opt "type=none" --opt "device=$(pwd)" --opt "o=bind"
162-
repo_volumes="-v repo-google-cloud-java:/workspace/google-cloud-java"
163-
docker run --rm \
164-
${repo_volumes} \
165-
-v /tmp:/tmp \
166-
-v /var/run/docker.sock:/var/run/docker.sock \
167-
-e "RUNNING_IN_DOCKER=true" \
168-
-e "REPO_BINDING_VOLUMES=${repo_volumes}" \
169-
gcr.io/cloud-devrel-public-resources/java-library-generation:latest \
170-
python /src/generate_repo.py generate \
171-
--generation-config-yaml=/workspace/google-cloud-java/generation_config.yaml \
172-
--repository-path=/workspace/google-cloud-java \
173-
--target-library-names=<library_name if specified; otherwise api_shortname>
174-
175-
```
176-
177-
This docker container will run the generation scripts and generate the library
178-
in your repo.
179-
You can create a PR explaining what commands you used (the docker command is
180-
not as informative as the `add-new-client-config.py` call, so make sure at least
181-
the add-new-client-config.py arguments were listed).
156+
Please create a PR explaining what commands you used and make sure the
157+
add-new-client-config.py arguments were listed).

‎generation_config.yaml

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
gapic_generator_version: 2.39.0
2-
protobuf_version: '25.3'
2+
protoc_version: '25.3'
33
googleapis_commitish: 5a0ae652df1ef39b7849bf2bd6ba417376ce3204
44
libraries_bom_version: 26.38.0
55
owlbot_cli_image: sha256:623647ee79ac605858d09e60c1382a716c125fb776f69301b72de1cd35d49409
@@ -40,21 +40,21 @@ libraries:
4040
- proto_path: google/identity/accesscontextmanager/v1
4141
- proto_path: google/identity/accesscontextmanager/type
4242

43-
#- api_shortname: admanager
44-
# name_pretty: Google Ad Manager API
45-
# product_documentation: https://developers.google.com/ad-manager/api/beta
46-
# api_description: The Ad Manager API enables an app to integrate with Google Ad Manager.
47-
# You can read Ad Manager data and run reports using the API.
48-
# client_documentation: https://cloud.google.com/java/docs/reference/ad-manager/latest/overview
49-
# release_level: preview
50-
# distribution_name: com.google.api-ads:ad-manager
51-
# api_id: admanager.googleapis.com
52-
# library_type: GAPIC_AUTO
53-
# group_id: com.google.api-ads
54-
# cloud_api: false
55-
# GAPICs:
56-
# - proto_path: google/ads/admanager/v1
57-
# requires_billing: true
43+
- api_shortname: admanager
44+
name_pretty: Google Ad Manager API
45+
product_documentation: https://developers.google.com/ad-manager/api/beta
46+
api_description: The Ad Manager API enables an app to integrate with Google Ad Manager.
47+
You can read Ad Manager data and run reports using the API.
48+
client_documentation: https://cloud.google.com/java/docs/reference/ad-manager/latest/overview
49+
release_level: preview
50+
distribution_name: com.google.api-ads:ad-manager
51+
api_id: admanager.googleapis.com
52+
library_type: GAPIC_AUTO
53+
group_id: com.google.api-ads
54+
cloud_api: false
55+
GAPICs:
56+
- proto_path: google/ads/admanager/v1
57+
requires_billing: true
5858

5959
- api_shortname: advisorynotifications
6060
name_pretty: Advisory Notifications API

‎pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
<plugin>
208208
<groupId>org.apache.maven.plugins</groupId>
209209
<artifactId>maven-deploy-plugin</artifactId>
210-
<version>3.1.1</version>
210+
<version>3.1.2</version>
211211
<configuration>
212212
<skip>true</skip>
213213
</configuration>

0 commit comments

Comments
 (0)
Please sign in to comment.