@eui/tools 6.13.16 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.version.properties +1 -1
- package/CHANGELOG.md +9 -0
- package/bin/eui-scripts.js +3 -1
- package/bin/scripts/release-app-group.js +5 -0
- package/package.json +1 -1
- package/scripts/csdr/cli/package-prompt.js +94 -93
- package/scripts/csdr/config/global.js +38 -27
- package/scripts/csdr/config/init.js +31 -23
- package/scripts/csdr/config/projects.js +51 -50
- package/scripts/csdr/init/init-projects-group.js +64 -0
- package/scripts/csdr/init/init.js +9 -3
- package/scripts/csdr/init/prompt.js +106 -108
- package/scripts/csdr/init/repos.js +3 -3
- package/scripts/csdr/install/common.js +65 -67
- package/scripts/csdr/install/projects.js +41 -64
- package/scripts/csdr/metadata/app.js +100 -108
- package/scripts/csdr/release/app/release-app-group.js +350 -0
- package/scripts/csdr/release/app/release-app.js +284 -319
- package/scripts/csdr/version/app.js +2 -4
- package/scripts/index.js +9 -0
- package/scripts/utils/build/app/build-app-utils.js +62 -37
|
@@ -12,10 +12,7 @@ const metadataUtils = require('../../metadata/metadata-utils');
|
|
|
12
12
|
const versionUtils = require('../../version/version-utils');
|
|
13
13
|
const configUtils = require('../../config/config-utils');
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
15
|
module.exports.run = () => {
|
|
18
|
-
|
|
19
16
|
// current projects
|
|
20
17
|
const project = configUtils.projects.getProject();
|
|
21
18
|
|
|
@@ -23,13 +20,13 @@ module.exports.run = () => {
|
|
|
23
20
|
var { branch, dryRun, envTarget, compositeType, configEnvTarget } = utils.tools.getArgs();
|
|
24
21
|
|
|
25
22
|
// checking branch and envTarget types
|
|
26
|
-
if (branch && typeof
|
|
23
|
+
if (branch && typeof branch === 'boolean') {
|
|
27
24
|
branch = null;
|
|
28
25
|
}
|
|
29
|
-
if (envTarget && typeof
|
|
26
|
+
if (envTarget && typeof envTarget === 'boolean') {
|
|
30
27
|
envTarget = null;
|
|
31
28
|
}
|
|
32
|
-
if (configEnvTarget && typeof
|
|
29
|
+
if (configEnvTarget && typeof configEnvTarget === 'boolean') {
|
|
33
30
|
configEnvTarget = null;
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -45,9 +42,9 @@ module.exports.run = () => {
|
|
|
45
42
|
var isSnapshot;
|
|
46
43
|
|
|
47
44
|
if (branch) {
|
|
48
|
-
isSupportSnapshotBranch =
|
|
49
|
-
isSupportBranch =
|
|
50
|
-
isSnapshot =
|
|
45
|
+
isSupportSnapshotBranch = branch !== 'master' && branch.indexOf('support/develop') > -1;
|
|
46
|
+
isSupportBranch = branch !== 'master' && !isSupportSnapshotBranch && branch.indexOf('support/') > -1;
|
|
47
|
+
isSnapshot = branch !== 'master' && !isSupportBranch;
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
// Backward compatibiity with Release process v1
|
|
@@ -64,12 +61,12 @@ module.exports.run = () => {
|
|
|
64
61
|
if (isSnapshot || isSupportSnapshotBranch) {
|
|
65
62
|
envTargetGen = 'DEV';
|
|
66
63
|
} else {
|
|
67
|
-
envTargetGen = '
|
|
64
|
+
envTargetGen = 'PROD';
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
// Initialize composite type
|
|
72
|
-
if (compositeType && typeof
|
|
69
|
+
if (compositeType && typeof compositeType === 'boolean') {
|
|
73
70
|
compositeType = null;
|
|
74
71
|
}
|
|
75
72
|
|
|
@@ -80,345 +77,313 @@ module.exports.run = () => {
|
|
|
80
77
|
// Modules global declarations
|
|
81
78
|
var newVersion, packagesDeps;
|
|
82
79
|
|
|
83
|
-
|
|
84
80
|
// Starting the release process
|
|
85
|
-
return
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// *****************************************************************
|
|
91
|
-
// RELEASE PACKAGE START
|
|
92
|
-
// *****************************************************************
|
|
93
|
-
.then(() => {
|
|
94
|
-
|
|
95
|
-
// Starting the release flow
|
|
96
|
-
console.log('\n\n');
|
|
97
|
-
utils.tools.logTitle('-------------------------------------------------------------');
|
|
98
|
-
utils.tools.logTitle(`Releasing new version of application "${project.name}"`);
|
|
99
|
-
utils.tools.logTitle('-------------------------------------------------------------');
|
|
100
|
-
console.log(project);
|
|
81
|
+
return (
|
|
82
|
+
Promise.resolve()
|
|
83
|
+
.then(() => {
|
|
84
|
+
utils.tools.logVersion();
|
|
85
|
+
})
|
|
101
86
|
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// *****************************************************************
|
|
124
|
-
// GET AND CHECK DEVOPS CONFIG
|
|
125
|
-
// *****************************************************************
|
|
126
|
-
.then(() => {
|
|
127
|
-
// check if global flag is enabled, if not enabled, this will throw a GLOBAL_PIPELINE_DISABLED exception
|
|
128
|
-
return metadataUtils.common.isPipelineEnabled();
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// *****************************************************************
|
|
133
|
-
// FETCHING CURRENT PACKAGES & INSTALL
|
|
134
|
-
// *****************************************************************
|
|
135
|
-
.then(() => {
|
|
136
|
-
// installing the dependencies by composite definition, it's outputting the app package dependencies declared
|
|
137
|
-
// in the dependencies-composite.json file of the project, remapped with the composite declaration per env.
|
|
138
|
-
return installUtils.buildApp.install(project, envTargetGen, compositeType);
|
|
139
|
-
})
|
|
140
|
-
// saving current generated deps metadata for build version
|
|
141
|
-
.then((deps) => {
|
|
142
|
-
packagesDeps = deps;
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// *****************************************************************
|
|
147
|
-
// GETTING NEW VERSION
|
|
148
|
-
// develop|DEV => patch release / master|TST => minor release
|
|
149
|
-
// *****************************************************************
|
|
150
|
-
.then(() => {
|
|
151
|
-
utils.tools.logTitle('Getting app new version...');
|
|
152
|
-
|
|
153
|
-
return versionUtils.app.getNewVersion(project, (isSnapshot || isSupportSnapshotBranch), isSupportBranch, envTarget);
|
|
154
|
-
})
|
|
155
|
-
.then((version) => {
|
|
156
|
-
// set the new version found for later use
|
|
157
|
-
newVersion = version;
|
|
158
|
-
utils.tools.logSuccess('New version : ' + newVersion);
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// *****************************************************************
|
|
163
|
-
// UPDATE APP PACKAGE VERSION
|
|
164
|
-
// *****************************************************************
|
|
165
|
-
.then(() => {
|
|
166
|
-
// only if a envTarget has not been set (process v2)
|
|
167
|
-
// if envTarget based build, the base repo of app in that case is never updated
|
|
168
|
-
if (!envTarget) {
|
|
169
|
-
return versionUtils.app.updatePackageVersion(project, newVersion);
|
|
170
|
-
}
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
// *****************************************************************
|
|
175
|
-
// STORE APP METADATA - PACKAGE DEPS / BUILD INFOS
|
|
176
|
-
// *****************************************************************
|
|
177
|
-
.then(() => {
|
|
178
|
-
// storing project build metadata
|
|
179
|
-
return metadataUtils.app.storeMetadata(project, newVersion, packagesDeps, envTargetGen);
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// *****************************************************************
|
|
185
|
-
// STORE APP METADATA - PACKAGE DEPS / ENVIRONMENT RELATED
|
|
186
|
-
// *****************************************************************
|
|
187
|
-
.then(() => {
|
|
188
|
-
return metadataUtils.appEnvs.storeMetadata(project, newVersion, packagesDeps, envTargetGen);
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// *****************************************************************
|
|
194
|
-
// STORE APP METADATA - VERSIONS
|
|
195
|
-
// *****************************************************************
|
|
196
|
-
.then(() => {
|
|
197
|
-
return metadataUtils.appVersions.storeMetadata(project, newVersion, envTargetGen);
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
// *****************************************************************
|
|
203
|
-
// GENERATE MAJOR DIFF REPORT
|
|
204
|
-
// *****************************************************************
|
|
205
|
-
.then(() => {
|
|
206
|
-
// process v1 - diff report is generated on MASTER / TST release
|
|
207
|
-
if (!isSnapshot && !isSupportSnapshotBranch && !envTarget) {
|
|
208
|
-
return metadataUtils.appHistory.generateDiffReport(project, newVersion, isSupportBranch);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// process v2 - diff report is generated on TST and up
|
|
212
|
-
if (envTarget && envTarget !== 'DEV') {
|
|
213
|
-
return metadataUtils.appHistory.generateDiffReport(project, newVersion, isSupportBranch, envTarget);
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// *****************************************************************
|
|
220
|
-
// STORE APP HISTORY METADATA
|
|
221
|
-
// *****************************************************************
|
|
222
|
-
.then((diffMetadata) => {
|
|
223
|
-
if (diffMetadata) {
|
|
224
|
-
return Promise.resolve()
|
|
225
|
-
.then(() => {
|
|
226
|
-
return metadataUtils.appHistory.flattenDiffMetadata(diffMetadata);
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
.then((flatDiffMetadata) => {
|
|
230
|
-
return utils.notification.project.sendProjectDiffReportMessage(
|
|
231
|
-
project,
|
|
232
|
-
flatDiffMetadata
|
|
233
|
-
);
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
.then(() => {
|
|
237
|
-
// process v1
|
|
238
|
-
if (!isSnapshot && !envTarget) {
|
|
239
|
-
return metadataUtils.appHistory.storeMetadata(project, diffMetadata, newVersion);
|
|
240
|
-
}
|
|
87
|
+
// *****************************************************************
|
|
88
|
+
// RELEASE PACKAGE START
|
|
89
|
+
// *****************************************************************
|
|
90
|
+
.then(() => {
|
|
91
|
+
// Starting the release flow
|
|
92
|
+
console.log('\n\n');
|
|
93
|
+
utils.tools.logTitle('-------------------------------------------------------------');
|
|
94
|
+
utils.tools.logTitle(`Releasing new version of application "${project.name}"`);
|
|
95
|
+
utils.tools.logTitle('-------------------------------------------------------------');
|
|
96
|
+
console.log(project);
|
|
97
|
+
|
|
98
|
+
// start mailStack
|
|
99
|
+
utils.notification.messageStack.startStack();
|
|
100
|
+
|
|
101
|
+
return utils.notification.project.sendProjectMessage({
|
|
102
|
+
project: project,
|
|
103
|
+
text: `:arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: Launching *${project.name}* release for *${envTargetGen}* environment - composite type: *${compositeType}`,
|
|
104
|
+
});
|
|
105
|
+
})
|
|
241
106
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return metadataUtils.app.storeMetadataAssets(project, newVersion, packagesDeps, historyMetadata, envTargetGen);
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// *****************************************************************
|
|
261
|
-
// BUILD ANGULAR APPLICATION
|
|
262
|
-
// *****************************************************************
|
|
263
|
-
.then(() => {
|
|
264
|
-
return utils.buildApp.angular(envTarget, (isSnapshot || isSupportSnapshotBranch), newVersion, configEnvTarget);
|
|
265
|
-
})
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// *****************************************************************
|
|
269
|
-
// BUILD MAVEN ARTIFACT - OPTIONAL
|
|
270
|
-
// *****************************************************************
|
|
271
|
-
.then(() => {
|
|
272
|
-
if (project.build && project.build.maven) {
|
|
273
|
-
return utils.buildApp.maven();
|
|
274
|
-
}
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// *****************************************************************
|
|
279
|
-
// POST BUILD
|
|
280
|
-
// *****************************************************************
|
|
281
|
-
.then(() => {
|
|
282
|
-
return utils.buildApp.postBuild(project);
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
// *****************************************************************
|
|
287
|
-
// DISTRIBUTION OPTIONAL STEP to dynamic S3 buckets
|
|
288
|
-
// *****************************************************************
|
|
289
|
-
.then(() => {
|
|
290
|
-
if (project.build && project.build.distribution) {
|
|
291
|
-
return Promise.resolve()
|
|
292
|
-
.then(() => {
|
|
293
|
-
return utils.buildApp.generateProjectDistributionFile(project, (isSnapshot || isSupportSnapshotBranch), envTarget);
|
|
294
|
-
})
|
|
295
|
-
.catch((e) => {
|
|
296
|
-
throw e;
|
|
297
|
-
})
|
|
298
|
-
}
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
// *****************************************************************
|
|
304
|
-
// COMMIT AND PUSH UPDATED FILES
|
|
305
|
-
// *****************************************************************
|
|
306
|
-
.then(() => {
|
|
307
|
-
// for env-target based build, the app repo is always untouched, as all is metadata driven outside of the app sources
|
|
308
|
-
if (!envTarget) {
|
|
309
|
-
let message;
|
|
310
|
-
if (isSnapshot) {
|
|
311
|
-
message = `chore(pre-release): pre-release v${newVersion} - from CI server`;
|
|
312
|
-
} else {
|
|
313
|
-
message = `chore(release): release v${newVersion} - from CI server`;
|
|
314
|
-
}
|
|
315
|
-
const projectFolder = path.join(process.cwd(), project.folder);
|
|
316
|
-
return utils.git.commitAndPush(branch, message, projectFolder);
|
|
317
|
-
}
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
// *****************************************************************
|
|
322
|
-
// RELEASE TAG ON MASTER
|
|
323
|
-
// *****************************************************************
|
|
324
|
-
.then(() => {
|
|
325
|
-
|
|
326
|
-
// for env-target based builds, release is not tagged as app repo is not containing sources, neither version info
|
|
327
|
-
if (!envTarget) {
|
|
328
|
-
if (!isSnapshot) {
|
|
329
|
-
return utils.git.tagVersion(
|
|
330
|
-
newVersion, branch,
|
|
331
|
-
`chore(release): release v${newVersion} - from CI server`,
|
|
332
|
-
project.folder,
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
107
|
+
// *****************************************************************
|
|
108
|
+
// CLONE METADATA REPO
|
|
109
|
+
// *****************************************************************
|
|
110
|
+
.then(() => {
|
|
111
|
+
return metadataUtils.common.cloneMetadataRepo();
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// *****************************************************************
|
|
115
|
+
// GET AND CHECK DEVOPS CONFIG
|
|
116
|
+
// *****************************************************************
|
|
117
|
+
.then(() => {
|
|
118
|
+
// check if global flag is enabled, if not enabled, this will throw a GLOBAL_PIPELINE_DISABLED exception
|
|
119
|
+
return metadataUtils.common.isPipelineEnabled();
|
|
120
|
+
})
|
|
336
121
|
|
|
337
|
-
|
|
122
|
+
// *****************************************************************
|
|
123
|
+
// FETCHING CURRENT PACKAGES & INSTALL
|
|
124
|
+
// *****************************************************************
|
|
125
|
+
.then(() => {
|
|
126
|
+
// installing the dependencies by composite definition, it's outputting the app package dependencies declared
|
|
127
|
+
// in the dependencies-composite.json file of the project, remapped with the composite declaration per env.
|
|
128
|
+
return installUtils.buildApp.install(project, envTargetGen, compositeType);
|
|
129
|
+
})
|
|
130
|
+
// saving current generated deps metadata for build version
|
|
131
|
+
.then((deps) => {
|
|
132
|
+
packagesDeps = deps;
|
|
133
|
+
})
|
|
338
134
|
|
|
135
|
+
// *****************************************************************
|
|
136
|
+
// GETTING NEW VERSION
|
|
137
|
+
// develop|DEV => patch release / master|TST => minor release
|
|
138
|
+
// *****************************************************************
|
|
139
|
+
.then(() => {
|
|
140
|
+
utils.tools.logTitle('Getting app new version...');
|
|
339
141
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (project.build && !project.build.masterBranchOnly) {
|
|
348
|
-
return utils.git.mergeMasterToDevelop(project, project.folder);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
142
|
+
return versionUtils.app.getNewVersion(project, isSnapshot || isSupportSnapshotBranch, isSupportBranch, envTarget);
|
|
143
|
+
})
|
|
144
|
+
.then((version) => {
|
|
145
|
+
// set the new version found for later use
|
|
146
|
+
newVersion = version;
|
|
147
|
+
utils.tools.logSuccess('New version : ' + newVersion);
|
|
148
|
+
})
|
|
351
149
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
150
|
+
// *****************************************************************
|
|
151
|
+
// UPDATE APP PACKAGE VERSION
|
|
152
|
+
// *****************************************************************
|
|
153
|
+
.then(() => {
|
|
154
|
+
// only if a envTarget has not been set (process v2)
|
|
155
|
+
// if envTarget based build, the base repo of app in that case is never updated
|
|
156
|
+
if (!envTarget) {
|
|
157
|
+
return versionUtils.app.updatePackageVersion(project, newVersion);
|
|
355
158
|
}
|
|
356
|
-
}
|
|
357
|
-
})
|
|
358
|
-
|
|
159
|
+
})
|
|
359
160
|
|
|
161
|
+
// *****************************************************************
|
|
162
|
+
// STORE APP METADATA - PACKAGE DEPS / BUILD INFOS
|
|
163
|
+
// *****************************************************************
|
|
164
|
+
.then(() => {
|
|
165
|
+
// storing project build metadata
|
|
166
|
+
return metadataUtils.app.storeMetadata(project, newVersion, packagesDeps, envTargetGen);
|
|
167
|
+
})
|
|
360
168
|
|
|
169
|
+
// *****************************************************************
|
|
170
|
+
// STORE APP METADATA - PACKAGE DEPS / ENVIRONMENT RELATED
|
|
171
|
+
// *****************************************************************
|
|
172
|
+
.then(() => {
|
|
173
|
+
return metadataUtils.appEnvs.storeMetadata(project, newVersion, packagesDeps, envTargetGen);
|
|
174
|
+
})
|
|
361
175
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
176
|
+
// *****************************************************************
|
|
177
|
+
// STORE APP METADATA - VERSIONS
|
|
178
|
+
// *****************************************************************
|
|
179
|
+
.then(() => {
|
|
180
|
+
return metadataUtils.appVersions.storeMetadata(project, newVersion, envTargetGen);
|
|
181
|
+
})
|
|
368
182
|
|
|
369
|
-
|
|
370
|
-
|
|
183
|
+
// *****************************************************************
|
|
184
|
+
// GENERATE MAJOR DIFF REPORT
|
|
185
|
+
// *****************************************************************
|
|
186
|
+
.then(() => {
|
|
187
|
+
// process v1 - diff report is generated on MASTER / TST release
|
|
188
|
+
if (!isSnapshot && !isSupportSnapshotBranch && !envTarget) {
|
|
189
|
+
return metadataUtils.appHistory.generateDiffReport(project, newVersion, isSupportBranch);
|
|
190
|
+
}
|
|
371
191
|
|
|
192
|
+
// process v2 - diff report is generated on TST and up
|
|
193
|
+
if (envTarget && envTarget !== 'DEV') {
|
|
194
|
+
return metadataUtils.appHistory.generateDiffReport(project, newVersion, isSupportBranch, envTarget);
|
|
195
|
+
}
|
|
196
|
+
})
|
|
372
197
|
|
|
198
|
+
// *****************************************************************
|
|
199
|
+
// STORE APP HISTORY METADATA
|
|
200
|
+
// *****************************************************************
|
|
201
|
+
.then((diffMetadata) => {
|
|
202
|
+
if (diffMetadata) {
|
|
203
|
+
return Promise.resolve()
|
|
204
|
+
.then(() => {
|
|
205
|
+
return metadataUtils.appHistory.flattenDiffMetadata(diffMetadata);
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
.then((flatDiffMetadata) => {
|
|
209
|
+
return utils.notification.project.sendProjectDiffReportMessage(project, flatDiffMetadata);
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
.then(() => {
|
|
213
|
+
// process v1
|
|
214
|
+
if (!isSnapshot && !envTarget) {
|
|
215
|
+
return metadataUtils.appHistory.storeMetadata(project, diffMetadata, newVersion);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// process v2
|
|
219
|
+
if (envTarget && envTarget !== 'DEV') {
|
|
220
|
+
return metadataUtils.appHistory.storeMetadata(project, diffMetadata, newVersion, envTarget);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
})
|
|
373
225
|
|
|
226
|
+
// *****************************************************************
|
|
227
|
+
// STORE APP ASSETS METADATA
|
|
228
|
+
// *****************************************************************
|
|
229
|
+
.then((historyMetadata) => {
|
|
230
|
+
return metadataUtils.app.storeMetadataAssets(project, newVersion, packagesDeps, historyMetadata, envTargetGen);
|
|
231
|
+
})
|
|
374
232
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
233
|
+
// *****************************************************************
|
|
234
|
+
// BUILD ANGULAR APPLICATION
|
|
235
|
+
// *****************************************************************
|
|
236
|
+
.then(() => {
|
|
237
|
+
return utils.buildApp.angular({
|
|
238
|
+
envTarget: envTarget,
|
|
239
|
+
isSnapshot: isSnapshot || isSupportSnapshotBranch,
|
|
240
|
+
version: newVersion,
|
|
241
|
+
configEnvTargetin: configEnvTarget,
|
|
242
|
+
});
|
|
384
243
|
})
|
|
385
244
|
|
|
386
|
-
//
|
|
245
|
+
// *****************************************************************
|
|
246
|
+
// BUILD MAVEN ARTIFACT - OPTIONAL
|
|
247
|
+
// *****************************************************************
|
|
387
248
|
.then(() => {
|
|
388
|
-
|
|
249
|
+
if (project.build && project.build.maven) {
|
|
250
|
+
return utils.buildApp.maven();
|
|
251
|
+
}
|
|
389
252
|
})
|
|
390
253
|
|
|
254
|
+
// *****************************************************************
|
|
255
|
+
// POST BUILD
|
|
256
|
+
// *****************************************************************
|
|
391
257
|
.then(() => {
|
|
392
|
-
utils.
|
|
258
|
+
return utils.buildApp.postBuild(project);
|
|
393
259
|
})
|
|
394
|
-
})
|
|
395
260
|
|
|
261
|
+
// *****************************************************************
|
|
262
|
+
// DISTRIBUTION OPTIONAL STEP to dynamic S3 buckets
|
|
263
|
+
// *****************************************************************
|
|
264
|
+
.then(() => {
|
|
265
|
+
if (project.build && project.build.distribution) {
|
|
266
|
+
return Promise.resolve()
|
|
267
|
+
.then(() => {
|
|
268
|
+
return utils.buildApp.generateProjectDistributionFile(project, isSnapshot || isSupportSnapshotBranch, envTarget);
|
|
269
|
+
})
|
|
270
|
+
.catch((e) => {
|
|
271
|
+
throw e;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
})
|
|
396
275
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
276
|
+
// *****************************************************************
|
|
277
|
+
// COMMIT AND PUSH UPDATED FILES
|
|
278
|
+
// *****************************************************************
|
|
279
|
+
.then(() => {
|
|
280
|
+
// for env-target based build, the app repo is always untouched, as all is metadata driven outside of the app sources
|
|
281
|
+
if (!envTarget) {
|
|
282
|
+
let message;
|
|
283
|
+
if (isSnapshot) {
|
|
284
|
+
message = `chore(pre-release): pre-release v${newVersion} - from CI server`;
|
|
285
|
+
} else {
|
|
286
|
+
message = `chore(release): release v${newVersion} - from CI server`;
|
|
287
|
+
}
|
|
288
|
+
const projectFolder = path.join(process.cwd(), project.folder);
|
|
289
|
+
return utils.git.commitAndPush(branch, message, projectFolder);
|
|
290
|
+
}
|
|
291
|
+
})
|
|
403
292
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
293
|
+
// *****************************************************************
|
|
294
|
+
// RELEASE TAG ON MASTER
|
|
295
|
+
// *****************************************************************
|
|
296
|
+
.then(() => {
|
|
297
|
+
// for env-target based builds, release is not tagged as app repo is not containing sources, neither version info
|
|
298
|
+
if (!envTarget) {
|
|
299
|
+
if (!isSnapshot) {
|
|
300
|
+
return utils.git.tagVersion(newVersion, branch, `chore(release): release v${newVersion} - from CI server`, project.folder);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
409
303
|
})
|
|
410
304
|
|
|
411
|
-
//
|
|
305
|
+
// *****************************************************************
|
|
306
|
+
// MERGE BACK ON DEVELOP for MASTER and SUPPORT
|
|
307
|
+
// *****************************************************************
|
|
412
308
|
.then(() => {
|
|
413
|
-
|
|
309
|
+
// for env-target based builds, no need to merge anything back as it only contains a master branch for sources
|
|
310
|
+
if (!envTarget) {
|
|
311
|
+
if (!isSnapshot && !isSupportBranch && !isSupportSnapshotBranch) {
|
|
312
|
+
if (project.build && !project.build.masterBranchOnly) {
|
|
313
|
+
return utils.git.mergeMasterToDevelop(project, project.folder);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (isSupportBranch && project.build && project.build.supportSnapshotBranch) {
|
|
318
|
+
utils.tools.logInfo('Branch is support / supportSnapshotBranch config detected');
|
|
319
|
+
return utils.git.mergeSupportToSupportDevelop(project, project.folder, branch, project.build.supportSnapshotBranch);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
414
322
|
})
|
|
323
|
+
|
|
324
|
+
// *****************************************************************
|
|
325
|
+
// COMMIT AND PUSH METADATA
|
|
326
|
+
// *****************************************************************
|
|
415
327
|
.then(() => {
|
|
416
|
-
|
|
417
|
-
|
|
328
|
+
const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
|
|
329
|
+
const message = `chore: update metadata for ${project.name}-${newVersion}`;
|
|
330
|
+
|
|
331
|
+
return utils.git.commitAndPush('master', message, DEVOPS_METADATA_PATH);
|
|
418
332
|
})
|
|
419
333
|
|
|
334
|
+
// *****************************************************************
|
|
335
|
+
// SEND SLACK SUCCESS
|
|
336
|
+
// *****************************************************************
|
|
420
337
|
.then(() => {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
338
|
+
return (
|
|
339
|
+
utils.notification.project
|
|
340
|
+
.sendProjectMessage({
|
|
341
|
+
project: project,
|
|
342
|
+
version: newVersion,
|
|
343
|
+
title: '[APPLICATION BUILD SUCCESS]',
|
|
344
|
+
subtitle: 'Successful build of the application! :)',
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
// store package config in the root folder to send config to gitlab
|
|
348
|
+
.then(() => {
|
|
349
|
+
return utils.notification.config.storeProjectConfig(project);
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
.then(() => {
|
|
353
|
+
utils.notification.messageStack.endStack();
|
|
354
|
+
})
|
|
355
|
+
);
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
// *****************************************************************
|
|
359
|
+
// SEND SLACK ERROR
|
|
360
|
+
// *****************************************************************
|
|
361
|
+
.catch((e) => {
|
|
362
|
+
utils.tools.logError(`ERROR!!!! - ${e.message}`);
|
|
363
|
+
console.log(e);
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
utils.notification.project
|
|
367
|
+
.sendProjectMessage({
|
|
368
|
+
project: project,
|
|
369
|
+
exception: e,
|
|
370
|
+
title: '[APPLICATION BUILD FAILED]',
|
|
371
|
+
subtitle: 'Error building the App container application! :(',
|
|
372
|
+
})
|
|
373
|
+
|
|
374
|
+
// store package config in the root folder to send config to gitlab
|
|
375
|
+
.then(() => {
|
|
376
|
+
return utils.notification.config.storeProjectConfig(project);
|
|
377
|
+
})
|
|
378
|
+
.then(() => {
|
|
379
|
+
utils.notification.messageStack.endStack();
|
|
380
|
+
return utils.notification.messageStack.sendProjectMessage(project);
|
|
381
|
+
})
|
|
382
|
+
|
|
383
|
+
.then(() => {
|
|
384
|
+
process.exit(1);
|
|
385
|
+
})
|
|
386
|
+
);
|
|
387
|
+
})
|
|
388
|
+
);
|
|
389
|
+
};
|