UpsertAutomationsFile
environments.automations.upsert(AutomationUpsertParams**kwargs) -> AutomationUpsertResponse
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 os
from gitpod import Gitpod
client = Gitpod(
bearer_token=os.environ.get("GITPOD_API_KEY"), # This is the default and can be omitted
)
response = client.environments.automations.upsert(
automations_file={
"services": {
"web-server": {
"commands": {
"ready": "curl -s http://localhost:3000",
"start": "npm run dev",
},
"description": "Development web server",
"name": "Web Server",
"triggered_by": ["postDevcontainerStart"],
}
},
"tasks": {
"build": {
"command": "npm run build",
"description": "Builds the project artifacts",
"name": "Build Project",
"triggered_by": ["postEnvironmentStart"],
}
},
},
environment_id="07e03a28-65a5-4d98-b532-8ea67b188048",
)
print(response.updated_service_ids){
"updatedServiceIds": [
"string"
],
"updatedTaskIds": [
"string"
]
}Returns Examples
{
"updatedServiceIds": [
"string"
],
"updatedTaskIds": [
"string"
]
}