From f3a751795b344e4a12b2c71b463dc51acc19559c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 23 Apr 2021 12:10:03 -0400 Subject: [PATCH] chore: migrate to owl bot (#94) --- .../.github/.OwlBot.lock.yaml | 4 + .../google-cloud-tasks/.github/.OwlBot.yaml | 26 +++ .../google-cloud-tasks/.kokoro/release.sh | 4 +- .../.kokoro/release/common.cfg | 14 +- .../docs/_static/custom.css | 13 +- .../{synth.py => owlbot.py} | 23 +- packages/google-cloud-tasks/synth.metadata | 220 ------------------ 7 files changed, 54 insertions(+), 250 deletions(-) create mode 100644 packages/google-cloud-tasks/.github/.OwlBot.lock.yaml create mode 100644 packages/google-cloud-tasks/.github/.OwlBot.yaml rename packages/google-cloud-tasks/{synth.py => owlbot.py} (69%) delete mode 100644 packages/google-cloud-tasks/synth.metadata diff --git a/packages/google-cloud-tasks/.github/.OwlBot.lock.yaml b/packages/google-cloud-tasks/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000000..29084e8a33af --- /dev/null +++ b/packages/google-cloud-tasks/.github/.OwlBot.lock.yaml @@ -0,0 +1,4 @@ +docker: + digest: sha256:cfc0e802701262c211703c468874d767f65dabe6a1a71d0e07bfc8a3d5175f32 + image: gcr.io/repo-automation-bots/owlbot-python:latest + diff --git a/packages/google-cloud-tasks/.github/.OwlBot.yaml b/packages/google-cloud-tasks/.github/.OwlBot.yaml new file mode 100644 index 000000000000..e173f5a70553 --- /dev/null +++ b/packages/google-cloud-tasks/.github/.OwlBot.yaml @@ -0,0 +1,26 @@ +# 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 + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/tasks/(v.*)/.*-py/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: 130ce904e5d546c312943d10f48799590f9c0f66 + diff --git a/packages/google-cloud-tasks/.kokoro/release.sh b/packages/google-cloud-tasks/.kokoro/release.sh index 7cce3b21e717..163eb07aea7b 100755 --- a/packages/google-cloud-tasks/.kokoro/release.sh +++ b/packages/google-cloud-tasks/.kokoro/release.sh @@ -26,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-tasks 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/packages/google-cloud-tasks/.kokoro/release/common.cfg b/packages/google-cloud-tasks/.kokoro/release/common.cfg index bef59347cb3d..716e424e73e7 100644 --- a/packages/google-cloud-tasks/.kokoro/release/common.cfg +++ b/packages/google-cloud-tasks/.kokoro/release/common.cfg @@ -23,18 +23,8 @@ env_vars: { value: "github/python-tasks/.kokoro/release.sh" } -# Fetch PyPI password -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google_cloud_pypi_password" - } - } -} - # 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" -} \ No newline at end of file + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" +} diff --git a/packages/google-cloud-tasks/docs/_static/custom.css b/packages/google-cloud-tasks/docs/_static/custom.css index bcd37bbd3c4a..b0a295464b23 100644 --- a/packages/google-cloud-tasks/docs/_static/custom.css +++ b/packages/google-cloud-tasks/docs/_static/custom.css @@ -1,9 +1,20 @@ div#python2-eol { border-color: red; border-width: medium; -} +} /* Ensure minimum width for 'Parameters' / 'Returns' column */ dl.field-list > dt { min-width: 100px } + +/* Insert space between methods for readability */ +dl.method { + padding-top: 10px; + padding-bottom: 10px +} + +/* Insert empty space between classes */ +dl.class { + padding-bottom: 50px +} diff --git a/packages/google-cloud-tasks/synth.py b/packages/google-cloud-tasks/owlbot.py similarity index 69% rename from packages/google-cloud-tasks/synth.py rename to packages/google-cloud-tasks/owlbot.py index d32b8323269f..9b1316d09cbc 100644 --- a/packages/google-cloud-tasks/synth.py +++ b/packages/google-cloud-tasks/owlbot.py @@ -21,26 +21,19 @@ logging.basicConfig(level=logging.DEBUG) -gapic = gcp.GAPICBazel() common = gcp.CommonTemplates() -excludes = ["README.rst", "setup.py", "nox*.py", "docs/index.rst", "*.tar.gz"] -# ---------------------------------------------------------------------------- -# Generate tasks GAPIC layer -# ---------------------------------------------------------------------------- -for version in ["v2beta2", "v2beta3", "v2"]: - library = gapic.py_library( - service="tasks", - version=version, - bazel_target=f"//google/cloud/tasks/{version}:tasks-{version}-py", - include_protos=True, - ) +default_version = "v2" + +for library in s.get_staging_dirs(default_version): + # Fix docstring. + s.replace(library / "google/cloud/*/types/target.py", "X-Google-\*", "X-Google-\\*") + s.replace(library / "google/cloud/*/types/target.py", "X-AppEngine-\*", "X-AppEngine-\\*") + excludes = ["README.rst", "setup.py", "nox*.py", "docs/index.rst", "*.tar.gz"] s.copy(library, excludes=excludes) -# Fix docstring. -s.replace("google/cloud/*/types/target.py", "X-Google-\*", "X-Google-\\*") -s.replace("google/cloud/*/types/target.py", "X-AppEngine-\*", "X-AppEngine-\\*") +s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files diff --git a/packages/google-cloud-tasks/synth.metadata b/packages/google-cloud-tasks/synth.metadata deleted file mode 100644 index 3fa7aff0d1e6..000000000000 --- a/packages/google-cloud-tasks/synth.metadata +++ /dev/null @@ -1,220 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-tasks.git", - "sha": "7115c3e5e4440997f961f1065a98178e58ea4a56" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "149a3a84c29c9b8189576c7442ccb6dcf6a8f95b", - "internalRef": "364411656" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0a071b3460344886297a304253bf924aa68ddb7e" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0a071b3460344886297a304253bf924aa68ddb7e" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "tasks", - "apiVersion": "v2beta2", - "language": "python", - "generator": "bazel" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "tasks", - "apiVersion": "v2beta3", - "language": "python", - "generator": "bazel" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "tasks", - "apiVersion": "v2", - "language": "python", - "generator": "bazel" - } - } - ], - "generatedFiles": [ - ".coveragerc", - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/header-checker-lint.yml", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".gitignore", - ".kokoro/build.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/continuous.cfg", - ".kokoro/docker/docs/Dockerfile", - ".kokoro/docker/docs/fetch_gpg_keys.sh", - ".kokoro/docs/common.cfg", - ".kokoro/docs/docs-presubmit.cfg", - ".kokoro/docs/docs.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/presubmit.cfg", - ".kokoro/publish-docs.sh", - ".kokoro/release.sh", - ".kokoro/release/common.cfg", - ".kokoro/release/release.cfg", - ".kokoro/samples/lint/common.cfg", - ".kokoro/samples/lint/continuous.cfg", - ".kokoro/samples/lint/periodic.cfg", - ".kokoro/samples/lint/presubmit.cfg", - ".kokoro/samples/python3.6/common.cfg", - ".kokoro/samples/python3.6/continuous.cfg", - ".kokoro/samples/python3.6/periodic-head.cfg", - ".kokoro/samples/python3.6/periodic.cfg", - ".kokoro/samples/python3.6/presubmit.cfg", - ".kokoro/samples/python3.7/common.cfg", - ".kokoro/samples/python3.7/continuous.cfg", - ".kokoro/samples/python3.7/periodic-head.cfg", - ".kokoro/samples/python3.7/periodic.cfg", - ".kokoro/samples/python3.7/presubmit.cfg", - ".kokoro/samples/python3.8/common.cfg", - ".kokoro/samples/python3.8/continuous.cfg", - ".kokoro/samples/python3.8/periodic-head.cfg", - ".kokoro/samples/python3.8/periodic.cfg", - ".kokoro/samples/python3.8/presubmit.cfg", - ".kokoro/test-samples-against-head.sh", - ".kokoro/test-samples-impl.sh", - ".kokoro/test-samples.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".pre-commit-config.yaml", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.rst", - "LICENSE", - "MANIFEST.in", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/conf.py", - "docs/multiprocessing.rst", - "docs/tasks_v2/cloud_tasks.rst", - "docs/tasks_v2/services.rst", - "docs/tasks_v2/types.rst", - "docs/tasks_v2beta2/cloud_tasks.rst", - "docs/tasks_v2beta2/services.rst", - "docs/tasks_v2beta2/types.rst", - "docs/tasks_v2beta3/cloud_tasks.rst", - "docs/tasks_v2beta3/services.rst", - "docs/tasks_v2beta3/types.rst", - "google/cloud/tasks/__init__.py", - "google/cloud/tasks/py.typed", - "google/cloud/tasks_v2/__init__.py", - "google/cloud/tasks_v2/proto/cloudtasks.proto", - "google/cloud/tasks_v2/proto/queue.proto", - "google/cloud/tasks_v2/proto/target.proto", - "google/cloud/tasks_v2/proto/task.proto", - "google/cloud/tasks_v2/py.typed", - "google/cloud/tasks_v2/services/__init__.py", - "google/cloud/tasks_v2/services/cloud_tasks/__init__.py", - "google/cloud/tasks_v2/services/cloud_tasks/async_client.py", - "google/cloud/tasks_v2/services/cloud_tasks/client.py", - "google/cloud/tasks_v2/services/cloud_tasks/pagers.py", - "google/cloud/tasks_v2/services/cloud_tasks/transports/__init__.py", - "google/cloud/tasks_v2/services/cloud_tasks/transports/base.py", - "google/cloud/tasks_v2/services/cloud_tasks/transports/grpc.py", - "google/cloud/tasks_v2/services/cloud_tasks/transports/grpc_asyncio.py", - "google/cloud/tasks_v2/types/__init__.py", - "google/cloud/tasks_v2/types/cloudtasks.py", - "google/cloud/tasks_v2/types/queue.py", - "google/cloud/tasks_v2/types/target.py", - "google/cloud/tasks_v2/types/task.py", - "google/cloud/tasks_v2beta2/__init__.py", - "google/cloud/tasks_v2beta2/proto/cloudtasks.proto", - "google/cloud/tasks_v2beta2/proto/old_target.proto", - "google/cloud/tasks_v2beta2/proto/queue.proto", - "google/cloud/tasks_v2beta2/proto/target.proto", - "google/cloud/tasks_v2beta2/proto/task.proto", - "google/cloud/tasks_v2beta2/py.typed", - "google/cloud/tasks_v2beta2/services/__init__.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/__init__.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/async_client.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/client.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/pagers.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/transports/__init__.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/transports/base.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc.py", - "google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc_asyncio.py", - "google/cloud/tasks_v2beta2/types/__init__.py", - "google/cloud/tasks_v2beta2/types/cloudtasks.py", - "google/cloud/tasks_v2beta2/types/queue.py", - "google/cloud/tasks_v2beta2/types/target.py", - "google/cloud/tasks_v2beta2/types/task.py", - "google/cloud/tasks_v2beta3/__init__.py", - "google/cloud/tasks_v2beta3/proto/cloudtasks.proto", - "google/cloud/tasks_v2beta3/proto/queue.proto", - "google/cloud/tasks_v2beta3/proto/target.proto", - "google/cloud/tasks_v2beta3/proto/task.proto", - "google/cloud/tasks_v2beta3/py.typed", - "google/cloud/tasks_v2beta3/services/__init__.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/__init__.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/async_client.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/client.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/pagers.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/transports/__init__.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/transports/base.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc.py", - "google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc_asyncio.py", - "google/cloud/tasks_v2beta3/types/__init__.py", - "google/cloud/tasks_v2beta3/types/cloudtasks.py", - "google/cloud/tasks_v2beta3/types/queue.py", - "google/cloud/tasks_v2beta3/types/target.py", - "google/cloud/tasks_v2beta3/types/task.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/noxfile.py", - "scripts/decrypt-secrets.sh", - "scripts/fixup_tasks_v2_keywords.py", - "scripts/fixup_tasks_v2beta2_keywords.py", - "scripts/fixup_tasks_v2beta3_keywords.py", - "scripts/readme-gen/readme_gen.py", - "scripts/readme-gen/templates/README.tmpl.rst", - "scripts/readme-gen/templates/auth.tmpl.rst", - "scripts/readme-gen/templates/auth_api_key.tmpl.rst", - "scripts/readme-gen/templates/install_deps.tmpl.rst", - "scripts/readme-gen/templates/install_portaudio.tmpl.rst", - "setup.cfg", - "testing/.gitignore", - "tests/unit/gapic/tasks_v2/__init__.py", - "tests/unit/gapic/tasks_v2/test_cloud_tasks.py", - "tests/unit/gapic/tasks_v2beta2/__init__.py", - "tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py", - "tests/unit/gapic/tasks_v2beta3/__init__.py", - "tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py" - ] -} \ No newline at end of file