Skip to content

Commit eccbd0d

Browse files
authored
chore: migrate to owl bot (googleapis#319)
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. With owl bot, on every PR, a post-processor image will run so that we won't have to ask contributors to run [blacken](https://github.com/googleapis/python-spanner/blob/master/synth.py#L88).
1 parent 7bddb81 commit eccbd0d

File tree

14 files changed

+156
-318
lines changed

14 files changed

+156
-318
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker:
2+
digest: sha256:cfc0e802701262c211703c468874d767f65dabe6a1a71d0e07bfc8a3d5175f32
3+
image: gcr.io/repo-automation-bots/owlbot-python:latest
4+

.github/.OwlBot.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
docker:
16+
image: gcr.io/repo-automation-bots/owlbot-python:latest
17+
18+
deep-remove-regex:
19+
- /owl-bot-staging
20+
21+
deep-copy-regex:
22+
- source: /google/spanner/(v.*)/.*-py/(.*)
23+
dest: /owl-bot-staging/spanner/$1/$2
24+
- source: /google/spanner/admin/instance/(v.*)/.*-py/(.*)
25+
dest: /owl-bot-staging/spanner_admin_instance/$1/$2
26+
- source: /google/spanner/admin/database/(v.*)/.*-py/(.*)
27+
dest: /owl-bot-staging/spanner_admin_database/$1/$2
28+
29+
begin-after-commit-hash: b154da710c5c9eedee127c07f74b6158c9c22382
30+

.github/header-checker-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{"allowedCopyrightHolders": ["Google LLC"],
22
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
3-
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
3+
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
44
"sourceFileExtensions": [
55
"ts",
66
"js",

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pip-log.txt
4545

4646
# Built documentation
4747
docs/_build
48+
bigquery/docs/generated
4849
docs.metadata
4950

5051
# Virtual environment

.kokoro/release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools
2626
export PYTHONUNBUFFERED=1
2727

2828
# Move into the package, build the distribution and upload.
29-
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password")
29+
TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token")
3030
cd github/python-spanner
3131
python3 setup.py sdist bdist_wheel
32-
twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/*
32+
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*

.kokoro/release/common.cfg

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,8 @@ env_vars: {
2323
value: "github/python-spanner/.kokoro/release.sh"
2424
}
2525

26-
# Fetch PyPI password
27-
before_action {
28-
fetch_keystore {
29-
keystore_resource {
30-
keystore_config_id: 73713
31-
keyname: "google_cloud_pypi_password"
32-
}
33-
}
34-
}
35-
3626
# Tokens needed to report release status back to GitHub
3727
env_vars: {
3828
key: "SECRET_MANAGER_KEYS"
39-
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
40-
}
29+
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token"
30+
}

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
115
# See https://pre-commit.com for more information
216
# See https://pre-commit.com/hooks.html for more hooks
317
repos:

docs/_static/custom.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
div#python2-eol {
22
border-color: red;
33
border-width: medium;
4-
}
4+
}
55

66
/* Ensure minimum width for 'Parameters' / 'Returns' column */
77
dl.field-list > dt {
88
min-width: 100px
99
}
10+
11+
/* Insert space between methods for readability */
12+
dl.method {
13+
padding-top: 10px;
14+
padding-bottom: 10px
15+
}
16+
17+
/* Insert empty space between classes */
18+
dl.class {
19+
padding-bottom: 50px
20+
}

docs/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
# -*- coding: utf-8 -*-
2+
# Copyright 2021 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
215
#
316
# google-cloud-spanner documentation build configuration file
417
#

owlbot.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""This script is used to synthesize generated parts of this library."""
16+
import synthtool as s
17+
from synthtool import gcp
18+
from synthtool.languages import python
19+
20+
common = gcp.CommonTemplates()
21+
22+
spanner_default_version = "v1"
23+
spanner_admin_instance_default_version = "v1"
24+
spanner_admin_database_default_version = "v1"
25+
26+
for library in s.get_staging_dirs(spanner_default_version):
27+
if library.parent.absolute() == "spanner":
28+
s.move(library, excludes=["google/cloud/spanner/**", "*.*", "docs/index.rst", "google/cloud/spanner_v1/__init__.py"])
29+
30+
s.remove_staging_dirs()
31+
32+
for library in s.get_staging_dirs(spanner_admin_instance_default_version):
33+
if library.parent.absolute() == "spanner_admin_instance":
34+
s.move(library, excludes=["google/cloud/spanner_admin_instance/**", "*.*", "docs/index.rst"])
35+
36+
s.remove_staging_dirs()
37+
38+
for library in s.get_staging_dirs(spanner_admin_database_default_version):
39+
if library.parent.absolute() == "spanner_admin_database":
40+
s.move(library, excludes=["google/cloud/spanner_admin_database/**", "*.*", "docs/index.rst"])
41+
42+
s.remove_staging_dirs()
43+
44+
# ----------------------------------------------------------------------------
45+
# Add templated files
46+
# ----------------------------------------------------------------------------
47+
templated_files = common.py_library(microgenerator=True, samples=True)
48+
s.move(templated_files, excludes=[".coveragerc", "noxfile.py"])
49+
50+
# Ensure CI runs on a new instance each time
51+
s.replace(
52+
".kokoro/build.sh",
53+
"# Remove old nox",
54+
"# Set up creating a new instance for each system test run\n"
55+
"export GOOGLE_CLOUD_TESTS_CREATE_SPANNER_INSTANCE=true\n"
56+
"\n\g<0>",
57+
)
58+
59+
# ----------------------------------------------------------------------------
60+
# Samples templates
61+
# ----------------------------------------------------------------------------
62+
63+
python.py_samples()
64+
65+
s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 commit comments

Comments
 (0)