Skip to content

Commit 31b1e79

Browse files
chore: release target installations scripts (#6529)
* sql script * sql script chnage * sql file chnage * pipeline repo * script number chnage * script number chnage * script chnages * scipt number chnage * script number changes
1 parent 3be5f94 commit 31b1e79

File tree

3 files changed

+749
-0
lines changed

3 files changed

+749
-0
lines changed

internal/sql/repository/pipelineConfig/PipelineRepository.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ type PipelineRepository interface {
145145
FindDeploymentAppTypeByIds(ids []int) (pipelines []*Pipeline, err error)
146146
GetAllAppsByClusterAndDeploymentAppType(clusterIds []int, deploymentAppName string) ([]*PipelineDeploymentConfigObj, error)
147147
GetAllArgoAppInfoByDeploymentAppNames(deploymentAppNames []string) ([]*PipelineDeploymentConfigObj, error)
148+
FindEnvIdsByIdsInIncludingDeleted(ids []int) ([]int, error)
148149
}
149150

150151
type CiArtifactDTO struct {
@@ -951,3 +952,18 @@ func (impl *PipelineRepositoryImpl) GetAllArgoAppInfoByDeploymentAppNames(deploy
951952
Select(&result)
952953
return result, err
953954
}
955+
956+
func (impl *PipelineRepositoryImpl) FindEnvIdsByIdsInIncludingDeleted(ids []int) ([]int, error) {
957+
var envIds []int
958+
if len(ids) == 0 {
959+
return envIds, nil
960+
}
961+
err := impl.dbConnection.Model(&Pipeline{}).
962+
Column("pipeline.environment_id").
963+
Where("pipeline.id in (?)", pg.In(ids)).
964+
Select(&envIds)
965+
if err != nil {
966+
impl.logger.Errorw("error on fetching pipelines", "ids", ids, "err", err)
967+
}
968+
return envIds, err
969+
}
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
BEGIN;
2+
3+
DELETE FROM global_policy where policy_of = 'RELEASE_ACTION_CHECK' AND version = 'V2';
4+
-- reverting to old state
5+
DROP INDEX IF EXISTS idx_unique_policy_name_policy_of_version;
6+
-- reverting to old state
7+
CREATE UNIQUE INDEX idx_unique_policy_name_policy_of
8+
ON global_policy (name,policy_of)
9+
WHERE deleted = false;
10+
11+
UPDATE devtron_resource_schema set schema = '{
12+
"type": "object",
13+
"title": "Release Schema",
14+
"$schema": "https://json-schema.org/draft/2020-12/schema",
15+
"required":
16+
[
17+
"version",
18+
"kind",
19+
"overview",
20+
"status"
21+
],
22+
"properties":
23+
{
24+
"kind":
25+
{
26+
"const": "release"
27+
},
28+
"status":
29+
{
30+
"type": "object",
31+
"required":
32+
[
33+
"config"
34+
],
35+
"properties":
36+
{
37+
"config":
38+
{
39+
"type": "object",
40+
"required":
41+
[
42+
"status"
43+
],
44+
"properties":
45+
{
46+
"lock":
47+
{
48+
"type": "boolean"
49+
},
50+
"status":
51+
{
52+
"enum":
53+
[
54+
"draft",
55+
"readyForRelease",
56+
"hold"
57+
],
58+
"type": "string"
59+
}
60+
}
61+
}
62+
}
63+
},
64+
"version":
65+
{
66+
"enum":
67+
[
68+
"alpha1"
69+
],
70+
"type": "string"
71+
},
72+
"overview":
73+
{
74+
"type": "object",
75+
"required":
76+
[
77+
"id",
78+
"releaseVersion"
79+
],
80+
"properties":
81+
{
82+
"id":
83+
{
84+
"type": "number"
85+
},
86+
"icon":
87+
{
88+
"type": "string",
89+
"contentEncoding": "base64"
90+
},
91+
"name":
92+
{
93+
"type": "string"
94+
},
95+
"note":
96+
{
97+
"type": "string"
98+
},
99+
"tags":
100+
{
101+
"additionalProperties":
102+
{
103+
"type": "string"
104+
}
105+
},
106+
"idType":
107+
{
108+
"enum":
109+
[
110+
"resourceObjectId",
111+
"oldObjectId"
112+
],
113+
"type": "string",
114+
"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."
115+
},
116+
"metadata":
117+
{
118+
"type": "object",
119+
"required":
120+
[
121+
"Type of release",
122+
"Release Managers",
123+
"On-Duty"
124+
],
125+
"properties":
126+
{
127+
"On-Duty":
128+
{
129+
"type": "array",
130+
"items":
131+
{
132+
"type": "object",
133+
"refType": "#/references/users"
134+
},
135+
"minItems": 1,
136+
"uniqueItems": true
137+
},
138+
"Milestones":
139+
{
140+
"type": "object",
141+
"properties":
142+
{
143+
"Release end date":
144+
{
145+
"type": "string",
146+
"format": "date"
147+
},
148+
"30% milestone date":
149+
{
150+
"type": "string",
151+
"format": "date"
152+
},
153+
"70% milestone date":
154+
{
155+
"type": "string",
156+
"format": "date"
157+
},
158+
"Release planned start date":
159+
{
160+
"type": "string",
161+
"format": "date"
162+
}
163+
}
164+
},
165+
"Type of release":
166+
{
167+
"enum":
168+
[
169+
"Major",
170+
"Minor",
171+
"Patch"
172+
],
173+
"type": "string"
174+
},
175+
"Release Managers":
176+
{
177+
"type": "array",
178+
"items":
179+
{
180+
"type": "object",
181+
"refType": "#/references/users"
182+
},
183+
"minItems": 1,
184+
"uniqueItems": true
185+
},
186+
"Target customers":
187+
{
188+
"type": "array",
189+
"items":
190+
{
191+
"type": "string"
192+
},
193+
"uniqueItems": true
194+
},
195+
"Released customers":
196+
{
197+
"type": "array",
198+
"items":
199+
{
200+
"type": "string"
201+
},
202+
"uniqueItems": true
203+
}
204+
}
205+
},
206+
"createdBy":
207+
{
208+
"type": "object",
209+
"refType": "#/references/users"
210+
},
211+
"createdOn":
212+
{
213+
"type": "string"
214+
},
215+
"description":
216+
{
217+
"type": "string"
218+
},
219+
"releaseVersion":
220+
{
221+
"type": "string"
222+
},
223+
"firstReleasedOn":
224+
{
225+
"type": "string",
226+
"format": "date-time"
227+
}
228+
}
229+
},
230+
"taskMapping":
231+
{
232+
"type": "array"
233+
},
234+
"dependencies":
235+
{
236+
"type": "array"
237+
}
238+
}
239+
}' where devtron_resource_id=(select id from devtron_resource where kind = 'release');
240+
241+
COMMIT;

0 commit comments

Comments
 (0)