Upsert a Deployment with the Houston API

Upsert a Deployment with configurations

You can use the upsertDeployment mutation to both create and update Deployments with all possible Deployment configurations. If you query upsertDeployment without a deploymentUuid, the Houston API creates a new Deployment according to your specifications. If you specify an existing deploymentUuid, the Houston API updates the Deployment with that ID. All queries to create a Deployment require specifying a workspaceUuid.

When you make upsert updates to your Airflow Deployments, you must explicitly specify all existing environment variables, otherwise, the upsert overwrites them.

The following query creates a new Deployment in a custom namespace test-new-dep and configures a Deployment environment variable AIRFLOW__CORE__COLORED_LOG_FORMAT.

1mutation upsertDeployment(
2 $workspaceUuid: Uuid,
3 $deploymentUuid: Uuid,
4 $label: String,
5 $description: String,
6 $releaseName: String,
7 $namespace: String,
8 $environmentVariables: [InputEnvironmentVariable],
9 $image: String,
10 $dockerconfigjson: JSON,
11 $version: String,
12 $airflowVersion: String,
13 $runtimeVersion: String,
14 $desiredRuntimeVersion: String,
15 $executor: ExecutorType,
16 $workers: Workers,
17 $webserver: Webserver,
18 $scheduler: Scheduler,
19 $triggerer: Triggerer,
20 $dagProcessor: DagProcessor,
21 $dagDeployment: DagDeployment,
22 $properties: JSON,
23 $cloudRole: String
24) {
25 upsertDeployment(
26 workspaceUuid: $workspaceUuid,
27 deploymentUuid: $deploymentUuid,
28 label: $label,
29 description: $description,
30 releaseName: $releaseName,
31 namespace: $namespace,
32 environmentVariables: $environmentVariables,
33 image: $image,
34 dockerconfigjson: $dockerconfigjson,
35 version: $version,
36 airflowVersion: $airflowVersion,
37 runtimeVersion: $runtimeVersion,
38 desiredRuntimeVersion: $desiredRuntimeVersion,
39 executor: $executor,
40 workers: $workers,
41 webserver: $webserver,
42 scheduler: $scheduler,
43 triggerer: $triggerer,
44 dagProcessor: $dagProcessor,
45 dagDeployment: $dagDeployment,
46 properties: $properties,
47 cloudRole: $cloudRole
48) {
49 id
50 config
51 urls {
52 type
53 url
54 __typename
55 }
56 properties
57 description
58 label
59 releaseName
60 namespace
61 status
62 type
63 version
64 workspace {
65 id
66 label
67 __typename
68 }
69 airflowVersion
70 runtimeVersion
71 desiredAirflowVersion
72 upsertedEnvironmentVariables {
73 key
74 value
75 isSecret
76 __typename
77 }
78 dagDeployment {
79 type
80 nfsLocation
81 repositoryUrl
82 branchName
83 syncInterval
84 syncTimeout
85 ephemeralStorage
86 dagDirectoryLocation
87 rev
88 sshKey
89 knownHosts
90 __typename
91 }
92 createdAt
93 updatedAt
94 __typename
95 }
96}
97{
98 "workspaceUuid": "cldemxl9502454yxe6vjlxy23",
99 "environmentVariables": [
100 {
101 "key": "AIRFLOW__CORE__COLORED_LOG_FORMAT",
102 "value": "test",
103 "isSecret": false
104 }
105 ],
106 "releaseName": "",
107 "namespace": "test-new-dep",
108 "executor": "CeleryExecutor",
109 "workers": {},
110 "webserver": {},
111 "scheduler": {
112 "replicas": 1
113 },
114 "dagProcessor": {},
115 "label": "test-new-dep",
116 "description": "",
117 "runtimeVersion": "7.2.0",
118 "properties": {
119 "extra_au": 0
120 },
121 "dagDeployment": {
122 "type": "image",
123 "nfsLocation": "",
124 "repositoryUrl": "",
125 "branchName": "",
126 "syncInterval": 1,
127 "syncTimeout": 120,
128 "ephemeralStorage": 2,
129 "dagDirectoryLocation": "",
130 "rev": "",
131 "sshKey": "",
132 "knownHosts": ""
133 }
134}