Google Cloud Run

Google Cloud Run

Certified
Enterprise Edition

Run an existing Google Cloud Run Job

Enterprise-only task that submits a new execution of an already-existing Cloud Run Job, optionally waits for its completion, and streams its container logs to the task run. Unlike the runner.CloudRun task runner, this task never creates, updates, or deletes the Job definition: it only submits an execution against a Job that must already exist (run.jobs.run), so it requires the Cloud Run Developer (roles/run.developer) role, plus Logs Viewer (roles/logging.viewer) to stream logs. Use containerArgs, containerEnvironment, and taskCount to override the Job template for this execution only; any override left unset falls back to the Job template's own configuration. If the task's timeout elapses while waiting for completion, this task fails but does not cancel the underlying Cloud Run execution — it keeps running (and billing) in GCP. Killing the Kestra task (e.g. via the UI or kill()) does cancel it; only a timeout does not.

yaml
type: io.kestra.plugin.ee.gcp.cloudrun.Run

Run an existing Cloud Run Job and wait for its completion.

yaml
id: cloud_run_run_existing_job
namespace: company.team

inputs:
  - id: gcp_region
    type: STRING
    defaults: europe-west1
  - id: job_name
    type: STRING
    defaults: prod-etl-job

tasks:
  - id: run_existing_job
    type: io.kestra.plugin.ee.gcp.cloudrun.Run
    projectId: "{{ secret('GCP_PROJECT_ID') }}"
    region: "{{ inputs.gcp_region }}"
    jobName: "{{ inputs.job_name }}"
    serviceAccount: "{{ secret('GOOGLE_SA') }}"
    wait: true
    completionCheckInterval: PT10S

Override container environment variables for a single execution.

yaml
id: cloud_run_run_with_overrides
namespace: company.team

tasks:
  - id: run_existing_job
    type: io.kestra.plugin.ee.gcp.cloudrun.Run
    projectId: "{{ secret('GCP_PROJECT_ID') }}"
    region: europe-west1
    jobName: prod-etl-job
    serviceAccount: "{{ secret('GOOGLE_SA') }}"
    containerEnvironment:
      RUN_ID: "{{ execution.id }}"
      ENVIRONMENT: prod

  - id: log_result
    type: io.kestra.plugin.core.log.Log
    message: "Execution {{ outputs.run_existing_job.executionName }} finished with state {{ outputs.run_existing_job.state }}"

Fire a nightly batch execution without waiting for completion.

yaml
id: cloud_run_scheduled_fire_and_forget
namespace: company.team

triggers:
  - id: nightly
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 2 * * *"

tasks:
  - id: run_existing_job
    type: io.kestra.plugin.ee.gcp.cloudrun.Run
    projectId: "{{ secret('GCP_PROJECT_ID') }}"
    region: europe-west1
    jobName: nightly-batch-job
    serviceAccount: "{{ secret('GOOGLE_SA') }}"
    wait: false
Properties

Cloud Run Job name

The existing Cloud Run Job to run. Accepts either the short job name (resolved against projectId and region) or the fully-qualified resource path projects/{project}/locations/{region}/jobs/{job}. The Job must already exist: this task never creates, updates, or deletes it.

GCP region

Region the Cloud Run Job runs in.

DefaultPT5S

Completion poll interval

How often to check execution status while waiting; defaults to PT5S. Lower for short jobs, higher to reduce API calls.

SubTypestring

Container arguments override

Replaces the container's command-line arguments for this execution only; leave unset to use the Job template's own arguments.

Container environment variables override

Environment variables applied to the container for this execution only; leave unset to use the Job template's own environment.

The GCP service account to impersonate

Service account email to impersonate for API calls. For Cloud Run runner, this value applies to API calls used to create and run the job (--impersonate-service-account equivalent). It does not set the job execution identity (--service-account).

Reference (ref) of the pluginDefaults to apply to this task.

The GCP project ID

SubTypestring
Default["https://www.googleapis.com/auth/cloud-platform"]

The GCP scopes to be used

The GCP service account key

Service account JSON key used to authenticate API calls. For Cloud Run runner job execution identity, this value is used as a fallback for --service-account when runtimeServiceAccount is not provided.

Task count override

Number of parallel tasks to run for this execution; must be between 1 and 10000 (Cloud Run Jobs' documented maximum). Leave unset to use the Job template's own task count.

Defaulttrue

Wait for completion

If true (default), waits for the execution to reach a terminal state and streams its container logs before returning. If false, returns immediately after submitting the execution, leaving state, startedAt, and stoppedAt unset.

Cloud Run execution resource name

Formatdate-time

Time the execution started running

Unset when wait is false.

Terminal execution state

SUCCEEDED or CANCELLED (the latter only when this task's own kill() requested the cancellation). Any other cancellation, or a failure, fails the task instead of being returned here. Unset when wait is false.

Formatdate-time

Time the execution stopped running

Unset when wait is false.