-
Notifications
You must be signed in to change notification settings - Fork 65
feat: generate showcase using docker image #3568
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
Changes from all commits
f61c630
99c711f
7c0ed51
0328d96
c1d1696
bb28ae6
85201ee
cad57f6
bfc9bba
b4aa910
779d011
d29ce8c
334384a
66e7366
f0a7d53
072ee70
0214666
2f47daa
3063dab
e1c270a
1514dd7
6476131
4880451
c29ce8c
55141af
2711c7d
0a0726c
2d6802f
5bf0a5b
8afe6a4
3a839bf
702644b
8728b79
37d1a95
c8bc219
812f3d9
2d879f2
d1f2d20
52d65f6
5f07086
4246310
e55ab79
1e33cde
4cdb78a
9868bc7
5647988
405108d
a6447c3
e122029
493b5a4
7e5018b
3092864
6513787
d5e766c
e8177b5
59e8d12
3e30d4d
c592fe3
d9fba33
ee42e82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
set -ex | ||
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. Why do we want to add 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. It will speed up tracking down any problems occurring in production (especially for those who are less familiar with the script). We would avoid a round trip to local reproduction using this flag. It has no impact on performance (given the few commands) and no sensitive data is logged with this. |
||
# This script should be run at the root of the repository. | ||
# This script is used to, when a pull request changes the generation | ||
# configuration (generation_config.yaml by default) or Dockerfile: | ||
|
@@ -25,6 +25,8 @@ set -e | |
# 3. [optional] image_tag, the tag of gcr.io/cloud-devrel-public-resources/java-library-generation. | ||
# 4. [optional] generation_config, the path to the generation configuration, | ||
# 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. | ||
while [[ $# -gt 0 ]]; do | ||
key="$1" | ||
case "${key}" in | ||
|
@@ -44,6 +46,10 @@ case "${key}" in | |
generation_config="$2" | ||
shift | ||
;; | ||
--showcase_mode) | ||
showcase_mode="$2" | ||
shift | ||
;; | ||
*) | ||
echo "Invalid option: [$1]" | ||
exit 1 | ||
|
@@ -62,6 +68,10 @@ if [ -z "${current_branch}" ]; then | |
exit 1 | ||
fi | ||
|
||
if [ -z "${download_showcase}" ]; then | ||
download_showcase="false" | ||
fi | ||
|
||
if [ -z "${generation_config}" ]; then | ||
generation_config=generation_config.yaml | ||
echo "Use default generation config: ${generation_config}" | ||
|
@@ -89,6 +99,12 @@ pushd "${api_def_dir}" | |
git checkout "${googleapis_commitish}" | ||
popd | ||
|
||
# we also setup showcase | ||
if [[ "${showcase_mode}" == "true" ]]; then | ||
source java-showcase/scripts/showcase_utilities.sh | ||
append_showcase_to_api_defs "${api_def_dir}" | ||
fi | ||
|
||
# get changed library list. | ||
changed_libraries=$(python hermetic_build/common/cli/get_changed_libraries.py create \ | ||
--baseline-generation-config-path="${baseline_generation_config}" \ | ||
|
@@ -98,7 +114,6 @@ echo "Changed libraries are: ${changed_libraries:-"No changed library"}." | |
# run hermetic code generation docker image. | ||
docker run \ | ||
--rm \ | ||
--quiet \ | ||
-u "$(id -u):$(id -g)" \ | ||
-v "$(pwd):${workspace_name}" \ | ||
-v "${api_def_dir}:${workspace_name}/googleapis" \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
java_gapic_library( | ||
deps = [ | ||
"//google/cloud/location:location_java_proto", | ||
"//google/iam/v1:iam_java_proto" | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
proto_library_with_info( | ||
# this comment should not indicate an end of a pattern match ) | ||
deps = [ | ||
"//google/cloud/location:location_proto", | ||
] | ||
) | ||
|
||
java_gapic_library( | ||
# this comment should not indicate an end of a pattern match ) | ||
deps = [ | ||
"//google/iam/v1:iam_java_proto" | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2024 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. | ||
|
||
|
||
deep-remove-regex: | ||
- "/grpc-gapic-showcase-v1beta1/src" | ||
- "/proto-gapic-showcase-v1beta1/src" | ||
- "/gapic-showcase/src" | ||
- "/samples/snippets/generated" | ||
|
||
deep-preserve-regex: | ||
- "/gapic-showcase/src/test" | ||
|
||
deep-copy-regex: | ||
- source: "/schema/google/showcase/(v.*)/.*-java/proto-.*/src" | ||
dest: "/owl-bot-staging/showcase/$1/proto-gapic-showcase-$1/src" | ||
- source: "/schema/google/showcase/(v.*)/.*-java/grpc-.*/src" | ||
dest: "/owl-bot-staging/showcase/$1/grpc-gapic-showcase-$1/src" | ||
- source: "/schema/google/showcase/(v.*)/.*-java/gapic-.*/src" | ||
dest: "/owl-bot-staging/showcase/$1/gapic-showcase/src" | ||
- source: "/schema/google/showcase/(v.*)/.*-java/samples/snippets/generated" | ||
dest: "/owl-bot-staging/showcase/$1/samples/snippets/generated" | ||
|
||
api-name: showcase |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"api_shortname": "showcase", | ||
"name_pretty": "Showcase", | ||
"product_documentation": "https://cloud.google.com/dummy", | ||
"api_description": "Showcase module", | ||
"client_documentation": "https://cloud.google.com/java/docs/reference/gapic-showcase/latest/overview", | ||
"release_level": "preview", | ||
"transport": "both", | ||
"language": "java", | ||
"repo": "googleapis/sdk-platform-java", | ||
"repo_short": "java-showcase", | ||
"distribution_name": "com.google.cloud:gapic-showcase", | ||
"library_type": "OTHER", | ||
"requires_billing": true, | ||
"excluded_poms": "gapic-showcase-bom" | ||
} |
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.
I moved the generator jar copy later in the final stage so the previous steps can run in parallel with
mvn install
. It saves dozens of seconds.