From 213a09fc387f5b200b495cf70b1451b19099afff Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Mon, 21 Jun 2021 16:11:19 +0000 Subject: [PATCH 1/9] chore: fix release build Fix release build by migrating to secret manager secrets and use templated kokoro configs for docs/ and release/ --- .github/.OwlBot.lock.yaml | 17 +++++++++++++++ .github/.OwlBot.yaml | 16 ++++++++++++++ .kokoro/docs/common.cfg | 2 +- .kokoro/release.sh | 6 ++---- .kokoro/release/common.cfg | 44 +++++--------------------------------- .kokoro/trampoline.sh | 17 +++++++++------ owlbot.py | 32 +++++++++++++++++++++++++++ 7 files changed, 84 insertions(+), 50 deletions(-) create mode 100644 .github/.OwlBot.lock.yaml create mode 100644 .github/.OwlBot.yaml create mode 100644 owlbot.py diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 0000000000..be37427b98 --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,17 @@ +# Copyright 2021 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. + +docker: + image: gcr.io/repo-automation-bots/owlbot-python:latest + digest: sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3 diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 0000000000..b31858f3cf --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,16 @@ +# Copyright 2021 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. + +docker: + image: gcr.io/repo-automation-bots/owlbot-python:latest diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg index 2003193838..cdf8e2a4ef 100644 --- a/.kokoro/docs/common.cfg +++ b/.kokoro/docs/common.cfg @@ -62,4 +62,4 @@ before_action { keyname: "docuploader_service_account" } } -} +} \ No newline at end of file diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 9f60d5f251..a37ba48e4c 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Start the releasetool reporter @@ -28,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password") +TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") cd github/python-spanner-django python3 setup.py sdist bdist_wheel -twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/* +twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 31533b977a..53fa4c5002 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -11,7 +11,7 @@ action { gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-spanner-django/.kokoro/trampoline.sh" +build_file: "python-spanner-django-django/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { @@ -23,42 +23,8 @@ env_vars: { value: "github/python-spanner-django/.kokoro/release.sh" } -# Fetch the token needed for reporting release status to GitHub -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} - -# Fetch PyPI password -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google_cloud_pypi_password" - } - } -} - -# Fetch magictoken to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "releasetool-magictoken" - } - } -} - -# Fetch api key to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "magic-github-proxy-api-key" - } - } +# Tokens needed to report release status back to GitHub +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" } diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index 8f0237f322..f39236e943 100755 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC. +# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,9 +15,14 @@ set -eo pipefail -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" || ret_code=$? +# 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 -chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh -${KOKORO_GFILE_DIR}/trampoline_cleanup.sh || true - -exit ${ret_code} +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" \ No newline at end of file diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 0000000000..3d812ea133 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,32 @@ +# Copyright 2021 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 parts of this library.""" +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 / ".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(template_files / ".kokoro" / "release") + +s.shell.run(["nox", "-s", "blacken"], hide_output=False) From b2867a1c8a403ce848088a6b1ca7433069822321 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Mon, 21 Jun 2021 16:13:53 +0000 Subject: [PATCH 2/9] fix: fix config names --- .kokoro/release/common.cfg | 2 +- .kokoro/release/release.cfg | 2 +- owlbot.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 53fa4c5002..2cf743579d 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -11,7 +11,7 @@ action { gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-spanner-django-django/.kokoro/trampoline.sh" +build_file: "python-spanner-django/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { diff --git a/.kokoro/release/release.cfg b/.kokoro/release/release.cfg index 18a4c35325..8f43917d92 100644 --- a/.kokoro/release/release.cfg +++ b/.kokoro/release/release.cfg @@ -1 +1 @@ -# Format: //devtools/kokoro/config/proto/build.proto +# Format: //devtools/kokoro/config/proto/build.proto \ No newline at end of file diff --git a/owlbot.py b/owlbot.py index 3d812ea133..f4bdb6f836 100644 --- a/owlbot.py +++ b/owlbot.py @@ -27,6 +27,7 @@ s.move(templated_files / ".kokoro" / "release.sh") s.move(templated_files / ".kokoro" / "trampoline_v2.sh") s.move(templated_files / ".kokoro" / "trampoline.sh") -s.move(template_files / ".kokoro" / "release") +s.move(templated_files / ".kokoro" / "populate_secrets.sh") +s.move(templated_files / ".kokoro" / "release") s.shell.run(["nox", "-s", "blacken"], hide_output=False) From b6c746fa6dc3e538a77bbe6c53e890152c5ef401 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Mon, 21 Jun 2021 16:14:57 +0000 Subject: [PATCH 3/9] chore: add populate secrets script --- .kokoro/populate-secrets.sh | 43 +++++++++++++++++++++++++++++++++++++ owlbot.py | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 .kokoro/populate-secrets.sh diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 0000000000..f52514257e --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/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 + +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 diff --git a/owlbot.py b/owlbot.py index f4bdb6f836..8035c8e3d4 100644 --- a/owlbot.py +++ b/owlbot.py @@ -27,7 +27,7 @@ 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" / "populate-secrets.sh") s.move(templated_files / ".kokoro" / "release") s.shell.run(["nox", "-s", "blacken"], hide_output=False) From a191fdda33080cd768be1ea4576a9dd49fb8dbce Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 23 Jun 2021 23:49:27 +0000 Subject: [PATCH 4/9] docs: fix license --- .github/.OwlBot.lock.yaml | 14 +++---------- .github/.OwlBot.yaml | 14 +++---------- .kokoro/build.sh | 16 ++++----------- .kokoro/docker/docs/Dockerfile | 16 ++++----------- .kokoro/docker/docs/fetch_gpg_keys.sh | 16 ++++----------- .kokoro/populate-secrets.sh | 16 ++++----------- .kokoro/publish-docs.sh | 16 ++++----------- .kokoro/release.sh | 16 ++++----------- .kokoro/trampoline_v2.sh | 16 ++++----------- owlbot.py | 29 +++++++++++++++++---------- 10 files changed, 52 insertions(+), 117 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index be37427b98..561afe1654 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,16 +1,8 @@ # Copyright 2021 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 docker: image: gcr.io/repo-automation-bots/owlbot-python:latest diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index b31858f3cf..1bfc664928 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -1,16 +1,8 @@ # Copyright 2021 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 docker: image: gcr.io/repo-automation-bots/owlbot-python:latest diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 4ac9dd8b76..0fe20244ef 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,17 +1,9 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2021 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 -# -# https://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 diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 412b0b56a9..6cf110759f 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -1,16 +1,8 @@ -# Copyright 2020 Google LLC +# Copyright 2021 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 from ubuntu:20.04 diff --git a/.kokoro/docker/docs/fetch_gpg_keys.sh b/.kokoro/docker/docs/fetch_gpg_keys.sh index d653dd868e..0f8f9fd210 100755 --- a/.kokoro/docker/docs/fetch_gpg_keys.sh +++ b/.kokoro/docker/docs/fetch_gpg_keys.sh @@ -1,17 +1,9 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2021 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 # A script to fetch gpg keys with retry. # Avoid jinja parsing the file. diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh index f52514257e..bf0be603a6 100755 --- a/.kokoro/populate-secrets.sh +++ b/.kokoro/populate-secrets.sh @@ -1,17 +1,9 @@ #!/bin/bash -# Copyright 2020 Google LLC. +# Copyright 2021 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 diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 8acb14e802..41e4460df9 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -1,17 +1,9 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2021 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 -# -# https://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 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index a37ba48e4c..49aff02c83 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -1,17 +1,9 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2021 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 -# -# https://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 diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc26d..957848c453 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -1,17 +1,9 @@ #!/usr/bin/env bash -# Copyright 2020 Google LLC +# Copyright 2021 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 # trampoline_v2.sh # diff --git a/owlbot.py b/owlbot.py index 8035c8e3d4..6aabd78ea7 100644 --- a/owlbot.py +++ b/owlbot.py @@ -1,18 +1,12 @@ # Copyright 2021 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 """This script is used to synthesize generated parts of this library.""" +import re + import synthtool as s import synthtool.gcp as gcp @@ -30,4 +24,17 @@ 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.*Google LLC.*# limitations under the License\.", + """# 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""", + flags=re.DOTALL +) + s.shell.run(["nox", "-s", "blacken"], hide_output=False) From 8e7c83a5b0767e9639b83622e76dddfb9caa74ca Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 23 Jun 2021 23:56:58 +0000 Subject: [PATCH 5/9] chore: preserve original year --- .kokoro/populate-secrets.sh | 2 +- .kokoro/release.sh | 2 +- .kokoro/trampoline.sh | 16 ++++------------ .kokoro/trampoline_v2.sh | 2 +- owlbot.py | 4 ++-- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh index bf0be603a6..7b511c3257 100755 --- a/.kokoro/populate-secrets.sh +++ b/.kokoro/populate-secrets.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# 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 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 49aff02c83..57e2f28ce1 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# 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 diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index f39236e943..d42a40acbb 100755 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -1,17 +1,9 @@ #!/bin/bash -# Copyright 2017 Google Inc. +# 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 diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 957848c453..591faf816e 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 2021 Google LLC +# 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 diff --git a/owlbot.py b/owlbot.py index 6aabd78ea7..4830c2f53c 100644 --- a/owlbot.py +++ b/owlbot.py @@ -28,8 +28,8 @@ # with the BSD license expected in this repository s.replace( ".kokoro/**/*", - "# Copyright.*Google LLC.*# limitations under the License\.", - """# Copyright 2021 Google LLC + "# 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 From 15245afddf9ad6098abb0923c08f8df8ec79ca9a Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 23 Jun 2021 23:58:48 +0000 Subject: [PATCH 6/9] chore: revert years in manually committed files --- .kokoro/build.sh | 2 +- .kokoro/docker/docs/Dockerfile | 2 +- .kokoro/docker/docs/fetch_gpg_keys.sh | 6 +++--- .kokoro/publish-docs.sh | 2 +- owlbot.py | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 0fe20244ef..eea1d84933 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# 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 diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 6cf110759f..f86a5b5e90 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# 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 diff --git a/.kokoro/docker/docs/fetch_gpg_keys.sh b/.kokoro/docker/docs/fetch_gpg_keys.sh index 0f8f9fd210..c26695ddf0 100755 --- a/.kokoro/docker/docs/fetch_gpg_keys.sh +++ b/.kokoro/docker/docs/fetch_gpg_keys.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# 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 @@ -7,7 +7,7 @@ # A script to fetch gpg keys with retry. # Avoid jinja parsing the file. -# +# function retry { if [[ "${#}" -le 1 ]]; then @@ -34,4 +34,4 @@ retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \ retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \ E3FF2839C048B25C084DEBE9B26995E310250568 -# +# diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 41e4460df9..a80ea7c0a0 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# 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 diff --git a/owlbot.py b/owlbot.py index 4830c2f53c..b392016f3a 100644 --- a/owlbot.py +++ b/owlbot.py @@ -17,6 +17,7 @@ # Just move templates for building docs and releases # Presubmit and continuous are configured differently +s.move(templated_files / ".trampolinerc") s.move(templated_files / ".kokoro" / "docs") s.move(templated_files / ".kokoro" / "release.sh") s.move(templated_files / ".kokoro" / "trampoline_v2.sh") From aeb6718b928fae0c10cbb9195eaa4aa4d8320412 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 21 Jul 2021 23:53:39 +0000 Subject: [PATCH 7/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md --- .trampolinerc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.trampolinerc b/.trampolinerc index 28037bbb86..383b6ec89f 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# 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. From e92acae6ab2cfd9d11aff5217347ee67e8264e3e Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 21 Jul 2021 23:58:57 +0000 Subject: [PATCH 8/9] chore: update lockfile --- .github/.OwlBot.lock.yaml | 4 ++-- .trampolinerc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 561afe1654..9ce8396fe0 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -5,5 +5,5 @@ # https://developers.google.com/open-source/licenses/bsd docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3 + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest + digest: sha256:82d046d572a11b84d64d4b9af93ad55a1b6a4854917504ba7557acdfce907dde diff --git a/.trampolinerc b/.trampolinerc index 28037bbb86..383b6ec89f 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# 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. From 3eba2985c70082951d389f2954b1fe57e0a26b47 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 22 Jul 2021 00:09:02 +0000 Subject: [PATCH 9/9] chore: add .kokoro/docker directory --- .kokoro/docker/docs/Dockerfile | 35 ++-------------------------------- owlbot.py | 1 + 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index f86a5b5e90..92ade8f99f 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -32,6 +32,7 @@ RUN apt-get update \ libssl-dev \ libsqlite3-dev \ portaudio19-dev \ + python3-distutils \ redis-server \ software-properties-common \ ssh \ @@ -51,40 +52,8 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb - -COPY fetch_gpg_keys.sh /tmp -# Install the desired versions of Python. -RUN set -ex \ - && export GNUPGHOME="$(mktemp -d)" \ - && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ - && /tmp/fetch_gpg_keys.sh \ - && for PYTHON_VERSION in 3.7.8 3.8.5; do \ - wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ - && wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \ - && rm -r python-${PYTHON_VERSION}.tar.xz.asc \ - && mkdir -p /usr/src/python-${PYTHON_VERSION} \ - && tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \ - && rm python-${PYTHON_VERSION}.tar.xz \ - && cd /usr/src/python-${PYTHON_VERSION} \ - && ./configure \ - --enable-shared \ - # This works only on Python 2.7 and throws a warning on every other - # version, but seems otherwise harmless. - --enable-unicode=ucs4 \ - --with-system-ffi \ - --without-ensurepip \ - && make -j$(nproc) \ - && make install \ - && ldconfig \ - ; done \ - && rm -rf "${GNUPGHOME}" \ - && rm -rf /usr/src/python* \ - && rm -rf ~/.cache/ - RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.7 /tmp/get-pip.py \ && python3.8 /tmp/get-pip.py \ && rm /tmp/get-pip.py -CMD ["python3.7"] +CMD ["python3.8"] diff --git a/owlbot.py b/owlbot.py index b392016f3a..d0087b4c0b 100644 --- a/owlbot.py +++ b/owlbot.py @@ -18,6 +18,7 @@ # 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")