Skip to content

Commit 7983055

Browse files
feat: release v2 migration (#5126)
* updated default schema for release, change in catalogue * updated release action check policy migration * updated sql script no * script number change * script number chnage --------- Co-authored-by: Shivam-nagar23 <[email protected]>
1 parent ca21ac1 commit 7983055

File tree

2 files changed

+364
-0
lines changed

2 files changed

+364
-0
lines changed

scripts/sql/250_alter_resource_release_schema.down.sql

Whitespace-only changes.
Lines changed: 364 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,364 @@
1+
UPDATE devtron_resource_schema set schema = '{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Release Schema",
4+
"type": "object",
5+
"properties":
6+
{
7+
"kind":
8+
{
9+
"const": "release"
10+
},
11+
"version":
12+
{
13+
"type": "string",
14+
"enum":
15+
[
16+
"alpha1"
17+
]
18+
},
19+
"overview":
20+
{
21+
"type": "object",
22+
"properties":
23+
{
24+
"id":
25+
{
26+
"type": "number"
27+
},
28+
"idType":
29+
{
30+
"type": "string",
31+
"description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.",
32+
"enum":
33+
[
34+
"resourceObjectId",
35+
"oldObjectId"
36+
]
37+
},
38+
"firstReleasedOn":
39+
{
40+
"type": "string",
41+
"format": "date-time"
42+
},
43+
"releaseVersion":
44+
{
45+
"type": "string"
46+
},
47+
"name":
48+
{
49+
"type": "string"
50+
},
51+
"icon":
52+
{
53+
"type": "string",
54+
"contentEncoding": "base64"
55+
},
56+
"note":
57+
{
58+
"type": "string"
59+
},
60+
"description":
61+
{
62+
"type": "string"
63+
},
64+
"createdOn":
65+
{
66+
"type": "string"
67+
},
68+
"createdBy":
69+
{
70+
"type": "object",
71+
"refType": "#/references/users"
72+
},
73+
"tags":
74+
{
75+
"additionalProperties":
76+
{
77+
"type": "string"
78+
}
79+
},
80+
"metadata":
81+
{
82+
"type": "object",
83+
"properties":
84+
{
85+
"Type of release":
86+
{
87+
"type": "string",
88+
"enum":
89+
[
90+
"Major",
91+
"Minor",
92+
"Patch"
93+
]
94+
},
95+
"Release Managers":
96+
{
97+
"type": "array",
98+
"uniqueItems": true,
99+
"minItems": 1,
100+
"items":
101+
{
102+
"type": "object",
103+
"refType": "#/references/users"
104+
}
105+
},
106+
"On-Duty":
107+
{
108+
"type": "array",
109+
"uniqueItems": true,
110+
"minItems": 1,
111+
"items":
112+
{
113+
"type": "object",
114+
"refType": "#/references/users"
115+
}
116+
},
117+
"Milestones":
118+
{
119+
"type": "object",
120+
"properties":
121+
{
122+
"Release planned start date":
123+
{
124+
"type": "string",
125+
"format": "date"
126+
},
127+
"30% milestone date":
128+
{
129+
"type": "string",
130+
"format": "date"
131+
},
132+
"70% milestone date":
133+
{
134+
"type": "string",
135+
"format": "date"
136+
},
137+
"Release end date":
138+
{
139+
"type": "string",
140+
"format": "date"
141+
}
142+
}
143+
},
144+
"Target customers":
145+
{
146+
"type": "array",
147+
"uniqueItems": true,
148+
"items":
149+
{
150+
"type": "string"
151+
}
152+
},
153+
"Released customers":
154+
{
155+
"type": "array",
156+
"uniqueItems": true,
157+
"items":
158+
{
159+
"type": "string"
160+
}
161+
}
162+
},
163+
"required":
164+
[
165+
"Type of release",
166+
"Release Managers",
167+
"On-Duty"
168+
]
169+
}
170+
},
171+
"required":
172+
[
173+
"id",
174+
"releaseVersion"
175+
]
176+
},
177+
"status":
178+
{
179+
"type": "object",
180+
"properties":
181+
{
182+
"config":
183+
{
184+
"type": "object",
185+
"properties":
186+
{
187+
"status":
188+
{
189+
"type": "string",
190+
"enum":
191+
[
192+
"draft",
193+
"readyForRelease",
194+
"hold"
195+
]
196+
},
197+
"lock":
198+
{
199+
"type": "boolean"
200+
}
201+
},
202+
"required":
203+
[
204+
"status"
205+
]
206+
}
207+
},
208+
"required":
209+
[
210+
"config"
211+
]
212+
},
213+
"taskMapping":
214+
{
215+
"type": "array"
216+
},
217+
"dependencies":
218+
{
219+
"type": "array"
220+
}
221+
},
222+
"required":
223+
[
224+
"version",
225+
"kind",
226+
"overview",
227+
"status"
228+
]
229+
}' where devtron_resource_id=(select id from devtron_resource where kind = 'release');
230+
231+
232+
UPDATE global_policy set policy_json='{
233+
"definitions":
234+
[
235+
{
236+
"operationType": "patch",
237+
"operationPaths":
238+
[
239+
"overview.description",
240+
"overview.releaseNote",
241+
"overview.tags",
242+
"overview.name",
243+
"overview.metadata",
244+
"status.config.lock",
245+
"status.config"
246+
],
247+
"possibleFromStates":
248+
[
249+
{
250+
"configStatus": "draft",
251+
"dependencyArtifactStatus": "*",
252+
"rolloutStatus": "*",
253+
"lockStatus": "*"
254+
},
255+
{
256+
"configStatus": "readyForRelease",
257+
"dependencyArtifactStatus": "*",
258+
"rolloutStatus": "*",
259+
"lockStatus": "*"
260+
},
261+
{
262+
"configStatus": "hold",
263+
"dependencyArtifactStatus": "*",
264+
"rolloutStatus": "*",
265+
"lockStatus": "*"
266+
}
267+
]
268+
},
269+
{
270+
"operationType": "patch",
271+
"operationPaths":
272+
[
273+
"dependency.applications",
274+
"dependency.applications.image"
275+
],
276+
"possibleFromStates":
277+
[
278+
{
279+
"configStatus": "draft",
280+
"dependencyArtifactStatus": "*",
281+
"rolloutStatus": "notDeployed",
282+
"lockStatus": "unLocked"
283+
}
284+
]
285+
},
286+
{
287+
"operationType": "patch",
288+
"operationPaths":
289+
[
290+
"dependency.applications.instruction"
291+
],
292+
"possibleFromStates":
293+
[
294+
{
295+
"configStatus": "draft",
296+
"dependencyArtifactStatus": "*",
297+
"rolloutStatus": "notDeployed",
298+
"lockStatus": "unLocked"
299+
},
300+
{
301+
"configStatus": "readyForRelease",
302+
"dependencyArtifactStatus": "*",
303+
"rolloutStatus": "notDeployed",
304+
"lockStatus": "unLocked"
305+
},
306+
{
307+
"configStatus": "hold",
308+
"dependencyArtifactStatus": "*",
309+
"rolloutStatus": "notDeployed",
310+
"lockStatus": "unLocked"
311+
}
312+
]
313+
},
314+
{
315+
"operationType": "deploymentTrigger",
316+
"possibleFromStates":
317+
[
318+
{
319+
"configStatus": "readyForRelease",
320+
"dependencyArtifactStatus": "*",
321+
"rolloutStatus": "*",
322+
"lockStatus": "locked"
323+
}
324+
]
325+
},
326+
{
327+
"operationType": "delete",
328+
"possibleFromStates":
329+
[
330+
{
331+
"configStatus": "draft",
332+
"dependencyArtifactStatus": "*",
333+
"rolloutStatus": "notDeployed",
334+
"lockStatus": "*"
335+
},
336+
{
337+
"configStatus": "readyForRelease",
338+
"dependencyArtifactStatus": "*",
339+
"rolloutStatus": "notDeployed",
340+
"lockStatus": "*"
341+
},
342+
{
343+
"configStatus": "hold",
344+
"dependencyArtifactStatus": "*",
345+
"rolloutStatus": "notDeployed",
346+
"lockStatus": "*"
347+
},
348+
{
349+
"configStatus": "rescind",
350+
"dependencyArtifactStatus": "*",
351+
"rolloutStatus": "*",
352+
"lockStatus": "*"
353+
},
354+
{
355+
"configStatus": "corrupted",
356+
"dependencyArtifactStatus": "*",
357+
"rolloutStatus": "*",
358+
"lockStatus": "*"
359+
}
360+
]
361+
}
362+
],
363+
"consequence": "BLOCK"
364+
}' where policy_of='RELEASE_ACTION_CHECK';

0 commit comments

Comments
 (0)