Skip to content
Ona Docs

UpsertAutomationsFile

POST/gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile

Upserts the automations file for the given environment.

Use this method to:

  • Configure environment automations
  • Update automation settings
  • Manage automation files

Examples

  • Update automations file:

    Updates or creates the automations configuration.

    environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
    automationsFile:
      services:
        web-server:
          name: "Web Server"
          description: "Development web server"
          commands:
            start: "npm run dev"
            ready: "curl -s http://localhost:3000"
          triggeredBy:
            - postDevcontainerStart
      tasks:
        build:
          name: "Build Project"
          description: "Builds the project artifacts"
          command: "npm run build"
          triggeredBy:
            - postEnvironmentStart
Body ParametersJSONExpand Collapse
automationsFile: optional AutomationsFile { services, tasks }

WARN: Do not remove any field here, as it will break reading automation yaml files. We error if there are any unknown fields in the yaml (to ensure the yaml is correct), but would break if we removed any fields. This includes marking a field as “reserved” in the proto file, this will also break reading the yaml.

services: optional map[object { commands, description, name, 3 more } ]
commands: optional object { ready, start, stop }
ready: optional string

ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code.

start: optional string

start is the command to start and run the service. If start exits, the service will transition to the following phase:

  • Stopped: if the exit code is 0
  • Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal.
minLength1
stop: optional string

stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands.

description: optional string
name: optional string
minLength1
role: optional "" or "default" or "editor" or "ai-agent"
One of the following:
""
"default"
"editor"
"ai-agent"
runsOn: optional RunsOn { docker, machine }
docker: optional object { environment, image }
environment: optional array of string
image: optional string
minLength1
machine: optional unknown

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

triggeredBy: optional array of "manual" or "postEnvironmentStart" or "postDevcontainerStart" or "prebuild"
One of the following:
"manual"
"postEnvironmentStart"
"postDevcontainerStart"
"prebuild"
tasks: optional map[object { command, dependsOn, description, 3 more } ]
command: optional string
minLength1
dependsOn: optional array of string
description: optional string
name: optional string
minLength1
runsOn: optional RunsOn { docker, machine }
docker: optional object { environment, image }
environment: optional array of string
image: optional string
minLength1
machine: optional unknown

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

triggeredBy: optional array of "manual" or "postEnvironmentStart" or "postDevcontainerStart" or "prebuild"
One of the following:
"manual"
"postEnvironmentStart"
"postDevcontainerStart"
"prebuild"
environmentId: optional string
formatuuid
ReturnsExpand Collapse
updatedServiceIds: optional array of string
updatedTaskIds: optional array of string

UpsertAutomationsFile

curl https://app.gitpod.io/api/gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $GITPOD_API_KEY" \
    -d '{}'
{
  "updatedServiceIds": [
    "string"
  ],
  "updatedTaskIds": [
    "string"
  ]
}
Returns Examples
{
  "updatedServiceIds": [
    "string"
  ],
  "updatedTaskIds": [
    "string"
  ]
}