Connector for Cloud Build

Workflows connector that defines the built-in function used to access Cloud Build within a workflow.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

  # This workflow demonstrates how to use the Cloud Build connector. 
 # The workflow creates a simple build and the image is stored to an Artifact Registry repo. 
 # The workflow assumes a properly defined source tgz file already 
 # exists in a Cloud Storage bucket: gs://your-project-id_cloudbuild/source/placeholder_src.tgz 
 # and a repository "your-project-id-docker-repo" already 
 # exists in Artifact Registry where the image will be stored. 
 # The new table and dataset are both deleted in the following steps. 
 # Expected successful output: "SUCCESS" 
 - 
  
 init 
 : 
  
 assign 
 : 
  
 - 
  
 project_id 
 : 
  
 ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")} 
  
 - 
  
 location_id 
 : 
  
 "global" 
  
 - 
  
 repo 
 : 
  
 ${project_id + "-docker-repo"} 
  
 - 
  
 image_path 
 : 
  
 ${"us-central1-docker.pkg.dev/" + project_id + "/" + repo + "/quickstart-image:tag1"} 
 - 
  
 create_build 
 : 
  
 call 
 : 
  
 googleapis.cloudbuild.v1.projects.builds.create 
  
 args 
 : 
  
 projectId 
 : 
  
 ${project_id} 
  
 parent 
 : 
  
 ${"projects/" + project_id + "/locations/" + location_id} 
  
 body 
 : 
  
 source 
 : 
  
 storageSource 
 : 
  
 bucket 
 : 
  
 ${project_id + "_cloudbuild"} 
  
 object 
 : 
  
 "source/placeholder_src.tgz" 
  
 steps 
 : 
  
 - 
  
 name 
 : 
  
 "gcr.io/cloud-builders/docker" 
  
 args 
 : 
  
 - 
  
 "build" 
  
 - 
  
 "-t" 
  
 - 
  
 ${image_path} 
  
 - 
  
 "." 
  
 images 
 : 
  
 - 
  
 ${image_path} 
 - 
  
 the_end 
 : 
  
 return 
 : 
  
 "SUCCESS" 
 

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .

Create a Mobile Website
View Site in Mobile | Classic
Share by: