UpsertAutomationsFile
client.environments.automations.upsert(AutomationUpsertParams { automationsFile, environmentId } body, RequestOptionsoptions?): AutomationUpsertResponse { updatedServiceIds, updatedTaskIds }
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
UpsertAutomationsFile
import Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
const response = await client.environments.automations.upsert({
automationsFile: {
services: {
'web-server': {
commands: { ready: 'curl -s http://localhost:3000', start: 'npm run dev' },
description: 'Development web server',
name: 'Web Server',
triggeredBy: ['postDevcontainerStart'],
},
},
tasks: {
build: {
command: 'npm run build',
description: 'Builds the project artifacts',
name: 'Build Project',
triggeredBy: ['postEnvironmentStart'],
},
},
},
environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048',
});
console.log(response.updatedServiceIds);{
"updatedServiceIds": [
"string"
],
"updatedTaskIds": [
"string"
]
}Returns Examples
{
"updatedServiceIds": [
"string"
],
"updatedTaskIds": [
"string"
]
}