Skip to content
Ona Docs

UpdateTask

client.environments.automations.tasks.update(TaskUpdateParams { id, dependsOn, metadata, spec } body, RequestOptionsoptions?): TaskUpdateResponse
POST/gitpod.v1.EnvironmentAutomationService/UpdateTask

Updates an automation task configuration.

Use this method to:

  • Modify task commands
  • Update task triggers
  • Change dependencies
  • Adjust execution settings

Examples

  • Update command:

    Changes the task’s command.

    id: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
    spec:
      command: "npm run test:coverage"
  • Update triggers:

    Modifies when the task runs.

    id: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
    metadata:
      triggeredBy:
        trigger:
          - postEnvironmentStart: true
ParametersExpand Collapse
body: TaskUpdateParams { id, dependsOn, metadata, spec }
id?: string
formatuuid
dependsOn?: Array<string>

dependencies specifies the IDs of the automations this task depends on.

metadata?: Metadata
description?: string | null
name?: string | null
minLength1
triggeredBy?: TriggeredBy | null
trigger?: Array<AutomationTrigger { beforeSnapshot, manual, postDevcontainerStart, 3 more } >
beforeSnapshot?: boolean
manual?: boolean
postDevcontainerStart?: boolean
postEnvironmentStart?: boolean
postMachineStart?: boolean
prebuild?: boolean
spec?: Spec
command?: string | null
env?: Array<EnvironmentVariableItem { name, value, valueFrom } >
name?: string

name is the environment variable name.

minLength1
value?: string

value is a literal string value.

valueFrom?: EnvironmentVariableSource { secretRef }

value_from specifies a source for the value.

secretRef: SecretRef { id }

secret_ref references a secret by ID.

id?: string

id is the UUID of the secret to reference.

formatuuid
prebuildRequiresSuccess?: boolean | null
runsOn?: RunsOn { docker, machine } | null
docker?: Docker { environment, image }
environment?: Array<string>
image?: string
minLength1
machine?: unknown

Machine runs the service/task directly on the VM/machine level.

ReturnsExpand Collapse
TaskUpdateResponse = unknown

UpdateTask

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const task = await client.environments.automations.tasks.update({
  id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68',
  spec: { command: 'npm run test:coverage' },
});

console.log(task);
{}
Returns Examples
{}