Skip to content

Commit

Permalink
chore: migrate to owl bot (#71)
Browse files Browse the repository at this point in the history
This PR migrates from autosynth to [owl bot](https://github.com/googleapis/repo-automation-bots/tree/master/packages/owl-bot).  owl bot will save time for maintainers as it will automatically open PRs when there are updates in [googleapis-gen](https://github.com/googleapis/googleapis-gen/tree/master/google) without requiring maintainers to run `synthtool` to build the client from protos. Additionally, similar to autosynth, PRs will be automatically opened when there are template updates.
  • Loading branch information
parthea authored May 12, 2021
1 parent 5c8acea commit bbfc016
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 185 deletions.
4 changes: 4 additions & 0 deletions packages/google-cloud-os-login/.github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker:
digest: sha256:457583330eec64daa02aeb7a72a04d33e7be2428f646671ce4045dcbc0191b1e
image: gcr.io/repo-automation-bots/owlbot-python:latest

29 changes: 29 additions & 0 deletions packages/google-cloud-os-login/.github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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-preserve-regex:
- /owl-bot-staging/v1beta

deep-copy-regex:
- source: /google/cloud/oslogin/(v.*)/.*-py/(.*)
dest: /owl-bot-staging/$1/$2

begin-after-commit-hash: b06c9034cfcbce180ba732d03be6526e5c8ea1bc

2 changes: 1 addition & 1 deletion packages/google-cloud-os-login/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ repos:
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.0
rev: 3.9.1
hooks:
- id: flake8
16 changes: 1 addition & 15 deletions packages/google-cloud-os-login/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,7 @@ Running System Tests
auth settings and change some configuration in your project to
run all the tests.

- System tests will be run against an actual project and
so you'll need to provide some environment variables to facilitate
authentication to your project:

- ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file;
Such a file can be downloaded directly from the developer's console by clicking
"Generate new JSON key". See private key
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
for more details.

- Once you have downloaded your json keys, set the environment variable
``GOOGLE_APPLICATION_CREDENTIALS`` to the absolute path of the json file::

$ export GOOGLE_APPLICATION_CREDENTIALS="/Users/<your_username>/path/to/app_credentials.json"

- System tests will be run against an actual project. You should use local credentials from gcloud when possible. See `Best practices for application authentication <https://cloud.google.com/docs/authentication/best-practices-applications#local_development_and_testing_with_the>`__. Some tests require a service account. For those tests see `Authenticating as a service account <https://cloud.google.com/docs/authentication/production>`__.

*************
Test Coverage
Expand Down
14 changes: 2 additions & 12 deletions packages/google-cloud-os-login/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,9 @@ def lint(session):
session.run("flake8", "google", "tests")


@nox.session(python="3.6")
@nox.session(python=DEFAULT_PYTHON_VERSION)
def blacken(session):
"""Run black.
Format code to uniform standard.
This currently uses Python 3.6 due to the automated Kokoro run of synthtool.
That run uses an image that doesn't have 3.6 installed. Before updating this
check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
"""
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
session.run(
"black", *BLACK_PATHS,
Expand Down Expand Up @@ -131,9 +124,6 @@ def system(session):
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
# Sanity check: Only run tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
session.skip("Credentials must be set via environment variable")
# Install pyopenssl for mTLS testing.
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
session.install("pyopenssl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,21 @@
import synthtool as s
from synthtool import gcp

gapic = gcp.GAPICBazel()
common = gcp.CommonTemplates()
excludes = ["README.rst", "setup.py", "nox*.py", "docs/index.rst"]

# ----------------------------------------------------------------------------
# Generate oslogin GAPIC layer
# ----------------------------------------------------------------------------
library = gapic.py_library(
service="oslogin",
version="v1",
bazel_target="//google/cloud/oslogin/v1:oslogin-v1-py",
include_protos=True,
)

s.move(library / "google/cloud/oslogin_v1")

s.move(library / "google/cloud/oslogin", excludes=[library / "google/cloud/oslogin/common/**/*"])
s.move(library / "google/cloud/oslogin/common", "google/cloud/oslogin_v1/common", excludes=[library / "google/cloud/oslogin/common/services"])
default_version = "v1"

s.move(library / "tests/unit/gapic/oslogin_v1")
for library in s.get_staging_dirs(default_version):
s.move(library / f"google/cloud/oslogin_{library.name}")
s.move(library / "google/cloud/oslogin", excludes=[ "common/**/*"])
s.move(library / "google/cloud/oslogin/common", f"google/cloud/oslogin_{library.name}/common", excludes=["services"])
s.move(library / f"tests/unit/gapic/oslogin_{library.name}")
s.move(library / f"scripts/fixup_oslogin_{library.name}_keywords.py")
s.move(library / "docs", excludes=["index.rst", "common"])
s.move(library / f"docs/common", f"docs/oslogin_{library.name}/common", excludes=["services.rst"])

s.move(library / "scripts/fixup_oslogin_v1_keywords.py")
s.remove_staging_dirs()

s.move(library / "docs", excludes=[library / "docs/index.rst", library / "docs/common"])
s.move(library / "docs/common", "docs/oslogin_v1/common", excludes=[library / "docs/common/services.rst"])
s.replace(
"docs/oslogin_v1/common/types.rst",
"google.cloud.oslogin.common.types",
Expand Down
137 changes: 0 additions & 137 deletions packages/google-cloud-os-login/synth.metadata

This file was deleted.

0 comments on commit bbfc016

Please sign in to comment.