-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(java): use separate autosynth job for README (#767)
Split java README generation into a separate, per-repo continuous job running from Kokoro. We now generate a new job that runs on commits to the primary branch that strictly manages the README.md. This should prevent us from seeing the contextless autosynth PRs which are caused by non-proto/template upstream changes.
- Loading branch information
Showing
7 changed files
with
175 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
synthtool/gcp/templates/java_library/.github/readme/synth.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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. | ||
|
||
"""This script is used to synthesize generated the README for this library.""" | ||
|
||
from synthtool.languages import java | ||
|
||
java.custom_templates(["java_library/README.md"]) |
55 changes: 55 additions & 0 deletions
55
synthtool/gcp/templates/java_library/.kokoro/continuous/readme.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 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. | ||
|
||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
env_vars: { | ||
key: "TRAMPOLINE_IMAGE" | ||
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" | ||
} | ||
|
||
env_vars: { | ||
key: "TRAMPOLINE_BUILD_FILE" | ||
value: "github/{{ metadata['repo']['repo_short'] }}/.kokoro/readme.sh" | ||
} | ||
|
||
# Build logs will be here | ||
action { | ||
define_artifacts { | ||
regex: "**/*sponge_log.xml" | ||
regex: "**/*sponge_log.log" | ||
} | ||
} | ||
|
||
# The github token is stored here. | ||
before_action { | ||
fetch_keystore { | ||
keystore_resource { | ||
keystore_config_id: 73713 | ||
keyname: "yoshi-automation-github-key" | ||
# TODO(theacodes): remove this after secrets have globally propagated | ||
backend_type: FASTCONFIGPUSH | ||
} | ||
} | ||
} | ||
|
||
# Common env vars for all repositories and builds. | ||
env_vars: { | ||
key: "GITHUB_USER" | ||
value: "yoshi-automation" | ||
} | ||
env_vars: { | ||
key: "GITHUB_EMAIL" | ||
value: "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/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. | ||
|
||
set -eo pipefail | ||
|
||
cd ${KOKORO_ARTIFACTS_DIR}/github/{{ metadata['repo']['repo_short'] }} | ||
|
||
# Disable buffering, so that the logs stream through. | ||
export PYTHONUNBUFFERED=1 | ||
|
||
# Kokoro exposes this as a file, but the scripts expect just a plain variable. | ||
export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) | ||
|
||
# Setup git credentials | ||
echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials | ||
git config --global credential.helper 'store --file ~/.git-credentials' | ||
|
||
python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool | ||
python3.6 -m autosynth.synth \ | ||
--repository={{metadata['repo']['repo']}} \ | ||
--synth-file-name=.github/readme/synth.py \ | ||
--metadata-path=.github/readme/synth.metadata \ | ||
--pr-title="chore: regenerate README" \ | ||
--branch-suffix="readme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters