From aaebcbef2d866c2bcb928caadc88e3599c203576 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 19 Apr 2021 12:12:08 -0400 Subject: [PATCH] chore: migrate to owl bot (#61) --- .../.github/.OwlBot.lock.yaml | 4 + .../google-cloud-billing/.github/.OwlBot.yaml | 26 +++ .../.github/header-checker-lint.yml | 2 +- .../google-cloud-billing/.kokoro/release.sh | 4 +- .../.kokoro/release/common.cfg | 14 +- .../docs/_static/custom.css | 13 +- .../{synth.py => owlbot.py} | 19 +-- packages/google-cloud-billing/renovate.json | 5 +- packages/google-cloud-billing/synth.metadata | 150 ------------------ 9 files changed, 57 insertions(+), 180 deletions(-) create mode 100644 packages/google-cloud-billing/.github/.OwlBot.lock.yaml create mode 100644 packages/google-cloud-billing/.github/.OwlBot.yaml rename packages/google-cloud-billing/{synth.py => owlbot.py} (74%) delete mode 100644 packages/google-cloud-billing/synth.metadata diff --git a/packages/google-cloud-billing/.github/.OwlBot.lock.yaml b/packages/google-cloud-billing/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000000..14240bccaf3a --- /dev/null +++ b/packages/google-cloud-billing/.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-billing/.github/.OwlBot.yaml b/packages/google-cloud-billing/.github/.OwlBot.yaml new file mode 100644 index 000000000000..963b0ae7a488 --- /dev/null +++ b/packages/google-cloud-billing/.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/billing/(v.*)/.*-py/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: 6a5da3f1274b088752f074da5bc9e30bd1beb27e + diff --git a/packages/google-cloud-billing/.github/header-checker-lint.yml b/packages/google-cloud-billing/.github/header-checker-lint.yml index fc281c05bd55..6fe78aa7987a 100644 --- a/packages/google-cloud-billing/.github/header-checker-lint.yml +++ b/packages/google-cloud-billing/.github/header-checker-lint.yml @@ -1,6 +1,6 @@ {"allowedCopyrightHolders": ["Google LLC"], "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"], - "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"], + "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"], "sourceFileExtensions": [ "ts", "js", diff --git a/packages/google-cloud-billing/.kokoro/release.sh b/packages/google-cloud-billing/.kokoro/release.sh index 2f832a0d5c54..ca4dc3f0d75d 100755 --- a/packages/google-cloud-billing/.kokoro/release.sh +++ b/packages/google-cloud-billing/.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-billing 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-billing/.kokoro/release/common.cfg b/packages/google-cloud-billing/.kokoro/release/common.cfg index 81cd544f2ac2..34acf9aa2caa 100644 --- a/packages/google-cloud-billing/.kokoro/release/common.cfg +++ b/packages/google-cloud-billing/.kokoro/release/common.cfg @@ -23,18 +23,8 @@ env_vars: { value: "github/python-billing/.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-billing/docs/_static/custom.css b/packages/google-cloud-billing/docs/_static/custom.css index bcd37bbd3c4a..b0a295464b23 100644 --- a/packages/google-cloud-billing/docs/_static/custom.css +++ b/packages/google-cloud-billing/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-billing/synth.py b/packages/google-cloud-billing/owlbot.py similarity index 74% rename from packages/google-cloud-billing/synth.py rename to packages/google-cloud-billing/owlbot.py index 427b0801cc55..20496e6ad48d 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/owlbot.py @@ -19,20 +19,15 @@ import synthtool.gcp as gcp from synthtool.languages import python -gapic = gcp.GAPICBazel() common = gcp.CommonTemplates() -# ---------------------------------------------------------------------------- -# Generate budgets GAPIC layer -# ---------------------------------------------------------------------------- -library = gapic.py_library( - service="billing", - version="v1", - bazel_target="//google/cloud/billing/v1:billing-v1-py", -) +default_version = "v1" + +for library in s.get_staging_dirs(default_version): + excludes = ["setup.py", "docs/index.rst", "scripts/fixup*"] + s.move(library, excludes=excludes) -excludes = ["setup.py", "docs/index.rst", "scripts/fixup*"] -s.move(library, excludes=excludes) +s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files @@ -41,6 +36,4 @@ s.move(templated_files, excludes=[".coveragerc"]) # the microgenerator has a good coveragerc file s.replace(".gitignore", "bigquery/docs/generated", "htmlcov") # temporary hack to ignore htmlcov - - s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/packages/google-cloud-billing/renovate.json b/packages/google-cloud-billing/renovate.json index f08bc22c9a55..c04895563e69 100644 --- a/packages/google-cloud-billing/renovate.json +++ b/packages/google-cloud-billing/renovate.json @@ -2,5 +2,8 @@ "extends": [ "config:base", ":preserveSemverRanges" ], - "ignorePaths": [".pre-commit-config.yaml"] + "ignorePaths": [".pre-commit-config.yaml"], + "pip_requirements": { + "fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"] + } } diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata deleted file mode 100644 index 85e4e83b5000..000000000000 --- a/packages/google-cloud-billing/synth.metadata +++ /dev/null @@ -1,150 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-billing.git", - "sha": "c98aebaa7343cee9b0dcac6ea4979b191d14ddb7" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "56fc6d43fed71188d7e18f3ca003544646c4ab35", - "internalRef": "366346972" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "billing", - "apiVersion": "v1", - "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", - "README.rst", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/billing_v1/cloud_billing.rst", - "docs/billing_v1/cloud_catalog.rst", - "docs/billing_v1/services.rst", - "docs/billing_v1/types.rst", - "docs/conf.py", - "docs/multiprocessing.rst", - "google/cloud/billing/__init__.py", - "google/cloud/billing/py.typed", - "google/cloud/billing_v1/__init__.py", - "google/cloud/billing_v1/py.typed", - "google/cloud/billing_v1/services/__init__.py", - "google/cloud/billing_v1/services/cloud_billing/__init__.py", - "google/cloud/billing_v1/services/cloud_billing/async_client.py", - "google/cloud/billing_v1/services/cloud_billing/client.py", - "google/cloud/billing_v1/services/cloud_billing/pagers.py", - "google/cloud/billing_v1/services/cloud_billing/transports/__init__.py", - "google/cloud/billing_v1/services/cloud_billing/transports/base.py", - "google/cloud/billing_v1/services/cloud_billing/transports/grpc.py", - "google/cloud/billing_v1/services/cloud_billing/transports/grpc_asyncio.py", - "google/cloud/billing_v1/services/cloud_catalog/__init__.py", - "google/cloud/billing_v1/services/cloud_catalog/async_client.py", - "google/cloud/billing_v1/services/cloud_catalog/client.py", - "google/cloud/billing_v1/services/cloud_catalog/pagers.py", - "google/cloud/billing_v1/services/cloud_catalog/transports/__init__.py", - "google/cloud/billing_v1/services/cloud_catalog/transports/base.py", - "google/cloud/billing_v1/services/cloud_catalog/transports/grpc.py", - "google/cloud/billing_v1/services/cloud_catalog/transports/grpc_asyncio.py", - "google/cloud/billing_v1/types/__init__.py", - "google/cloud/billing_v1/types/cloud_billing.py", - "google/cloud/billing_v1/types/cloud_catalog.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "scripts/decrypt-secrets.sh", - "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/billing_v1/__init__.py", - "tests/unit/gapic/billing_v1/test_cloud_billing.py", - "tests/unit/gapic/billing_v1/test_cloud_catalog.py" - ] -} \ No newline at end of file