Skip to content
Ona Docs

UpdateTask

environments.automations.tasks.update(TaskUpdateParams**kwargs) -> object
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
id: Optional[str]
formatuuid
depends_on: Optional[Sequence[str]]

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

metadata: Optional[Metadata]
description: Optional[str]
name: Optional[str]
minLength1
triggered_by: Optional[MetadataTriggeredBy]
trigger: Optional[Iterable[AutomationTrigger]]
before_snapshot: Optional[bool]
manual: Optional[bool]
post_devcontainer_start: Optional[bool]
post_environment_start: Optional[bool]
post_machine_start: Optional[bool]
prebuild: Optional[bool]
spec: Optional[Spec]
command: Optional[str]
env: Optional[Iterable[EnvironmentVariableItem]]
name: Optional[str]

name is the environment variable name.

minLength1
value: Optional[str]

value is a literal string value.

value_from: Optional[EnvironmentVariableSource]

value_from specifies a source for the value.

secret_ref: SecretRef

secret_ref references a secret by ID.

id: Optional[str]

id is the UUID of the secret to reference.

formatuuid
prebuild_requires_success: Optional[bool]
runs_on: Optional[RunsOn]
docker: Optional[Docker]
environment: Optional[List[str]]
image: Optional[str]
minLength1
machine: Optional[object]

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

ReturnsExpand Collapse
object

UpdateTask

import os
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
task = client.environments.automations.tasks.update(
    id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
    spec={
        "command": "npm run test:coverage"
    },
)
print(task)
{}
Returns Examples
{}