@clickview/ship-it 0.0.40 → 0.0.41
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/Dockerfile +33 -33
- package/README.md +48 -48
- package/config.json +19 -19
- package/dist/I3/I3 Notes Audit.csv +127 -0
- package/dist/J1/J1 Notes Audit.csv +38 -0
- package/dist/J2/J2 Notes Audit.csv +52 -0
- package/dist/L1/L1 Notes Audit.csv +139 -0
- package/lib/config.json +20 -20
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +561 -557
- package/lib/src/api-clients/git-lab/GitLabMapper.js +122 -122
- package/lib/src/api-clients/index.js +20 -20
- package/lib/src/api-clients/slack/SlackApiClient.js +206 -206
- package/lib/src/api-clients/team-city/TeamCityApiClient.js +100 -100
- package/lib/src/api-clients/trello/TrelloApiClient.js +145 -145
- package/lib/src/commands/BumpPackagesCommand.js +76 -76
- package/lib/src/commands/ConfigureProjectsCommand.js +84 -84
- package/lib/src/commands/CreateBranchCommand.js +100 -100
- package/lib/src/commands/CreateMergeRequestCommand.js +107 -107
- package/lib/src/commands/CreateNotesAuditCommand.js +84 -84
- package/lib/src/commands/CreateReleaseNotesCommand.js +95 -95
- package/lib/src/commands/CreateTrelloCardsCommand.js +77 -77
- package/lib/src/commands/InstallPackagesCommand.js +76 -76
- package/lib/src/commands/ListProjectsCommand.js +76 -76
- package/lib/src/commands/ReleaseCommand.js +136 -136
- package/lib/src/commands/StartProjectBuildsCommand.js +76 -76
- package/lib/src/commands/StatusCommand.js +93 -93
- 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 +31 -31
- package/lib/src/constants/CommandTypeMapping.js +21 -21
- package/lib/src/constants/GitLabMemberIds.js +6 -6
- package/lib/src/constants/MonorepoPackageJsonFiles.js +41 -41
- package/lib/src/constants/MonorepoProjectNames.js +16 -16
- package/lib/src/constants/ProjectNames.js +69 -69
- package/lib/src/constants/SlackUserEmailList.js +13 -13
- package/lib/src/constants/TeamCityBuildIDs.js +46 -46
- 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/StatusCommandCliOptions.js +2 -2
- package/lib/src/interfaces/command-cli-options/index.js +19 -19
- 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/ConfigureProjectsOptions.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/StatusCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/ValidateMRCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/index.js +23 -23
- package/lib/src/interfaces/index.js +26 -26
- package/lib/src/interfaces/models/ApprovalRule.js +2 -2
- package/lib/src/interfaces/models/ApprovalRuleConfiguration.js +2 -2
- 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/CreateApprovalRuleRequest.js +2 -2
- package/lib/src/interfaces/models/File.js +2 -2
- package/lib/src/interfaces/models/Group.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/ProtectedBranch.js +2 -2
- 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 +32 -32
- 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 +79 -79
- package/lib/src/services/GitLabService.js +544 -544
- package/lib/src/services/SlackService.js +142 -142
- package/lib/src/services/TeamCityService.js +37 -37
- package/lib/src/services/TrelloService.js +84 -84
- package/lib/src/services/index.js +20 -20
- package/lib/src/startup/AddMilestoneCommand.js +96 -96
- package/lib/src/startup/GetAction.js +68 -68
- package/lib/src/startup/SetupCommands.js +180 -180
- package/lib/src/tasks/BumpPackagesTask.js +230 -230
- package/lib/src/tasks/BumpVersionTxtTask.js +110 -110
- package/lib/src/tasks/CommitPackageVersionsTask.js +116 -0
- package/lib/src/tasks/CreateBranchTask.js +104 -104
- package/lib/src/tasks/CreateMergeRequestTask.js +118 -118
- package/lib/src/tasks/CreateNotesAuditTask.js +140 -140
- package/lib/src/tasks/CreateReleaseNotesTask.js +144 -144
- package/lib/src/tasks/InstallPackagesTask.js +415 -415
- package/lib/src/tasks/ListProjectsTask.js +87 -87
- package/lib/src/tasks/PopulateTrelloBoardTask.js +140 -140
- package/lib/src/tasks/StartMonorepoBuildTask.js +109 -109
- package/lib/src/tasks/StartProjectBuildsTask.js +170 -170
- package/lib/src/tasks/TagMasterTask.js +189 -189
- package/lib/src/tasks/ValidateCommitsTask.js +143 -143
- package/lib/src/tasks/ValidateDescriptionsTask.js +178 -178
- package/lib/src/tasks/ValidateMergeRequestTask.js +115 -115
- package/lib/src/tasks/ValidateTask.js +419 -419
- package/lib/src/tasks/VersionTask.js +98 -98
- package/lib/src/tasks/configure-projects/AddApprovalRulesTask.js +199 -182
- package/lib/src/tasks/configure-projects/CreateToolingBranchTask.js +138 -136
- package/lib/src/tasks/configure-projects/EnsureApprovalRulesTask.js +106 -106
- package/lib/src/tasks/configure-projects/index.js +18 -18
- package/lib/src/tasks/configure-projects/primitives/BaseConfigureProjectsTask.js +98 -98
- package/lib/src/tasks/index.js +34 -34
- package/lib/src/types.js +60 -60
- 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 +274 -274
- 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 +50 -50
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
-
function step(op) {
|
|
28
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
-
while (_) try {
|
|
30
|
-
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;
|
|
31
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
-
switch (op[0]) {
|
|
33
|
-
case 0: case 1: t = op; break;
|
|
34
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
-
default:
|
|
38
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
-
if (t[2]) _.ops.pop();
|
|
43
|
-
_.trys.pop(); continue;
|
|
44
|
-
}
|
|
45
|
-
op = body.call(thisArg, _);
|
|
46
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.VersionTask = void 0;
|
|
52
|
-
require("reflect-metadata");
|
|
53
|
-
var inversify_1 = require("inversify");
|
|
54
|
-
var types_1 = require("../types");
|
|
55
|
-
var services_1 = require("../services");
|
|
56
|
-
var utils_1 = require("../utils");
|
|
57
|
-
var VersionTask = /** @class */ (function () {
|
|
58
|
-
function VersionTask(service) {
|
|
59
|
-
this.service = service;
|
|
60
|
-
}
|
|
61
|
-
VersionTask.prototype.run = function (options) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var projects, _i, projects_1, project, tag, nextVersion;
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
utils_1.Logger.logTask('Calculating versions');
|
|
68
|
-
return [4 /*yield*/, this.service.getProjects(options, { invalidateCache: true })];
|
|
69
|
-
case 1:
|
|
70
|
-
projects = _a.sent();
|
|
71
|
-
utils_1.Logger.logMessage('Versions:');
|
|
72
|
-
_i = 0, projects_1 = projects;
|
|
73
|
-
_a.label = 2;
|
|
74
|
-
case 2:
|
|
75
|
-
if (!(_i < projects_1.length)) return [3 /*break*/, 5];
|
|
76
|
-
project = projects_1[_i];
|
|
77
|
-
return [4 /*yield*/, this.service.getNextBranchInfo(project.id, options.version)];
|
|
78
|
-
case 3:
|
|
79
|
-
tag = (_a.sent()).tag;
|
|
80
|
-
nextVersion = utils_1.Versions.getNextVersion(tag.name, options.version);
|
|
81
|
-
utils_1.Logger.logMessage("[".concat(nextVersion, "]: ").concat(project.title));
|
|
82
|
-
_a.label = 4;
|
|
83
|
-
case 4:
|
|
84
|
-
_i++;
|
|
85
|
-
return [3 /*break*/, 2];
|
|
86
|
-
case 5: return [2 /*return*/, true];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
VersionTask = __decorate([
|
|
92
|
-
(0, inversify_1.injectable)(),
|
|
93
|
-
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
94
|
-
__metadata("design:paramtypes", [services_1.GitLabService])
|
|
95
|
-
], VersionTask);
|
|
96
|
-
return VersionTask;
|
|
97
|
-
}());
|
|
98
|
-
exports.VersionTask = VersionTask;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
+
function step(op) {
|
|
28
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
+
while (_) try {
|
|
30
|
+
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;
|
|
31
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
+
switch (op[0]) {
|
|
33
|
+
case 0: case 1: t = op; break;
|
|
34
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
+
default:
|
|
38
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
+
if (t[2]) _.ops.pop();
|
|
43
|
+
_.trys.pop(); continue;
|
|
44
|
+
}
|
|
45
|
+
op = body.call(thisArg, _);
|
|
46
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.VersionTask = void 0;
|
|
52
|
+
require("reflect-metadata");
|
|
53
|
+
var inversify_1 = require("inversify");
|
|
54
|
+
var types_1 = require("../types");
|
|
55
|
+
var services_1 = require("../services");
|
|
56
|
+
var utils_1 = require("../utils");
|
|
57
|
+
var VersionTask = /** @class */ (function () {
|
|
58
|
+
function VersionTask(service) {
|
|
59
|
+
this.service = service;
|
|
60
|
+
}
|
|
61
|
+
VersionTask.prototype.run = function (options) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
var projects, _i, projects_1, project, tag, nextVersion;
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
utils_1.Logger.logTask('Calculating versions');
|
|
68
|
+
return [4 /*yield*/, this.service.getProjects(options, { invalidateCache: true })];
|
|
69
|
+
case 1:
|
|
70
|
+
projects = _a.sent();
|
|
71
|
+
utils_1.Logger.logMessage('Versions:');
|
|
72
|
+
_i = 0, projects_1 = projects;
|
|
73
|
+
_a.label = 2;
|
|
74
|
+
case 2:
|
|
75
|
+
if (!(_i < projects_1.length)) return [3 /*break*/, 5];
|
|
76
|
+
project = projects_1[_i];
|
|
77
|
+
return [4 /*yield*/, this.service.getNextBranchInfo(project.id, options.version)];
|
|
78
|
+
case 3:
|
|
79
|
+
tag = (_a.sent()).tag;
|
|
80
|
+
nextVersion = utils_1.Versions.getNextVersion(tag.name, options.version);
|
|
81
|
+
utils_1.Logger.logMessage("[".concat(nextVersion, "]: ").concat(project.title));
|
|
82
|
+
_a.label = 4;
|
|
83
|
+
case 4:
|
|
84
|
+
_i++;
|
|
85
|
+
return [3 /*break*/, 2];
|
|
86
|
+
case 5: return [2 /*return*/, true];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
VersionTask = __decorate([
|
|
92
|
+
(0, inversify_1.injectable)(),
|
|
93
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
94
|
+
__metadata("design:paramtypes", [services_1.GitLabService])
|
|
95
|
+
], VersionTask);
|
|
96
|
+
return VersionTask;
|
|
97
|
+
}());
|
|
98
|
+
exports.VersionTask = VersionTask;
|
|
@@ -1,182 +1,199 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
29
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
31
|
-
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;
|
|
32
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
33
|
-
};
|
|
34
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
35
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
36
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
38
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
40
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
44
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
45
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
46
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
47
|
-
function step(op) {
|
|
48
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
49
|
-
while (_) try {
|
|
50
|
-
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;
|
|
51
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
52
|
-
switch (op[0]) {
|
|
53
|
-
case 0: case 1: t = op; break;
|
|
54
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
55
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
56
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
57
|
-
default:
|
|
58
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
59
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
60
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
61
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
62
|
-
if (t[2]) _.ops.pop();
|
|
63
|
-
_.trys.pop(); continue;
|
|
64
|
-
}
|
|
65
|
-
op = body.call(thisArg, _);
|
|
66
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
67
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
-
exports.AddApprovalRulesTask = exports.APPROVAL_RULE_NAME = void 0;
|
|
72
|
-
require("reflect-metadata");
|
|
73
|
-
var inversify_1 = require("inversify");
|
|
74
|
-
var utils_1 = require("../../utils");
|
|
75
|
-
var BaseConfigureProjectsTask_1 = require("./primitives/BaseConfigureProjectsTask");
|
|
76
|
-
var APPROVAL_RULE_CONFIGURATION = {
|
|
77
|
-
mergeRequestsAuthorApproval: false,
|
|
78
|
-
disableOverridingApproversPerMergeRequest: false,
|
|
79
|
-
mergeRequestsDisableCommittersApproval: false,
|
|
80
|
-
requirePasswordToApprove: false,
|
|
81
|
-
resetApprovalsOnPush: true
|
|
82
|
-
};
|
|
83
|
-
exports.APPROVAL_RULE_NAME = 'ClickView Group';
|
|
84
|
-
var CLICKVIEW_GROUP_ID = 1069;
|
|
85
|
-
var NEW_APPROVAL_RULE = {
|
|
86
|
-
name: exports.APPROVAL_RULE_NAME,
|
|
87
|
-
approvalsRequired: 1,
|
|
88
|
-
appliesToAllProtectedBranches: false,
|
|
89
|
-
groupIds: [CLICKVIEW_GROUP_ID],
|
|
90
|
-
// The task will fetch "master" and use it's id in this lookup
|
|
91
|
-
protectedBranchIds: []
|
|
92
|
-
};
|
|
93
|
-
var AddApprovalRulesTask = /** @class */ (function (_super) {
|
|
94
|
-
__extends(AddApprovalRulesTask, _super);
|
|
95
|
-
function AddApprovalRulesTask() {
|
|
96
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
97
|
-
}
|
|
98
|
-
AddApprovalRulesTask.prototype.run = function (options) {
|
|
99
|
-
var _a;
|
|
100
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
-
var projectIds, _i, projectIds_1, projectId;
|
|
102
|
-
return __generator(this, function (_b) {
|
|
103
|
-
switch (_b.label) {
|
|
104
|
-
case 0:
|
|
105
|
-
if (!options.projectIds && !options.allProjects) {
|
|
106
|
-
utils_1.Logger.logError('No --projectIds provided and --allProjects option was not selected.');
|
|
107
|
-
return [2 /*return*/, false];
|
|
108
|
-
}
|
|
109
|
-
if (options.allProjects && ((_a = options.projectIds) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
110
|
-
utils_1.Logger.logError('Cannot specify --projectIds and --allProjects option.');
|
|
111
|
-
return [2 /*return*/, false];
|
|
112
|
-
}
|
|
113
|
-
return [4 /*yield*/, this.getProjectIds(options)];
|
|
114
|
-
case 1:
|
|
115
|
-
projectIds = _b.sent();
|
|
116
|
-
utils_1.Logger.logTask('Adding approval rules');
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
case
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
_a.
|
|
168
|
-
|
|
169
|
-
case
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
29
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
31
|
+
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;
|
|
32
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
33
|
+
};
|
|
34
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
35
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
36
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
38
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
40
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
44
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
45
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
46
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
47
|
+
function step(op) {
|
|
48
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
49
|
+
while (_) try {
|
|
50
|
+
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;
|
|
51
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
52
|
+
switch (op[0]) {
|
|
53
|
+
case 0: case 1: t = op; break;
|
|
54
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
55
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
56
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
57
|
+
default:
|
|
58
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
59
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
60
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
61
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
62
|
+
if (t[2]) _.ops.pop();
|
|
63
|
+
_.trys.pop(); continue;
|
|
64
|
+
}
|
|
65
|
+
op = body.call(thisArg, _);
|
|
66
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
67
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
+
exports.AddApprovalRulesTask = exports.APPROVAL_RULE_NAME = void 0;
|
|
72
|
+
require("reflect-metadata");
|
|
73
|
+
var inversify_1 = require("inversify");
|
|
74
|
+
var utils_1 = require("../../utils");
|
|
75
|
+
var BaseConfigureProjectsTask_1 = require("./primitives/BaseConfigureProjectsTask");
|
|
76
|
+
var APPROVAL_RULE_CONFIGURATION = {
|
|
77
|
+
mergeRequestsAuthorApproval: false,
|
|
78
|
+
disableOverridingApproversPerMergeRequest: false,
|
|
79
|
+
mergeRequestsDisableCommittersApproval: false,
|
|
80
|
+
requirePasswordToApprove: false,
|
|
81
|
+
resetApprovalsOnPush: true
|
|
82
|
+
};
|
|
83
|
+
exports.APPROVAL_RULE_NAME = 'ClickView Group';
|
|
84
|
+
var CLICKVIEW_GROUP_ID = 1069;
|
|
85
|
+
var NEW_APPROVAL_RULE = {
|
|
86
|
+
name: exports.APPROVAL_RULE_NAME,
|
|
87
|
+
approvalsRequired: 1,
|
|
88
|
+
appliesToAllProtectedBranches: false,
|
|
89
|
+
groupIds: [CLICKVIEW_GROUP_ID],
|
|
90
|
+
// The task will fetch "master" and use it's id in this lookup
|
|
91
|
+
protectedBranchIds: []
|
|
92
|
+
};
|
|
93
|
+
var AddApprovalRulesTask = /** @class */ (function (_super) {
|
|
94
|
+
__extends(AddApprovalRulesTask, _super);
|
|
95
|
+
function AddApprovalRulesTask() {
|
|
96
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
97
|
+
}
|
|
98
|
+
AddApprovalRulesTask.prototype.run = function (options) {
|
|
99
|
+
var _a;
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var projectIds, success, _i, projectIds_1, projectId;
|
|
102
|
+
return __generator(this, function (_b) {
|
|
103
|
+
switch (_b.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
if (!options.projectIds && !options.allProjects) {
|
|
106
|
+
utils_1.Logger.logError('No --projectIds provided and --allProjects option was not selected.');
|
|
107
|
+
return [2 /*return*/, false];
|
|
108
|
+
}
|
|
109
|
+
if (options.allProjects && ((_a = options.projectIds) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
110
|
+
utils_1.Logger.logError('Cannot specify --projectIds and --allProjects option.');
|
|
111
|
+
return [2 /*return*/, false];
|
|
112
|
+
}
|
|
113
|
+
return [4 /*yield*/, this.getProjectIds(options)];
|
|
114
|
+
case 1:
|
|
115
|
+
projectIds = _b.sent();
|
|
116
|
+
utils_1.Logger.logTask('Adding approval rules');
|
|
117
|
+
success = true;
|
|
118
|
+
_i = 0, projectIds_1 = projectIds;
|
|
119
|
+
_b.label = 2;
|
|
120
|
+
case 2:
|
|
121
|
+
if (!(_i < projectIds_1.length)) return [3 /*break*/, 5];
|
|
122
|
+
projectId = projectIds_1[_i];
|
|
123
|
+
return [4 /*yield*/, this.runProject(projectId)];
|
|
124
|
+
case 3:
|
|
125
|
+
if (!(_b.sent()))
|
|
126
|
+
success = false;
|
|
127
|
+
_b.label = 4;
|
|
128
|
+
case 4:
|
|
129
|
+
_i++;
|
|
130
|
+
return [3 /*break*/, 2];
|
|
131
|
+
case 5: return [2 /*return*/, success];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
AddApprovalRulesTask.prototype.runProject = function (projectId) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
var project, protectedBranches, masterBranch, approvalRules, approvalRule, add, err_1;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
switch (_a.label) {
|
|
141
|
+
case 0: return [4 /*yield*/, this.service.getProject(+projectId)];
|
|
142
|
+
case 1:
|
|
143
|
+
project = _a.sent();
|
|
144
|
+
if (!project) {
|
|
145
|
+
utils_1.Logger.logError("Could not fetch projectId: ".concat(projectId));
|
|
146
|
+
return [2 /*return*/, false];
|
|
147
|
+
}
|
|
148
|
+
return [4 /*yield*/, this.service.getProtectedBranches(projectId)];
|
|
149
|
+
case 2:
|
|
150
|
+
protectedBranches = _a.sent();
|
|
151
|
+
masterBranch = protectedBranches === null || protectedBranches === void 0 ? void 0 : protectedBranches.find(function (b) { return b.name === 'master'; });
|
|
152
|
+
if (!masterBranch) {
|
|
153
|
+
utils_1.Logger.logError("Could not find protected master branch for projectId: ".concat(projectId, "."));
|
|
154
|
+
return [2 /*return*/, false];
|
|
155
|
+
}
|
|
156
|
+
return [4 /*yield*/, this.service.getApprovalRules(projectId)];
|
|
157
|
+
case 3:
|
|
158
|
+
approvalRules = _a.sent();
|
|
159
|
+
approvalRule = approvalRules === null || approvalRules === void 0 ? void 0 : approvalRules.find(function (r) { return r.name === exports.APPROVAL_RULE_NAME; });
|
|
160
|
+
add = true;
|
|
161
|
+
_a.label = 4;
|
|
162
|
+
case 4:
|
|
163
|
+
_a.trys.push([4, 10, , 11]);
|
|
164
|
+
if (!!approvalRule) return [3 /*break*/, 6];
|
|
165
|
+
return [4 /*yield*/, this.service.createApprovalRule(projectId, __assign(__assign({}, NEW_APPROVAL_RULE), { protectedBranchIds: [masterBranch.id] }))];
|
|
166
|
+
case 5:
|
|
167
|
+
_a.sent();
|
|
168
|
+
return [3 /*break*/, 8];
|
|
169
|
+
case 6:
|
|
170
|
+
add = false;
|
|
171
|
+
return [4 /*yield*/, this.service.updateApprovalRule(projectId, approvalRule.id, __assign(__assign({}, NEW_APPROVAL_RULE), { protectedBranchIds: [masterBranch.id] }))];
|
|
172
|
+
case 7:
|
|
173
|
+
_a.sent();
|
|
174
|
+
_a.label = 8;
|
|
175
|
+
case 8: return [4 /*yield*/, this.service.updateApprovalRuleConfiguration(projectId, APPROVAL_RULE_CONFIGURATION)];
|
|
176
|
+
case 9:
|
|
177
|
+
_a.sent();
|
|
178
|
+
return [3 /*break*/, 11];
|
|
179
|
+
case 10:
|
|
180
|
+
err_1 = _a.sent();
|
|
181
|
+
utils_1.Logger.logError("Failed to add approval rules to: ".concat(project.title));
|
|
182
|
+
utils_1.Logger.logError(err_1.message, err_1);
|
|
183
|
+
return [2 /*return*/, false];
|
|
184
|
+
case 11:
|
|
185
|
+
if (add)
|
|
186
|
+
utils_1.Logger.logSuccess("Successfully added approval rules to: ".concat(project.title));
|
|
187
|
+
else
|
|
188
|
+
utils_1.Logger.logInfo("Successfully updated approval rules for: ".concat(project.title));
|
|
189
|
+
return [2 /*return*/, true];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
AddApprovalRulesTask = __decorate([
|
|
195
|
+
(0, inversify_1.injectable)()
|
|
196
|
+
], AddApprovalRulesTask);
|
|
197
|
+
return AddApprovalRulesTask;
|
|
198
|
+
}(BaseConfigureProjectsTask_1.BaseConfigureProjectsTask));
|
|
199
|
+
exports.AddApprovalRulesTask = AddApprovalRulesTask;
|