Skip to content
Ona Docs

UpdateTask

client.Environments.Automations.Tasks.Update(ctx, body) (*EnvironmentAutomationTaskUpdateResponse, error)
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 EnvironmentAutomationTaskUpdateParams
ID param.Field[string]Optional
formatuuid
DependsOn param.Field[[]string]Optional

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

Metadata param.Field[EnvironmentAutomationTaskUpdateParamsMetadata]Optional
Description stringOptional
Name stringOptional
minLength1
TriggeredBy EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByOptional
Trigger []AutomationTriggerOptional
BeforeSnapshot boolOptional
Manual boolOptional
PostDevcontainerStart boolOptional
PostEnvironmentStart boolOptional
PostMachineStart boolOptional
Prebuild boolOptional
Command stringOptional
Name stringOptional

name is the environment variable name.

minLength1
Value stringOptional

value is a literal string value.

ValueFrom EnvironmentVariableSourceOptional

value_from specifies a source for the value.

SecretRef SecretRef

secret_ref references a secret by ID.

ID stringOptional

id is the UUID of the secret to reference.

formatuuid
RunsOn RunsOnOptional
Docker RunsOnDockerOptional
Environment []stringOptional
Image stringOptional
minLength1
Machine unknownOptional

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

ReturnsExpand Collapse
type EnvironmentAutomationTaskUpdateResponse interface{…}

UpdateTask

package main

import (
  "context"
  "fmt"

  "github.com/gitpod-io/gitpod-sdk-go"
  "github.com/gitpod-io/gitpod-sdk-go/option"
)

func main() {
  client := gitpod.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  task, err := client.Environments.Automations.Tasks.Update(context.TODO(), gitpod.EnvironmentAutomationTaskUpdateParams{
    ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
    Spec: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsSpec{
      Command: gitpod.F("npm run test:coverage"),
    }),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", task)
}
{}
Returns Examples
{}