@clickview/ship-it 0.0.19 → 0.0.20
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/README.md +48 -48
- package/config.json +10 -10
- package/lib/config.json +11 -11
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +404 -404
- package/lib/src/api-clients/git-lab/GitLabMapper.js +81 -81
- package/lib/src/api-clients/index.js +18 -18
- package/lib/src/api-clients/team-city/TeamCityApiClient.js +100 -85
- package/lib/src/commands/BumpPackagesCommand.js +84 -84
- package/lib/src/commands/CreateBranchCommand.js +100 -100
- package/lib/src/commands/CreateMergeRequestCommand.js +107 -107
- package/lib/src/commands/CreateReleaseNotesCommand.js +84 -84
- package/lib/src/commands/CreateTestingNotesCommand.js +84 -84
- package/lib/src/commands/InstallPackagesCommand.js +76 -76
- package/lib/src/commands/ListProjectsCommand.js +76 -76
- package/lib/src/commands/ReleaseCommand.js +129 -129
- package/lib/src/commands/StartConsumingProjectBuildsCommand.js +76 -76
- package/lib/src/commands/StatusCommand.js +88 -88
- package/lib/src/commands/TagMasterCommand.js +76 -76
- package/lib/src/commands/ValidateMergeRequestCommand.js +76 -76
- package/lib/src/commands/VersionCommand.js +76 -76
- package/lib/src/commands/index.js +29 -29
- package/lib/src/constants/CommandTypeMapping.js +19 -19
- package/lib/src/constants/GitLabMemberIds.js +6 -6
- package/lib/src/constants/MonorepoPackageJsonFiles.js +16 -16
- package/lib/src/constants/MonorepoProjectNames.js +15 -0
- package/lib/src/constants/ProjectNames.js +62 -61
- package/lib/src/constants/TeamCityBuildIDs.js +15 -15
- package/lib/src/constants/index.js +19 -19
- package/lib/src/errors/ShipItError.js +32 -32
- package/lib/src/errors/index.js +17 -17
- package/lib/src/index.js +18 -18
- package/lib/src/interfaces/Config.js +2 -2
- package/lib/src/interfaces/MergeRequestState.js +2 -2
- package/lib/src/interfaces/ProjectNames.js +2 -2
- package/lib/src/interfaces/ShipItCommand.js +2 -2
- package/lib/src/interfaces/ShipItTask.js +2 -2
- package/lib/src/interfaces/VersionType.js +2 -2
- package/lib/src/interfaces/command-cli-options/MilestoneCommandCliOptions.js +2 -2
- package/lib/src/interfaces/command-cli-options/ReleaseCommandCliOptions.js +2 -2
- package/lib/src/interfaces/command-cli-options/index.js +18 -18
- package/lib/src/interfaces/command-options/BaseCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/BumpPackagesCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/DockerMilestoneCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/MilestoneCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/ReleaseCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/ValidateMRCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/index.js +21 -21
- package/lib/src/interfaces/index.js +26 -26
- package/lib/src/interfaces/models/Branch.js +2 -2
- package/lib/src/interfaces/models/Commit.js +2 -2
- package/lib/src/interfaces/models/CommitFile.js +2 -2
- package/lib/src/interfaces/models/File.js +2 -2
- package/lib/src/interfaces/models/Label.js +2 -2
- package/lib/src/interfaces/models/MergeRequest.js +2 -2
- package/lib/src/interfaces/models/Milestone.js +2 -2
- package/lib/src/interfaces/models/Project.js +2 -2
- package/lib/src/interfaces/models/ProjectConfig.js +9 -9
- package/lib/src/interfaces/models/Release.js +2 -2
- package/lib/src/interfaces/models/Tag.js +2 -2
- package/lib/src/interfaces/models/index.js +26 -26
- package/lib/src/interfaces/view-models/MilestoneProject.js +2 -2
- package/lib/src/interfaces/view-models/index.js +17 -17
- package/lib/src/inversify.config.js +67 -67
- package/lib/src/services/GitLabService.js +498 -498
- package/lib/src/services/TeamCityService.js +37 -34
- package/lib/src/services/index.js +18 -18
- package/lib/src/startup/AddMilestoneCommand.js +95 -95
- package/lib/src/startup/GetAction.js +68 -68
- package/lib/src/startup/SetupCommands.js +128 -127
- package/lib/src/tasks/BumpPackagesTask.js +229 -229
- package/lib/src/tasks/BumpVersionTxtTask.js +110 -110
- package/lib/src/tasks/CommitPackageVersionsTask.js +116 -116
- package/lib/src/tasks/CreateBranchTask.js +104 -104
- package/lib/src/tasks/CreateMergeRequestTask.js +118 -118
- package/lib/src/tasks/CreateReleaseNotesTask.js +122 -122
- package/lib/src/tasks/CreateTestingNotesTask.js +135 -135
- package/lib/src/tasks/InstallPackagesTask.js +405 -351
- package/lib/src/tasks/ListProjectsTask.js +87 -87
- package/lib/src/tasks/StartConsumingProjectBuildsTask.js +149 -149
- package/lib/src/tasks/StartMonorepoBuildTask.js +109 -95
- package/lib/src/tasks/TagMasterTask.js +121 -121
- package/lib/src/tasks/ValidateCommitsTask.js +119 -119
- package/lib/src/tasks/ValidateDescriptionsTask.js +151 -151
- package/lib/src/tasks/ValidateMergeRequestTask.js +115 -115
- package/lib/src/tasks/ValidateTask.js +240 -237
- package/lib/src/tasks/VersionTask.js +98 -98
- package/lib/src/tasks/index.js +33 -33
- package/lib/src/types.js +49 -49
- package/lib/src/utils/BranchNames.js +11 -11
- package/lib/src/utils/Commits.js +55 -55
- package/lib/src/utils/Csv.js +54 -54
- package/lib/src/utils/Descriptions.js +237 -237
- package/lib/src/utils/GroupIds.js +6 -6
- package/lib/src/utils/Logger.js +62 -62
- package/lib/src/utils/ProjectIds.js +47 -47
- package/lib/src/utils/Versions.js +20 -20
- package/lib/src/utils/index.js +22 -22
- package/package.json +47 -47
|
@@ -1,237 +1,240 @@
|
|
|
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
|
-
};
|
|
13
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
};
|
|
19
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
-
};
|
|
22
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
23
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
-
};
|
|
64
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.ValidateTask = void 0;
|
|
66
|
-
require("reflect-metadata");
|
|
67
|
-
var inversify_1 = require("inversify");
|
|
68
|
-
var lodash_1 = __importDefault(require("lodash"));
|
|
69
|
-
var types_1 = require("../types");
|
|
70
|
-
var services_1 = require("../services");
|
|
71
|
-
var utils_1 = require("../utils");
|
|
72
|
-
var ValidateTask = /** @class */ (function () {
|
|
73
|
-
function ValidateTask(service) {
|
|
74
|
-
this.service = service;
|
|
75
|
-
}
|
|
76
|
-
ValidateTask.prototype.run = function (options) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var projects, cont, _loop_1, this_1, _i, projects_1, project;
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
switch (_a.label) {
|
|
81
|
-
case 0:
|
|
82
|
-
utils_1.Logger.logTask('Validating the release');
|
|
83
|
-
return [4 /*yield*/, this.service.getProjects(options)];
|
|
84
|
-
case 1:
|
|
85
|
-
projects = _a.sent();
|
|
86
|
-
utils_1.Logger.logMessage("Found ".concat(projects.length, " projects that need to be released"));
|
|
87
|
-
cont = true;
|
|
88
|
-
_loop_1 = function (project) {
|
|
89
|
-
var hasSomeTags, groupedMRs, count, ready, wrongTargetMrs, message_1, issues;
|
|
90
|
-
return __generator(this, function (_b) {
|
|
91
|
-
switch (_b.label) {
|
|
92
|
-
case 0: return [4 /*yield*/, this_1.service.hasSomeTags(project.id)];
|
|
93
|
-
case 1:
|
|
94
|
-
hasSomeTags = _b.sent();
|
|
95
|
-
groupedMRs = lodash_1.default.groupBy(project.mergeRequests, function (mr) { return mr.status; });
|
|
96
|
-
count = Object.keys(groupedMRs).reduce(function (prev, current) {
|
|
97
|
-
var _a;
|
|
98
|
-
return __assign(__assign({}, prev), (_a = {}, _a[current] = groupedMRs[current].length, _a));
|
|
99
|
-
}, {});
|
|
100
|
-
ready = !count.opened || count.opened === 0 && hasSomeTags;
|
|
101
|
-
return [4 /*yield*/, this_1.getMRsTargetingWrongBranch(project, options.version)];
|
|
102
|
-
case 2:
|
|
103
|
-
wrongTargetMrs = _b.sent();
|
|
104
|
-
if (wrongTargetMrs.length)
|
|
105
|
-
ready = false;
|
|
106
|
-
if (!ready)
|
|
107
|
-
cont = false;
|
|
108
|
-
if (ready)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
issues.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
case
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
case
|
|
143
|
-
|
|
144
|
-
return [
|
|
145
|
-
case
|
|
146
|
-
|
|
147
|
-
return [
|
|
148
|
-
case
|
|
149
|
-
|
|
150
|
-
return [2 /*return*/,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return [
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
case
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
+
};
|
|
13
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
};
|
|
19
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
+
};
|
|
22
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
23
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (_) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.ValidateTask = void 0;
|
|
66
|
+
require("reflect-metadata");
|
|
67
|
+
var inversify_1 = require("inversify");
|
|
68
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
69
|
+
var types_1 = require("../types");
|
|
70
|
+
var services_1 = require("../services");
|
|
71
|
+
var utils_1 = require("../utils");
|
|
72
|
+
var ValidateTask = /** @class */ (function () {
|
|
73
|
+
function ValidateTask(service) {
|
|
74
|
+
this.service = service;
|
|
75
|
+
}
|
|
76
|
+
ValidateTask.prototype.run = function (options) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var projects, cont, _loop_1, this_1, _i, projects_1, project;
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
switch (_a.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
utils_1.Logger.logTask('Validating the release');
|
|
83
|
+
return [4 /*yield*/, this.service.getProjects(options)];
|
|
84
|
+
case 1:
|
|
85
|
+
projects = _a.sent();
|
|
86
|
+
utils_1.Logger.logMessage("Found ".concat(projects.length, " projects that need to be released"));
|
|
87
|
+
cont = true;
|
|
88
|
+
_loop_1 = function (project) {
|
|
89
|
+
var hasSomeTags, groupedMRs, count, ready, wrongTargetMrs, nextVersion, message_1, issues;
|
|
90
|
+
return __generator(this, function (_b) {
|
|
91
|
+
switch (_b.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, this_1.service.hasSomeTags(project.id)];
|
|
93
|
+
case 1:
|
|
94
|
+
hasSomeTags = _b.sent();
|
|
95
|
+
groupedMRs = lodash_1.default.groupBy(project.mergeRequests, function (mr) { return mr.status; });
|
|
96
|
+
count = Object.keys(groupedMRs).reduce(function (prev, current) {
|
|
97
|
+
var _a;
|
|
98
|
+
return __assign(__assign({}, prev), (_a = {}, _a[current] = groupedMRs[current].length, _a));
|
|
99
|
+
}, {});
|
|
100
|
+
ready = !count.opened || count.opened === 0 && hasSomeTags;
|
|
101
|
+
return [4 /*yield*/, this_1.getMRsTargetingWrongBranch(project, options.version)];
|
|
102
|
+
case 2:
|
|
103
|
+
wrongTargetMrs = _b.sent();
|
|
104
|
+
if (wrongTargetMrs.length)
|
|
105
|
+
ready = false;
|
|
106
|
+
if (!ready)
|
|
107
|
+
cont = false;
|
|
108
|
+
if (!ready) return [3 /*break*/, 4];
|
|
109
|
+
return [4 /*yield*/, this_1.service.getNextBranchInfo(project.id, options.version)];
|
|
110
|
+
case 3:
|
|
111
|
+
nextVersion = (_b.sent()).nextVersion;
|
|
112
|
+
utils_1.Logger.logSuccess("".concat(project.title, " ").concat(nextVersion));
|
|
113
|
+
return [3 /*break*/, 5];
|
|
114
|
+
case 4:
|
|
115
|
+
message_1 = "[".concat(project.title, "] NOT READY:");
|
|
116
|
+
issues = [];
|
|
117
|
+
if (count.opened)
|
|
118
|
+
issues.push("Contains ".concat(count.opened, " Open MR(s)"));
|
|
119
|
+
if (wrongTargetMrs)
|
|
120
|
+
issues.push("Contains ".concat(wrongTargetMrs.length, " MR(s) not targeting dev or release branch"));
|
|
121
|
+
if (!hasSomeTags)
|
|
122
|
+
issues.push("Does not have any tags. Please create one here: ".concat(project.url, "/tags"));
|
|
123
|
+
issues.forEach(function (issue) {
|
|
124
|
+
message_1 += "\n- ".concat(issue);
|
|
125
|
+
});
|
|
126
|
+
utils_1.Logger.logError(message_1);
|
|
127
|
+
_b.label = 5;
|
|
128
|
+
case 5: return [2 /*return*/];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
this_1 = this;
|
|
133
|
+
_i = 0, projects_1 = projects;
|
|
134
|
+
_a.label = 2;
|
|
135
|
+
case 2:
|
|
136
|
+
if (!(_i < projects_1.length)) return [3 /*break*/, 5];
|
|
137
|
+
project = projects_1[_i];
|
|
138
|
+
return [5 /*yield**/, _loop_1(project)];
|
|
139
|
+
case 3:
|
|
140
|
+
_a.sent();
|
|
141
|
+
_a.label = 4;
|
|
142
|
+
case 4:
|
|
143
|
+
_i++;
|
|
144
|
+
return [3 /*break*/, 2];
|
|
145
|
+
case 5:
|
|
146
|
+
if (!!cont) return [3 /*break*/, 7];
|
|
147
|
+
return [4 /*yield*/, this.logNotReady(projects, options.version)];
|
|
148
|
+
case 6:
|
|
149
|
+
_a.sent();
|
|
150
|
+
return [2 /*return*/, false];
|
|
151
|
+
case 7:
|
|
152
|
+
utils_1.Logger.logSuccess('\nRelease is ready to go out');
|
|
153
|
+
return [2 /*return*/, true];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
ValidateTask.prototype.logNotReady = function (projects, version) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
+
var allNotReadyMrs, allWrongTargetMrs, _i, projects_2, project, notReadyMrs, wrongTargetMrs, groupedByUser, key, name, _a, _b, mr;
|
|
161
|
+
return __generator(this, function (_c) {
|
|
162
|
+
switch (_c.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
utils_1.Logger.logError("\nThis release is NOT READY to go out, here are the outstanding MRs: \n");
|
|
165
|
+
allNotReadyMrs = [];
|
|
166
|
+
allWrongTargetMrs = [];
|
|
167
|
+
_i = 0, projects_2 = projects;
|
|
168
|
+
_c.label = 1;
|
|
169
|
+
case 1:
|
|
170
|
+
if (!(_i < projects_2.length)) return [3 /*break*/, 4];
|
|
171
|
+
project = projects_2[_i];
|
|
172
|
+
notReadyMrs = project.mergeRequests.filter(function (mr) { return mr.status === 'opened'; });
|
|
173
|
+
return [4 /*yield*/, this.getMRsTargetingWrongBranch(project, version)];
|
|
174
|
+
case 2:
|
|
175
|
+
wrongTargetMrs = _c.sent();
|
|
176
|
+
if (notReadyMrs.length)
|
|
177
|
+
allNotReadyMrs.push.apply(allNotReadyMrs, notReadyMrs);
|
|
178
|
+
if (wrongTargetMrs.length)
|
|
179
|
+
allWrongTargetMrs.push.apply(allWrongTargetMrs, wrongTargetMrs);
|
|
180
|
+
_c.label = 3;
|
|
181
|
+
case 3:
|
|
182
|
+
_i++;
|
|
183
|
+
return [3 /*break*/, 1];
|
|
184
|
+
case 4:
|
|
185
|
+
groupedByUser = lodash_1.default.groupBy(allNotReadyMrs, function (mr) { return mr.author; });
|
|
186
|
+
for (key in groupedByUser) {
|
|
187
|
+
name = key;
|
|
188
|
+
// Pretty sure this can't happen now 😅
|
|
189
|
+
if (!name || name === 'undefined')
|
|
190
|
+
name = 'No Author';
|
|
191
|
+
utils_1.Logger.logMessage(name);
|
|
192
|
+
for (_a = 0, _b = groupedByUser[key]; _a < _b.length; _a++) {
|
|
193
|
+
mr = _b[_a];
|
|
194
|
+
utils_1.Logger.logMessage("- ".concat(mr.url));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (allWrongTargetMrs.length) {
|
|
198
|
+
utils_1.Logger.logMessage('\nMRs that are not targeting dev or release branch\n');
|
|
199
|
+
allWrongTargetMrs.forEach(function (mr) { return utils_1.Logger.logError("- ".concat(mr.url)); });
|
|
200
|
+
}
|
|
201
|
+
utils_1.Logger.logMessage('\n');
|
|
202
|
+
return [2 /*return*/];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Finds any MRs with the milestone that are either not targeting dev
|
|
209
|
+
* or the release branch if one is already made
|
|
210
|
+
*/
|
|
211
|
+
ValidateTask.prototype.getMRsTargetingWrongBranch = function (project, version) {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
213
|
+
var nonDevMrs, _a, premadeRelease, releaseName, nonDevAndReleaseMrs;
|
|
214
|
+
return __generator(this, function (_b) {
|
|
215
|
+
switch (_b.label) {
|
|
216
|
+
case 0:
|
|
217
|
+
nonDevMrs = project.mergeRequests.filter(function (mr) {
|
|
218
|
+
return mr.targetBranch !== 'dev';
|
|
219
|
+
});
|
|
220
|
+
if (!nonDevMrs.length)
|
|
221
|
+
return [2 /*return*/, []];
|
|
222
|
+
return [4 /*yield*/, this.service.getNextBranchInfo(project.id, version)];
|
|
223
|
+
case 1:
|
|
224
|
+
_a = _b.sent(), premadeRelease = _a.branch, releaseName = _a.branchName;
|
|
225
|
+
if (!premadeRelease)
|
|
226
|
+
return [2 /*return*/, nonDevMrs];
|
|
227
|
+
nonDevAndReleaseMrs = nonDevMrs.filter(function (mr) { return mr.targetBranch !== releaseName; });
|
|
228
|
+
return [2 /*return*/, nonDevAndReleaseMrs];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
ValidateTask = __decorate([
|
|
234
|
+
(0, inversify_1.injectable)(),
|
|
235
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
236
|
+
__metadata("design:paramtypes", [services_1.GitLabService])
|
|
237
|
+
], ValidateTask);
|
|
238
|
+
return ValidateTask;
|
|
239
|
+
}());
|
|
240
|
+
exports.ValidateTask = ValidateTask;
|