Execute a Cloud Run job

Deploy a workflow that executes a Cloud Run job.

Explore further

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

Code sample

YAML

  main 
 : 
  
 params 
 : 
  
 [ 
 event 
 ] 
  
 steps 
 : 
  
 - 
  
 init 
 : 
  
 assign 
 : 
  
 - 
  
 project_id 
 : 
  
 ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")} 
  
 - 
  
 event_bucket 
 : 
  
 ${event.data.bucket} 
  
 - 
  
 event_file 
 : 
  
 ${event.data.name} 
  
 - 
  
 target_bucket 
 : 
  
 ${"input-" + project_id} 
  
 - 
  
 job_name 
 : 
  
 parallel-job 
  
 - 
  
 job_location 
 : 
  
 us-central1 
  
 - 
  
 check_input_file 
 : 
  
 switch 
 : 
  
 - 
  
 condition 
 : 
  
 ${event_bucket == target_bucket} 
  
 next 
 : 
  
 run_job 
  
 - 
  
 condition 
 : 
  
 true 
  
 next 
 : 
  
 end 
  
 - 
  
 run_job 
 : 
  
 call 
 : 
  
 googleapis.run.v1.namespaces.jobs.run 
  
 args 
 : 
  
 name 
 : 
  
 ${"namespaces/" + project_id + "/jobs/" + job_name} 
  
 location 
 : 
  
 ${job_location} 
  
 body 
 : 
  
 overrides 
 : 
  
 containerOverrides 
 : 
  
 env 
 : 
  
 - 
  
 name 
 : 
  
 INPUT_BUCKET 
  
 value 
 : 
  
 ${event_bucket} 
  
 - 
  
 name 
 : 
  
 INPUT_FILE 
  
 value 
 : 
  
 ${event_file} 
  
 result 
 : 
  
 job_execution 
  
 - 
  
 finish 
 : 
  
 return 
 : 
  
 ${job_execution} 
 

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: