-
Notifications
You must be signed in to change notification settings - Fork 68
chore(hermetic-build): include .github template updates as part of generation #3723
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 6 commits
1bb6936
4a59a65
c25a14a
56c6f1c
a2effdc
364b79f
df9a033
c908f7b
755c0de
cb5a1ca
b66af92
88e6edb
b136655
b9a7d01
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 |
|---|---|---|
|
|
@@ -78,7 +78,7 @@ as per [POSIX env var definition](https://pubs.opengroup.org/onlinepubs/96999197 | |
| 2. Move the jar into its well-known location. | ||
|
|
||
| ```shell | ||
| mv /path/to/jar "${HOME}/.library_generation/gapic-generator-java.jar" | ||
| mv ~/.m2/repository/com/google/api/gapic-generator-java/{version}/gapic-generator-java-{version}.jar "${HOME}/.library_generation/gapic-generator-java.jar" | ||
| ``` | ||
|
|
||
| #### Put the protobuf compiler in its well-known location | ||
|
|
@@ -130,6 +130,9 @@ owl-bot copy-code --version | |
| The key step is `npm link`, which will make the command available in you current | ||
| shell session. | ||
|
|
||
| If you get a permission denied error when running the command `owl-bot`, try | ||
| relinking owl-bot by running `npm unlink -g` and re-running the steps above. | ||
|
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. Why would rerun the same command can solve the permission issue?
Contributor
Author
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.
|
||
|
|
||
| ## Run the script | ||
| The entrypoint script (`hermetic_build/library_generation/cli/entry_point.py`) | ||
| allows you to generate a GAPIC repository with a given api definition (proto, | ||
|
|
@@ -153,12 +156,14 @@ export path_to_repo="$(pwd)/google-cloud-java" | |
| ### Install the scripts | ||
|
|
||
| You can skip this step if you've installed the packages in [Install package dependencies](#install-package-dependencies). | ||
| Use the `--editable` flag for your changes to take effect as soon as you modify any file inside | ||
| the package. | ||
|
|
||
| ```shell | ||
| python -m pip install --require-hashes -r hermetic_build/common/requirements.txt | ||
| python -m pip install hermetic_build/common | ||
| python -m pip install --editable hermetic_build/common | ||
| python -m pip install --require-hashes -r hermetic_build/library_generation/requirements.txt | ||
| python -m pip install hermetic_build/library_generation | ||
| python -m pip install --editable hermetic_build/library_generation | ||
| ``` | ||
|
|
||
| ### Run the script | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eo pipefail | ||
| set -exo pipefail | ||
|
||
|
|
||
| # parse input parameters | ||
| while [[ $# -gt 0 ]]; do | ||
|
|
||
suztomo marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| externalManifests: | ||
| - type: json | ||
| file: 'synth.metadata' | ||
| jsonpath: '$.generatedFiles[*]' | ||
| - type: json | ||
| file: '.github/readme/synth.metadata/synth.metadata' | ||
| jsonpath: '$.generatedFiles[*]' | ||
| ignoreAuthors: | ||
| - 'renovate-bot' | ||
| - 'yoshi-automation' | ||
| - 'release-please[bot]' | ||
| - 'gcf-owl-bot[bot]' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| :: Copyright 2022 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. | ||
| :: Github action job to test core java library features on | ||
| :: downstream client libraries before they are released. | ||
| :: See documentation in type-shell-output.bat | ||
|
|
||
| "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/bin/bash | ||
| # Copyright 2019 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. | ||
|
|
||
| # This script finds and moves sponge logs so that they can be found by placer | ||
| # and are not flagged as flaky by sponge. | ||
|
|
||
| set -eo pipefail | ||
|
|
||
| ## Get the directory of the build script | ||
| scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) | ||
| ## cd to the parent directory, i.e. the root of the git repo | ||
| cd ${scriptDir}/.. | ||
|
|
||
| job=$(basename ${KOKORO_JOB_NAME}) | ||
|
|
||
| echo "coercing sponge logs..." | ||
| for xml in `find . -name *-sponge_log.xml` | ||
| do | ||
| class=$(basename ${xml} | cut -d- -f2) | ||
| dir=$(dirname ${xml})/${job}/${class} | ||
| text=$(dirname ${xml})/${class}-sponge_log.txt | ||
| mkdir -p ${dir} | ||
| mv ${xml} ${dir}/sponge_log.xml | ||
| mv ${text} ${dir}/sponge_log.txt | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,13 @@ | ||
| # Format: //devtools/kokoro/config/proto/build.proto | ||
|
|
||
| # Download trampoline resources. | ||
| # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} | ||
| gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" | ||
|
|
||
| # Use the trampoline script to run in docker. | ||
| build_file: "synthtool/.kokoro/trampoline.sh" | ||
|
|
||
| # Configure the docker image for kokoro-trampoline. | ||
| env_vars: { | ||
| key: "TRAMPOLINE_IMAGE" | ||
| value: "gcr.io/cloud-devrel-kokoro-resources/python" | ||
| } | ||
| # All builds use the trampoline script to run in docker. | ||
| build_file: "{{ metadata['repo']['repo_short'] }}/.kokoro/trampoline.sh" | ||
|
|
||
| # Tell the trampoline which build file to use. | ||
| env_vars: { | ||
| key: "TRAMPOLINE_BUILD_FILE" | ||
| value: "github/synthtool/.kokoro/build.sh" | ||
| key: "TRAMPOLINE_BUILD_FILE" | ||
| value: "github/{{ metadata['repo']['repo_short'] }}/.kokoro/build.sh" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #!/bin/bash | ||
| # Copyright 2020 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. | ||
|
|
||
| function retry_with_backoff { | ||
| attempts_left=$1 | ||
| sleep_seconds=$2 | ||
| shift 2 | ||
| command=$@ | ||
|
|
||
|
|
||
| # store current flag state | ||
| flags=$- | ||
|
|
||
| # allow a failures to continue | ||
| set +e | ||
| ${command} | ||
| exit_code=$? | ||
|
|
||
| # restore "e" flag | ||
| if [[ ${flags} =~ e ]] | ||
| then set -e | ||
| else set +e | ||
| fi | ||
|
|
||
| if [[ $exit_code == 0 ]] | ||
| then | ||
| return 0 | ||
| fi | ||
|
|
||
| # failure | ||
| if [[ ${attempts_left} -gt 0 ]] | ||
| then | ||
| echo "failure (${exit_code}), sleeping ${sleep_seconds}..." | ||
| sleep ${sleep_seconds} | ||
| new_attempts=$((${attempts_left} - 1)) | ||
| new_sleep=$((${sleep_seconds} * 2)) | ||
| retry_with_backoff ${new_attempts} ${new_sleep} ${command} | ||
| fi | ||
|
|
||
| return $exit_code | ||
| } | ||
|
|
||
| ## Helper functionss | ||
| function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } | ||
| function msg() { println "$*" >&2; } | ||
| function println() { printf '%s\n' "$(now) $*"; } | ||
|
|
||
| ## Helper comment to trigger updated repo dependency release |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Format: //devtools/kokoro/config/proto/build.proto | ||
|
|
||
| # Build logs will be here | ||
| action { | ||
| define_artifacts { | ||
| regex: "**/*sponge_log.xml" | ||
| regex: "**/*sponge_log.txt" | ||
| } | ||
| } | ||
|
|
||
| # Download trampoline resources. | ||
| gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" | ||
|
|
||
| # Use the trampoline script to run in docker. | ||
| build_file: "{{ metadata['repo']['repo_short'] }}/.kokoro/trampoline.sh" | ||
|
|
||
| env_vars: { | ||
| key: "TRAMPOLINE_BUILD_FILE" | ||
| value: "github/{{ metadata['repo']['repo_short'] }}/.kokoro/build.sh" | ||
| } | ||
|
|
||
| env_vars: { | ||
| key: "JOB_TYPE" | ||
| value: "test" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Format: //devtools/kokoro/config/proto/build.proto | ||
|
|
||
| # Configure the docker image for kokoro-trampoline. | ||
| env_vars: { | ||
| key: "TRAMPOLINE_IMAGE" | ||
| value: "gcr.io/cloud-devrel-kokoro-resources/java8" | ||
| } | ||
|
|
||
| env_vars: { | ||
| key: "REPORT_COVERAGE" | ||
| value: "true" | ||
| } |
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.
Is this too much detail? What if a user change the default maven dir?
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 thought it may be more convenient for copying the whole line and limit to making a replacement in
{version}. I think a non-default maven setup is not a common use case, but still checks out, so I reverted this line.