@clickview/ship-it 0.0.27 → 0.0.29-dev.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/lib/src/api-clients/git-lab/GitLabApiClient.js +20 -1
- package/lib/src/api-clients/git-lab/GitLabMapper.js +1 -0
- package/lib/src/commands/BumpPackagesCommand.js +1 -3
- package/lib/src/commands/CreateReleaseNotesCommand.js +12 -1
- package/lib/src/constants/ProjectNames.js +1 -0
- package/lib/src/constants/TeamCityBuildIDs.js +1 -0
- package/lib/src/services/GitLabService.js +10 -3
- package/lib/src/startup/SetupCommands.js +3 -0
- package/lib/src/tasks/StartProjectBuildsTask.js +38 -17
- package/lib/src/tasks/ValidateTask.js +105 -30
- package/package.json +1 -1
|
@@ -359,7 +359,7 @@ var GitLabApiClient = /** @class */ (function () {
|
|
|
359
359
|
});
|
|
360
360
|
});
|
|
361
361
|
};
|
|
362
|
-
GitLabApiClient.prototype.getMilestone = function (
|
|
362
|
+
GitLabApiClient.prototype.getMilestone = function (milestoneName, projectId) {
|
|
363
363
|
return __awaiter(this, void 0, void 0, function () {
|
|
364
364
|
var groupMilestones, milestone, projectMilestones;
|
|
365
365
|
return __generator(this, function (_a) {
|
|
@@ -370,6 +370,8 @@ var GitLabApiClient = /** @class */ (function () {
|
|
|
370
370
|
milestone = groupMilestones.find(function (milestone) { return milestone.title === milestoneName; });
|
|
371
371
|
if (milestone)
|
|
372
372
|
return [2 /*return*/, GitLabMapper_1.GitLabMapper.milestone(milestone)];
|
|
373
|
+
if (!projectId)
|
|
374
|
+
return [2 /*return*/, null];
|
|
373
375
|
return [4 /*yield*/, this.client.ProjectMilestones.all(projectId)];
|
|
374
376
|
case 2:
|
|
375
377
|
projectMilestones = _a.sent();
|
|
@@ -381,6 +383,23 @@ var GitLabApiClient = /** @class */ (function () {
|
|
|
381
383
|
});
|
|
382
384
|
});
|
|
383
385
|
};
|
|
386
|
+
GitLabApiClient.prototype.updateMilestone = function (projectId, mergeRequestId, newMilestoneId) {
|
|
387
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
388
|
+
var updated;
|
|
389
|
+
return __generator(this, function (_a) {
|
|
390
|
+
switch (_a.label) {
|
|
391
|
+
case 0: return [4 /*yield*/, this.client.MergeRequests.edit(projectId, mergeRequestId, {
|
|
392
|
+
milestoneId: newMilestoneId,
|
|
393
|
+
})];
|
|
394
|
+
case 1:
|
|
395
|
+
updated = _a.sent();
|
|
396
|
+
if (!updated)
|
|
397
|
+
return [2 /*return*/, null];
|
|
398
|
+
return [2 /*return*/, GitLabMapper_1.GitLabMapper.milestone(updated.milestone)];
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
};
|
|
384
403
|
GitLabApiClient.prototype.getLabels = function (projectId) {
|
|
385
404
|
return __awaiter(this, void 0, void 0, function () {
|
|
386
405
|
var labels;
|
|
@@ -65,9 +65,7 @@ var BumpPackagesCommand = /** @class */ (function () {
|
|
|
65
65
|
case 0: return [4 /*yield*/, this.bumpPackagesTask.run(options)];
|
|
66
66
|
case 1:
|
|
67
67
|
cont = _a.sent();
|
|
68
|
-
|
|
69
|
-
return [2 /*return*/, false];
|
|
70
|
-
return [4 /*yield*/, this.commitPackageVersionsTask.run(options)];
|
|
68
|
+
return [2 /*return*/, cont];
|
|
71
69
|
case 2: return [2 /*return*/, _a.sent()];
|
|
72
70
|
}
|
|
73
71
|
});
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
14
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
15
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -62,7 +73,7 @@ var CreateReleaseNotesCommand = /** @class */ (function () {
|
|
|
62
73
|
var cont;
|
|
63
74
|
return __generator(this, function (_a) {
|
|
64
75
|
switch (_a.label) {
|
|
65
|
-
case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
|
|
76
|
+
case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { slackNotifier: false }))];
|
|
66
77
|
case 1:
|
|
67
78
|
cont = _a.sent();
|
|
68
79
|
if (!cont)
|
|
@@ -41,4 +41,5 @@ exports.TeamCityBuildIds = (_a = {},
|
|
|
41
41
|
_a[constants_1.PROJECT_NAMES.backend.tvweb] = 'tv_web_BuildAndPackageDocker',
|
|
42
42
|
_a[constants_1.PROJECT_NAMES.backend.clients] = 'Tooling_Clients_PublishToNuget',
|
|
43
43
|
_a[constants_1.PROJECT_NAMES.backend.goodstuff] = 'Tooling_GoodStuffInternal_PublishToNuget',
|
|
44
|
+
_a[constants_1.PROJECT_NAMES.backend.share] = 'Api_ShareApi_BuildAndPackageDocker',
|
|
44
45
|
_a);
|
|
@@ -269,7 +269,7 @@ var GitLabService = /** @class */ (function () {
|
|
|
269
269
|
var milestone;
|
|
270
270
|
return __generator(this, function (_a) {
|
|
271
271
|
switch (_a.label) {
|
|
272
|
-
case 0: return [4 /*yield*/, this.getMilestone(
|
|
272
|
+
case 0: return [4 /*yield*/, this.getMilestone(milestoneName, projectId)];
|
|
273
273
|
case 1:
|
|
274
274
|
milestone = _a.sent();
|
|
275
275
|
return [2 /*return*/, this.apiClient.createMergeRequest(projectId, branchName, 'master', branchName, description, milestone)];
|
|
@@ -277,8 +277,8 @@ var GitLabService = /** @class */ (function () {
|
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
};
|
|
280
|
-
GitLabService.prototype.getMilestone = function (
|
|
281
|
-
return this.apiClient.getMilestone(
|
|
280
|
+
GitLabService.prototype.getMilestone = function (milestoneName, projectId) {
|
|
281
|
+
return this.apiClient.getMilestone(milestoneName, projectId);
|
|
282
282
|
};
|
|
283
283
|
GitLabService.prototype.getReleaseBranchNameMilestone = function (projectId, milestone) {
|
|
284
284
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -488,6 +488,13 @@ var GitLabService = /** @class */ (function () {
|
|
|
488
488
|
});
|
|
489
489
|
});
|
|
490
490
|
};
|
|
491
|
+
GitLabService.prototype.updateMilestone = function (projectId, mergeRequestID, newMilestoneId) {
|
|
492
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
+
return __generator(this, function (_a) {
|
|
494
|
+
return [2 /*return*/, this.apiClient.updateMilestone(projectId, mergeRequestID, newMilestoneId)];
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
};
|
|
491
498
|
GitLabService = __decorate([
|
|
492
499
|
(0, inversify_1.injectable)(),
|
|
493
500
|
__param(0, (0, inversify_1.inject)(types_1.API_CLIENTS.GitLabApiClient)),
|
|
@@ -94,9 +94,11 @@ function setupCommands(program, container) {
|
|
|
94
94
|
.requiredOption('-m, --milestone <milestone>')
|
|
95
95
|
.option('-p, --projectIds <projectIds...>')
|
|
96
96
|
.option('-o, --omit <omittedProjectIds...>')
|
|
97
|
+
.option('-nm, --nextMilestone <nextMilestone>')
|
|
97
98
|
.option('--hotfix')
|
|
98
99
|
.option('--major')
|
|
99
100
|
.option('--trigger-monorepo-build')
|
|
101
|
+
.option('--slack-notifier')
|
|
100
102
|
.action(function (opts) { return __awaiter(_this, void 0, void 0, function () {
|
|
101
103
|
var options;
|
|
102
104
|
return __generator(this, function (_a) {
|
|
@@ -146,6 +148,7 @@ function setupCommands(program, container) {
|
|
|
146
148
|
.option('--monorepoBranchName <monorepoBranchName>')
|
|
147
149
|
.option('-p, --projectIds <projectIds...>')
|
|
148
150
|
.option('-o, --omit <omittedProjectIds...>')
|
|
151
|
+
.option('-t, --targetBranchName <targetBranchName>')
|
|
149
152
|
.action(function (opts) { return __awaiter(_this, void 0, void 0, function () {
|
|
150
153
|
var options;
|
|
151
154
|
return __generator(this, function (_a) {
|
|
@@ -62,23 +62,44 @@ var StartProjectBuildsTask = /** @class */ (function () {
|
|
|
62
62
|
}
|
|
63
63
|
StartProjectBuildsTask.prototype.run = function (_options) {
|
|
64
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var milestone, options, projects, consumingProjects, projectBuildMap, _i, consumingProjects_1, project, branchName, buildId, build, totalBuilds, project;
|
|
65
|
+
var projectName, project, buildId, build, milestone, options, projects, consumingProjects, projectBuildMap, _i, consumingProjects_1, project, branchName, buildId, build, totalBuilds, project;
|
|
66
66
|
return __generator(this, function (_a) {
|
|
67
67
|
switch (_a.label) {
|
|
68
68
|
case 0:
|
|
69
69
|
utils_1.Logger.logTask('Starting builds for consuming projects in TeamCity');
|
|
70
|
+
if (!(_options.targetBranchName && _options.projectIds)) return [3 /*break*/, 3];
|
|
71
|
+
utils_1.Logger.logMessage("Starting consuming project build for given target branch ".concat(_options.targetBranchName));
|
|
72
|
+
if (_options.projectIds.length > 1) {
|
|
73
|
+
utils_1.Logger.logError("More than one project found!");
|
|
74
|
+
return [2 /*return*/, false];
|
|
75
|
+
}
|
|
76
|
+
projectName = _options.projectIds[0];
|
|
77
|
+
return [4 /*yield*/, this.gitLabService.getProject(projectName)];
|
|
78
|
+
case 1:
|
|
79
|
+
project = _a.sent();
|
|
80
|
+
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id];
|
|
81
|
+
if (!buildId) {
|
|
82
|
+
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
83
|
+
return [2 /*return*/, false];
|
|
84
|
+
}
|
|
85
|
+
return [4 /*yield*/, this.teamCityService.startBuild(buildId, _options.targetBranchName)];
|
|
86
|
+
case 2:
|
|
87
|
+
build = _a.sent();
|
|
88
|
+
utils_1.Logger.logInfo("[".concat(project.title, "]: ").concat(build.webUrl));
|
|
89
|
+
return [2 /*return*/, true];
|
|
90
|
+
case 3:
|
|
70
91
|
if (!_options.monorepoBranchName && !_options.milestone) {
|
|
71
92
|
utils_1.Logger.logError('Please provide either a milestone or branch name argument.');
|
|
72
93
|
return [2 /*return*/, false];
|
|
73
94
|
}
|
|
74
95
|
milestone = _options.milestone;
|
|
75
|
-
if (!!milestone) return [3 /*break*/,
|
|
96
|
+
if (!!milestone) return [3 /*break*/, 5];
|
|
76
97
|
utils_1.Logger.logInfo("Searching for a merge request in project \"monorepo\" with branch name \"".concat(_options.monorepoBranchName, "\"..."));
|
|
77
98
|
return [4 /*yield*/, this.gitLabService.getMilestoneByBranchName(utils_1.ProjectIds.MONOREPO_PROJECT_ID, _options.monorepoBranchName)];
|
|
78
|
-
case
|
|
99
|
+
case 4:
|
|
79
100
|
milestone = _a.sent();
|
|
80
|
-
_a.label =
|
|
81
|
-
case
|
|
101
|
+
_a.label = 5;
|
|
102
|
+
case 5:
|
|
82
103
|
if (!milestone)
|
|
83
104
|
return [2 /*return*/, false];
|
|
84
105
|
utils_1.Logger.logInfo("Found milestone \"".concat(milestone, "\". Proceeding to run builds for consuming projects..."));
|
|
@@ -89,7 +110,7 @@ var StartProjectBuildsTask = /** @class */ (function () {
|
|
|
89
110
|
milestone: milestone
|
|
90
111
|
};
|
|
91
112
|
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
92
|
-
case
|
|
113
|
+
case 6:
|
|
93
114
|
projects = _a.sent();
|
|
94
115
|
consumingProjects = projects.filter(function (p) { return p.id.toString() !== utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
95
116
|
if (!consumingProjects.length) {
|
|
@@ -98,31 +119,31 @@ var StartProjectBuildsTask = /** @class */ (function () {
|
|
|
98
119
|
}
|
|
99
120
|
projectBuildMap = {};
|
|
100
121
|
_i = 0, consumingProjects_1 = consumingProjects;
|
|
101
|
-
_a.label =
|
|
102
|
-
case
|
|
103
|
-
if (!(_i < consumingProjects_1.length)) return [3 /*break*/,
|
|
122
|
+
_a.label = 7;
|
|
123
|
+
case 7:
|
|
124
|
+
if (!(_i < consumingProjects_1.length)) return [3 /*break*/, 11];
|
|
104
125
|
project = consumingProjects_1[_i];
|
|
105
126
|
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(project.id, options.milestone)];
|
|
106
|
-
case
|
|
127
|
+
case 8:
|
|
107
128
|
branchName = _a.sent();
|
|
108
129
|
if (!branchName) {
|
|
109
130
|
utils_1.Logger.logWarning("Release branch in project \"".concat(project.title, "\" with milestone \"").concat(options.milestone, "\" was not found. Skipping project..."));
|
|
110
|
-
return [3 /*break*/,
|
|
131
|
+
return [3 /*break*/, 10];
|
|
111
132
|
}
|
|
112
133
|
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id.toString()];
|
|
113
134
|
if (!buildId) {
|
|
114
135
|
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
115
|
-
return [3 /*break*/,
|
|
136
|
+
return [3 /*break*/, 10];
|
|
116
137
|
}
|
|
117
138
|
return [4 /*yield*/, this.teamCityService.startBuild(buildId, branchName)];
|
|
118
|
-
case
|
|
139
|
+
case 9:
|
|
119
140
|
build = _a.sent();
|
|
120
141
|
projectBuildMap[project.title] = build;
|
|
121
|
-
_a.label =
|
|
122
|
-
case
|
|
142
|
+
_a.label = 10;
|
|
143
|
+
case 10:
|
|
123
144
|
_i++;
|
|
124
|
-
return [3 /*break*/,
|
|
125
|
-
case
|
|
145
|
+
return [3 /*break*/, 7];
|
|
146
|
+
case 11:
|
|
126
147
|
totalBuilds = Object.keys(projectBuildMap).length;
|
|
127
148
|
if (!totalBuilds) {
|
|
128
149
|
utils_1.Logger.logWarning("No releases found in consuming projects with milestone \"".concat(options.milestone, "\"."));
|
|
@@ -71,12 +71,14 @@ var services_1 = require("../services");
|
|
|
71
71
|
var utils_1 = require("../utils");
|
|
72
72
|
var ValidateTask = /** @class */ (function () {
|
|
73
73
|
function ValidateTask(gitLabService, slackService) {
|
|
74
|
+
// Flag to confirm that all Merge requests have been rolled over
|
|
75
|
+
this.rollOverAllMrs = true;
|
|
74
76
|
this.gitLabService = gitLabService;
|
|
75
77
|
this.slackService = slackService;
|
|
76
78
|
}
|
|
77
79
|
ValidateTask.prototype.run = function (options) {
|
|
78
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var projects, cont, _loop_1, this_1, _i, projects_1, project, threadLabel, statusCleanMessage;
|
|
81
|
+
var projects, cont, allCorrectTargetMrs, _loop_1, this_1, _i, projects_1, project, nextMilestone, threadLabel, statusCleanMessage;
|
|
80
82
|
return __generator(this, function (_a) {
|
|
81
83
|
switch (_a.label) {
|
|
82
84
|
case 0:
|
|
@@ -86,6 +88,7 @@ var ValidateTask = /** @class */ (function () {
|
|
|
86
88
|
projects = _a.sent();
|
|
87
89
|
utils_1.Logger.logMessage("Found ".concat(projects.length, " projects that need to be released"));
|
|
88
90
|
cont = true;
|
|
91
|
+
allCorrectTargetMrs = true;
|
|
89
92
|
_loop_1 = function (project) {
|
|
90
93
|
var hasSomeTags, groupedMRs, count, ready, wrongTargetMrs, nextVersion, message_1, issues;
|
|
91
94
|
return __generator(this, function (_b) {
|
|
@@ -102,8 +105,10 @@ var ValidateTask = /** @class */ (function () {
|
|
|
102
105
|
return [4 /*yield*/, this_1.getMRsTargetingWrongBranch(project, options.version)];
|
|
103
106
|
case 2:
|
|
104
107
|
wrongTargetMrs = _b.sent();
|
|
105
|
-
if (wrongTargetMrs.length)
|
|
108
|
+
if (wrongTargetMrs.length) {
|
|
106
109
|
ready = false;
|
|
110
|
+
allCorrectTargetMrs = false;
|
|
111
|
+
}
|
|
107
112
|
if (!ready)
|
|
108
113
|
cont = false;
|
|
109
114
|
if (!ready) return [3 /*break*/, 4];
|
|
@@ -144,16 +149,33 @@ var ValidateTask = /** @class */ (function () {
|
|
|
144
149
|
_i++;
|
|
145
150
|
return [3 /*break*/, 2];
|
|
146
151
|
case 5:
|
|
147
|
-
if (!!cont) return [3 /*break*/,
|
|
152
|
+
if (!!cont) return [3 /*break*/, 10];
|
|
148
153
|
utils_1.Logger.logError("\nThis release is NOT READY to go out, here are the outstanding MRs: \n");
|
|
149
|
-
|
|
154
|
+
nextMilestone = void 0;
|
|
155
|
+
if (!options.nextMilestone) return [3 /*break*/, 7];
|
|
156
|
+
return [4 /*yield*/, this.gitLabService.getMilestone(options.nextMilestone)];
|
|
150
157
|
case 6:
|
|
158
|
+
// No need for project ID to get milestone since it exists in ClickView Group
|
|
159
|
+
nextMilestone = _a.sent();
|
|
160
|
+
if (!nextMilestone) {
|
|
161
|
+
utils_1.Logger.logError("Invalid roll over milestone '".concat(options.nextMilestone, "'. Exiting!"));
|
|
162
|
+
return [2 /*return*/, false];
|
|
163
|
+
}
|
|
164
|
+
_a.label = 7;
|
|
165
|
+
case 7: return [4 /*yield*/, this.notReadyMrsLog(projects, options.version, options.milestone, options.slackNotifier, nextMilestone)];
|
|
166
|
+
case 8:
|
|
151
167
|
_a.sent();
|
|
152
|
-
return [4 /*yield*/, this.wrongTargetMrsLog(projects, options.version, options.milestone, options.slackNotifier)];
|
|
153
|
-
case
|
|
168
|
+
return [4 /*yield*/, this.wrongTargetMrsLog(projects, options.version, options.milestone, options.slackNotifier, nextMilestone)];
|
|
169
|
+
case 9:
|
|
154
170
|
_a.sent();
|
|
171
|
+
// Check that all MRs rolled over and all MRs targeting dev or release before creating release
|
|
172
|
+
if (options.nextMilestone && this.rollOverAllMrs && allCorrectTargetMrs) {
|
|
173
|
+
return [2 /*return*/, true];
|
|
174
|
+
}
|
|
175
|
+
if (!this.rollOverAllMrs)
|
|
176
|
+
utils_1.Logger.logError('Some or all MRs did not get successfully rolled over. Check logs to find out which ones');
|
|
155
177
|
return [2 /*return*/, false];
|
|
156
|
-
case
|
|
178
|
+
case 10:
|
|
157
179
|
if (!options.slackNotifier) {
|
|
158
180
|
utils_1.Logger.logMessage('\nRelease is ready to go out. Not sending any slack notifications.');
|
|
159
181
|
return [2 /*return*/, true];
|
|
@@ -170,7 +192,7 @@ var ValidateTask = /** @class */ (function () {
|
|
|
170
192
|
statusMessage: '',
|
|
171
193
|
statusCleanMessage: statusCleanMessage
|
|
172
194
|
})];
|
|
173
|
-
case
|
|
195
|
+
case 11:
|
|
174
196
|
// Send formated status update in slack
|
|
175
197
|
_a.sent();
|
|
176
198
|
// Send success thread for MRs not targeting Dev
|
|
@@ -183,7 +205,7 @@ var ValidateTask = /** @class */ (function () {
|
|
|
183
205
|
statusMessage: '',
|
|
184
206
|
statusCleanMessage: statusCleanMessage
|
|
185
207
|
})];
|
|
186
|
-
case
|
|
208
|
+
case 12:
|
|
187
209
|
// Send formated status update in slack
|
|
188
210
|
_a.sent();
|
|
189
211
|
utils_1.Logger.logSuccess('\nRelease is ready to go out');
|
|
@@ -192,11 +214,11 @@ var ValidateTask = /** @class */ (function () {
|
|
|
192
214
|
});
|
|
193
215
|
});
|
|
194
216
|
};
|
|
195
|
-
ValidateTask.prototype.notReadyMrsLog = function (projects, version, milestone, slackNotifier) {
|
|
217
|
+
ValidateTask.prototype.notReadyMrsLog = function (projects, version, milestone, slackNotifier, nextMilestone) {
|
|
196
218
|
return __awaiter(this, void 0, void 0, function () {
|
|
197
|
-
var allNotReadyMrs, emailListNotReadyMrs, _i, projects_2, project, notReadyMrs, groupedByUser, logMessageSlack, key, name, authorEmail,
|
|
198
|
-
return __generator(this, function (
|
|
199
|
-
switch (
|
|
219
|
+
var allNotReadyMrs, emailListNotReadyMrs, _i, projects_2, project, notReadyMrs, groupedByUser, logMessageSlack, _a, _b, _c, key, name, authorEmail, _d, _e, mr, updated, threadLabel, statusCleanMessage;
|
|
220
|
+
return __generator(this, function (_f) {
|
|
221
|
+
switch (_f.label) {
|
|
200
222
|
case 0:
|
|
201
223
|
allNotReadyMrs = [];
|
|
202
224
|
emailListNotReadyMrs = [];
|
|
@@ -208,25 +230,55 @@ var ValidateTask = /** @class */ (function () {
|
|
|
208
230
|
}
|
|
209
231
|
groupedByUser = lodash_1.default.groupBy(allNotReadyMrs, function (mr) { return mr.author; });
|
|
210
232
|
logMessageSlack = '';
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
233
|
+
_a = [];
|
|
234
|
+
for (_b in groupedByUser)
|
|
235
|
+
_a.push(_b);
|
|
236
|
+
_c = 0;
|
|
237
|
+
_f.label = 1;
|
|
238
|
+
case 1:
|
|
239
|
+
if (!(_c < _a.length)) return [3 /*break*/, 6];
|
|
240
|
+
key = _a[_c];
|
|
241
|
+
name = key;
|
|
242
|
+
// Pretty sure this can't happen now 😅
|
|
243
|
+
if (!name || name === 'undefined')
|
|
244
|
+
name = 'No Author';
|
|
245
|
+
authorEmail = this.slackService.convertToEmailFormat(key);
|
|
246
|
+
emailListNotReadyMrs.push(authorEmail);
|
|
247
|
+
utils_1.Logger.logMessage(name);
|
|
248
|
+
logMessageSlack += "".concat(name, ":\n");
|
|
249
|
+
_d = 0, _e = groupedByUser[key];
|
|
250
|
+
_f.label = 2;
|
|
251
|
+
case 2:
|
|
252
|
+
if (!(_d < _e.length)) return [3 /*break*/, 5];
|
|
253
|
+
mr = _e[_d];
|
|
254
|
+
utils_1.Logger.logMessage("- ".concat(mr.url));
|
|
255
|
+
logMessageSlack += "- ".concat(mr.url, "\n");
|
|
256
|
+
if (!nextMilestone) return [3 /*break*/, 4];
|
|
257
|
+
return [4 /*yield*/, this.updateMrMilestone(nextMilestone.id, milestone, mr)];
|
|
258
|
+
case 3:
|
|
259
|
+
updated = _f.sent();
|
|
260
|
+
if (updated) {
|
|
261
|
+
logMessageSlack += " -> MR has been rolled over from '".concat(milestone, "' to '").concat(nextMilestone.name, "' successfully\n");
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
logMessageSlack += " -> Failed to roll over milestone for this MR. Check logs for error.\n";
|
|
225
265
|
}
|
|
266
|
+
_f.label = 4;
|
|
267
|
+
case 4:
|
|
268
|
+
_d++;
|
|
269
|
+
return [3 /*break*/, 2];
|
|
270
|
+
case 5:
|
|
271
|
+
_c++;
|
|
272
|
+
return [3 /*break*/, 1];
|
|
273
|
+
case 6:
|
|
226
274
|
if (!slackNotifier)
|
|
227
275
|
return [2 /*return*/];
|
|
228
276
|
threadLabel = "".concat(milestone, " Open Mrs!");
|
|
229
277
|
statusCleanMessage = 'No outstanding Mrs!';
|
|
278
|
+
if (nextMilestone) {
|
|
279
|
+
threadLabel = "".concat(milestone, " merge requests rolled over to ").concat(nextMilestone.name, "!");
|
|
280
|
+
statusCleanMessage = 'There were no outstanding MRs for this release!';
|
|
281
|
+
}
|
|
230
282
|
// Send formated status update in slack
|
|
231
283
|
return [4 /*yield*/, this.slackService.sendSlackStatusMessage({
|
|
232
284
|
emailList: emailListNotReadyMrs,
|
|
@@ -234,15 +286,15 @@ var ValidateTask = /** @class */ (function () {
|
|
|
234
286
|
statusMessage: logMessageSlack,
|
|
235
287
|
statusCleanMessage: statusCleanMessage
|
|
236
288
|
})];
|
|
237
|
-
case
|
|
289
|
+
case 7:
|
|
238
290
|
// Send formated status update in slack
|
|
239
|
-
|
|
291
|
+
_f.sent();
|
|
240
292
|
return [2 /*return*/];
|
|
241
293
|
}
|
|
242
294
|
});
|
|
243
295
|
});
|
|
244
296
|
};
|
|
245
|
-
ValidateTask.prototype.wrongTargetMrsLog = function (projects, version, milestone, slackNotifier) {
|
|
297
|
+
ValidateTask.prototype.wrongTargetMrsLog = function (projects, version, milestone, slackNotifier, nextMilestone) {
|
|
246
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
247
299
|
var allWrongTargetMrs, emailListWrongTargetMrs, _i, projects_3, project, wrongTargetMrs, logAllWrongTargetMrs, groupedByUser, key, name, authorEmail, _a, _b, mr, threadLabel, statusCleanMessage;
|
|
248
300
|
return __generator(this, function (_c) {
|
|
@@ -288,6 +340,8 @@ var ValidateTask = /** @class */ (function () {
|
|
|
288
340
|
}
|
|
289
341
|
if (!slackNotifier)
|
|
290
342
|
return [2 /*return*/];
|
|
343
|
+
if (nextMilestone)
|
|
344
|
+
return [2 /*return*/];
|
|
291
345
|
threadLabel = "".concat(milestone, " MRs not targeting dev!");
|
|
292
346
|
statusCleanMessage = 'All MRs targeting dev!';
|
|
293
347
|
// Send formated status update in slack
|
|
@@ -332,6 +386,27 @@ var ValidateTask = /** @class */ (function () {
|
|
|
332
386
|
});
|
|
333
387
|
});
|
|
334
388
|
};
|
|
389
|
+
ValidateTask.prototype.updateMrMilestone = function (nextMilestoneId, milestone, mr) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
391
|
+
var updatedMilestone;
|
|
392
|
+
return __generator(this, function (_a) {
|
|
393
|
+
switch (_a.label) {
|
|
394
|
+
case 0: return [4 /*yield*/, this.gitLabService.updateMilestone(mr.projectId, mr.iid, nextMilestoneId)];
|
|
395
|
+
case 1:
|
|
396
|
+
updatedMilestone = _a.sent();
|
|
397
|
+
if (updatedMilestone) {
|
|
398
|
+
utils_1.Logger.logSuccess("MR have been rolled over to next milestone (".concat(milestone, " -> ").concat(updatedMilestone.name, ")"));
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
utils_1.Logger.logError('Failed to update the milestone for merge request!');
|
|
402
|
+
this.rollOverAllMrs = false;
|
|
403
|
+
return [2 /*return*/, false];
|
|
404
|
+
}
|
|
405
|
+
return [2 /*return*/, true];
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
};
|
|
335
410
|
ValidateTask = __decorate([
|
|
336
411
|
(0, inversify_1.injectable)(),
|
|
337
412
|
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|