Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
chore: fix release build (#659)
* chore: fix release build Fix release build by migrating to secret manager secrets and use templated kokoro configs for docs/ and release/ * fix: fix config names * chore: add populate secrets script * docs: fix license * chore: preserve original year * chore: revert years in manually committed files * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md * chore: update lockfile * chore: add .kokoro/docker directory Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
306eeba
commit 11bc9c2
Showing
15 changed files
with
139 additions
and
163 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
|
||
docker: | ||
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest | ||
digest: sha256:82d046d572a11b84d64d4b9af93ad55a1b6a4854917504ba7557acdfce907dde |
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,8 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
|
||
docker: | ||
image: gcr.io/repo-automation-bots/owlbot-python:latest |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,4 +62,4 @@ before_action { | |
keyname: "docuploader_service_account" | ||
} | ||
} | ||
} | ||
} |
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,35 @@ | ||
#!/bin/bash | ||
# Copyright 2020 Google LLC | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
|
||
set -eo pipefail | ||
|
||
function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} | ||
function msg { println "$*" >&2 ;} | ||
function println { printf '%s\n' "$(now) $*" ;} | ||
|
||
|
||
# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: | ||
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com | ||
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" | ||
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" | ||
mkdir -p ${SECRET_LOCATION} | ||
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") | ||
do | ||
msg "Retrieving secret ${key}" | ||
docker run --entrypoint=gcloud \ | ||
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ | ||
gcr.io/google.com/cloudsdktool/cloud-sdk \ | ||
secrets versions access latest \ | ||
--project cloud-devrel-kokoro-resources \ | ||
--secret ${key} > \ | ||
"${SECRET_LOCATION}/${key}" | ||
if [[ $? == 0 ]]; then | ||
msg "Secret written to ${SECRET_LOCATION}/${key}" | ||
else | ||
msg "Error retrieving secret ${key}" | ||
fi | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
# Format: //devtools/kokoro/config/proto/build.proto |
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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
#!/bin/bash | ||
# Copyright 2020 Google LLC. | ||
# Copyright 2017 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. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
|
||
set -eo pipefail | ||
|
||
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" || ret_code=$? | ||
|
||
chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh | ||
${KOKORO_GFILE_DIR}/trampoline_cleanup.sh || true | ||
# Always run the cleanup script, regardless of the success of bouncing into | ||
# the container. | ||
function cleanup() { | ||
chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh | ||
${KOKORO_GFILE_DIR}/trampoline_cleanup.sh | ||
echo "cleanup"; | ||
} | ||
trap cleanup EXIT | ||
|
||
exit ${ret_code} | ||
$(dirname $0)/populate-secrets.sh # Secret Manager secrets. | ||
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
import re | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
|
||
# ---------------------------------------------------------------------------- | ||
# Add templated files | ||
# ---------------------------------------------------------------------------- | ||
templated_files = gcp.CommonTemplates().py_library(microgenerator=True) | ||
|
||
# Just move templates for building docs and releases | ||
# Presubmit and continuous are configured differently | ||
s.move(templated_files / ".trampolinerc") | ||
s.move(templated_files / ".kokoro" / "docker") | ||
s.move(templated_files / ".kokoro" / "docs") | ||
s.move(templated_files / ".kokoro" / "release.sh") | ||
s.move(templated_files / ".kokoro" / "trampoline_v2.sh") | ||
s.move(templated_files / ".kokoro" / "trampoline.sh") | ||
s.move(templated_files / ".kokoro" / "populate-secrets.sh") | ||
s.move(templated_files / ".kokoro" / "release") | ||
|
||
# Replace the Apache Licenses in the `.kokoro` directory | ||
# with the BSD license expected in this repository | ||
s.replace( | ||
".kokoro/**/*", | ||
"# Copyright.*(\d{4}).*# limitations under the License\.", | ||
"""# Copyright \g<1> Google LLC | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd""", | ||
flags=re.DOTALL | ||
) | ||
|
||
s.shell.run(["nox", "-s", "blacken"], hide_output=False) |