Buduj w chmurze QuickStart
import google.auth
from google.cloud.devtools import cloudbuild_v1
def quickstart():
"""Create and execute a simple Google Cloud Build configuration,
print the in-progress status and print the completed status."""
# Authorize the client with Google defaults
credentials, project_id = google.auth.default()
client = cloudbuild_v1.services.cloud_build.CloudBuildClient()
build = cloudbuild_v1.Build()
# The following build steps will output "hello world"
# For more information on build configuration, see
# https://cloud.google.com/build/docs/configuring-builds/create-basic-configuration
build.steps = [{"name": "ubuntu",
"entrypoint": "bash",
"args": ["-c", "echo hello world"]}]
operation = client.create_build(project_id=project_id, build=build)
# Print the in-progress operation
print("IN PROGRESS:")
print(operation.metadata)
result = operation.result()
# Print the completed status
print("RESULT:", result.status)
Muddy Mosquito