Skip to content

Commit edad2f8

Browse files
authored
Merge branch 'main' into python-kms-migration
2 parents b29b377 + b47c641 commit edad2f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2830
-2
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/billing/**/* @GoogleCloudPlatform/billing-samples-maintainers @GoogleCloudPlatform/python-samples-reviewers
2626
/blog/**/* @GoogleCloudPlatform/python-samples-reviewers
2727
/cdn/**/* @mpwarres @GoogleCloudPlatform/python-samples-reviewers
28+
/cloudbuild/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers
2829
/cloud-sql/**/* @GoogleCloudPlatform/infra-db-dpes @GoogleCloudPlatform/python-samples-reviewers
2930
/codelabs/**/* @GoogleCloudPlatform/python-samples-reviewers
3031
/composer/**/* @leahecole @rachael-ds @rafalbiegacz @GoogleCloudPlatform/python-samples-reviewers
@@ -49,7 +50,7 @@
4950
/media_cdn/**/* @justin-mp @msampathkumar @GoogleCloudPlatform/python-samples-reviewers
5051
/memorystore/**/* @GoogleCloudPlatform/python-samples-reviewers
5152
/ml_engine/**/* @ivanmkc @GoogleCloudPlatform/python-samples-reviewers
52-
/monitoring/**/* @GoogleCloudPlatform/python-samples-reviewers
53+
/monitoring/**/* @GoogleCloudPlatform/dee-observability @GoogleCloudPlatform/python-samples-reviewers
5354
/monitoring/opencensus @yuriatgoogle @GoogleCloudPlatform/python-samples-reviewers
5455
/monitoring/prometheus @yuriatgoogle @GoogleCloudPlatform/python-samples-reviewers
5556
/notebooks/**/* @alixhami @GoogleCloudPlatform/python-samples-reviewers

.github/blunderbuss.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ assign_issues_by:
3333
- 'api: cloudbilling'
3434
to:
3535
- GoogleCloudPlatform/billing-samples-maintainers
36+
- labels:
37+
- 'api: cloudbuild'
38+
to:
39+
- GoogleCloudPlatform/torus-dpe
3640
- labels:
3741
- 'api: cloudsql'
3842
to:
@@ -108,6 +112,10 @@ assign_issues_by:
108112
- 'api: translate'
109113
to:
110114
- nicain
115+
- labels:
116+
- 'api: monitoring'
117+
to:
118+
- GoogleCloudPlatform/dee-observability
111119

112120
assign_prs_by:
113121
- labels:

cloudbuild/AUTHORING_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md

cloudbuild/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/CONTRIBUTING.md

cloudbuild/snippets/noxfile_config.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
# Default TEST_CONFIG_OVERRIDE for python repos.
16+
17+
# You can copy this file into your directory, then it will be imported from
18+
# the noxfile.py.
19+
20+
# The source of truth:
21+
# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/noxfile_config.py
22+
23+
TEST_CONFIG_OVERRIDE = {
24+
# You can opt out from the test for specific Python versions.
25+
# NOTE: We currently only run the test in Python 3.8.
26+
"ignored_versions": ["2.7"],
27+
# Old samples are opted out of enforcing Python type hints
28+
# All new samples should feature them
29+
"enforce_type_hints": True,
30+
# An envvar key for determining the project id to use. Change it
31+
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
32+
# build specific Cloud project. You can also use your own string
33+
# to use your own Cloud project.
34+
"gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
35+
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
36+
# A dictionary you want to inject into your test. Don't put any
37+
# secrets here. These values will override predefined values.
38+
"envs": {
39+
},
40+
}

cloudbuild/snippets/quickstart.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
16+
# [START cloudbuild_quickstart]
17+
import google.auth
18+
from google.cloud.devtools import cloudbuild_v1
19+
20+
21+
def quickstart() -> None:
22+
"""Create and execute a simple Google Cloud Build configuration,
23+
print the in-progress status and print the completed status."""
24+
25+
# Authorize the client with Google defaults
26+
credentials, project_id = google.auth.default()
27+
client = cloudbuild_v1.services.cloud_build.CloudBuildClient()
28+
29+
# If you're using Private Pools or a non-global default pool, add a regional
30+
# `api_endpoint` to `CloudBuildClient()`
31+
# For example, '<YOUR_POOL_REGION>-cloudbuild.googleapis.com'
32+
#
33+
# from google.api_core import client_options
34+
# client_options = client_options.ClientOptions(
35+
# api_endpoint="us-central1-cloudbuild.googleapis.com"
36+
# )
37+
# client = cloudbuild_v1.services.cloud_build.CloudBuildClient(client_options=client_options)
38+
39+
build = cloudbuild_v1.Build()
40+
41+
# The following build steps will output "hello world"
42+
# For more information on build configuration, see
43+
# https://cloud.google.com/build/docs/configuring-builds/create-basic-configuration
44+
build.steps = [{"name": "ubuntu",
45+
"entrypoint": "bash",
46+
"args": ["-c", "echo hello world"]}]
47+
48+
operation = client.create_build(project_id=project_id, build=build)
49+
# Print the in-progress operation
50+
print("IN PROGRESS:")
51+
print(operation.metadata)
52+
53+
result = operation.result()
54+
# Print the completed status
55+
print("RESULT:", result.status)
56+
# [END cloudbuild_quickstart]
57+
58+
59+
if __name__ == "__main__":
60+
quickstart()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
# https://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+
16+
import pytest
17+
18+
import quickstart
19+
20+
21+
def test_quickstart(capsys: pytest.CaptureFixture) -> None:
22+
quickstart.quickstart()
23+
out, _ = capsys.readouterr()
24+
# Prints in-progress message
25+
assert "hello world" in out
26+
# Prints final status
27+
assert "Status.SUCCESS" in out
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest==7.2.0

cloudbuild/snippets/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
google-cloud-build==3.9.3
2+
google-auth==2.14.0

0 commit comments

Comments
 (0)