Skip to content

Commit 1a74af9

Browse files
chore: migrate to owl bot (#270)
* chore: migrate to owl bot * chore: copy files from googleapis-gen 130ce904e5d546c312943d10f48799590f9c0f66 * chore: run the post processor * 🦉 Updates from OwlBot Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 206f522 commit 1a74af9

File tree

10 files changed

+82
-208
lines changed

10 files changed

+82
-208
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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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/logging/(v.*)/.*-py/(.*)
23+
dest: /owl-bot-staging/$1/$2
24+
25+
begin-after-commit-hash: 130ce904e5d546c312943d10f48799590f9c0f66
26+

.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",

.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-logging
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-logging/.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+
}

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+
}

synth.py renamed to owlbot.py

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,33 @@
1717
from synthtool import gcp
1818
from synthtool.languages import python
1919

20-
gapic = gcp.GAPICBazel()
2120
common = gcp.CommonTemplates()
2221

23-
# ----------------------------------------------------------------------------
24-
# Generate logging GAPIC layer
25-
# ----------------------------------------------------------------------------
26-
library = gapic.py_library(
27-
service="logging",
28-
version="v2",
29-
bazel_target="//google/logging/v2:logging-v2-py",
30-
include_protos=True,
31-
)
22+
default_version = "v2"
3223

33-
s.move(
34-
library,
35-
excludes=[
36-
"setup.py",
37-
"README.rst",
38-
"google/cloud/logging/__init__.py", # generated types are hidden from users
39-
"google/cloud/logging_v2/__init__.py",
40-
"docs/index.rst",
41-
"docs/logging_v2", # Don't include gapic library docs. Users should use the hand-written layer instead
42-
"scripts/fixup_logging_v2_keywords.py", # don't include script since it only works for generated layer
43-
],
44-
)
24+
for library in s.get_staging_dirs(default_version):
25+
if library.name == "v2":
26+
# Fix generated unit tests
27+
s.replace(
28+
library / "tests/unit/gapic/logging_v2/test_logging_service_v2.py",
29+
"MonitoredResource\(\s*type_",
30+
"MonitoredResource(type"
31+
)
4532

46-
# Fix generated unit tests
47-
s.replace(
48-
"tests/unit/gapic/logging_v2/test_logging_service_v2.py",
49-
"MonitoredResource\(\s*type_",
50-
"MonitoredResource(type"
51-
)
33+
s.move(
34+
library,
35+
excludes=[
36+
"setup.py",
37+
"README.rst",
38+
"google/cloud/logging/__init__.py", # generated types are hidden from users
39+
"google/cloud/logging_v2/__init__.py",
40+
"docs/index.rst",
41+
"docs/logging_v2", # Don't include gapic library docs. Users should use the hand-written layer instead
42+
"scripts/fixup_logging_v2_keywords.py", # don't include script since it only works for generated layer
43+
],
44+
)
45+
46+
s.remove_staging_dirs()
5247

5348
# ----------------------------------------------------------------------------
5449
# Add templated files

renovate.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"extends": [
33
"config:base", ":preserveSemverRanges"
44
],
5-
"ignorePaths": [".pre-commit-config.yaml"]
5+
"ignorePaths": [".pre-commit-config.yaml"],
6+
"pip_requirements": {
7+
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
8+
}
69
}

samples/snippets/noxfile.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ def blacken(session: nox.sessions.Session) -> None:
172172
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
173173
"""Runs py.test for a particular project."""
174174
if os.path.exists("requirements.txt"):
175-
session.install("-r", "requirements.txt")
175+
if os.path.exists("constraints.txt"):
176+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
177+
else:
178+
session.install("-r", "requirements.txt")
176179

177180
if os.path.exists("requirements-test.txt"):
178-
session.install("-r", "requirements-test.txt")
181+
if os.path.exists("constraints-test.txt"):
182+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
183+
else:
184+
session.install("-r", "requirements-test.txt")
179185

180186
if INSTALL_LIBRARY_FROM_SOURCE:
181187
session.install("-e", _get_repo_root())

synth.metadata

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)