@clickview/ship-it 0.0.42-dev.1 → 0.0.42
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 +37 -33
- package/README.md +48 -48
- package/config.json +19 -19
- package/lib/config.json +20 -20
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +581 -564
- 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 +76 -76
- 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/ToolingReleaseCommand.js +144 -0
- package/lib/src/commands/ValidateMergeRequestCommand.js +76 -76
- package/lib/src/commands/VersionCommand.js +76 -76
- package/lib/src/commands/index.js +32 -31
- package/lib/src/constants/CommandTypeMapping.js +22 -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/SourceBranch.js +2 -0
- package/lib/src/interfaces/VersionType.js +2 -2
- package/lib/src/interfaces/command-cli-options/DockerMilestoneCommandCliOptions.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/ToolingReleaseCommandCliOptions.js +2 -0
- package/lib/src/interfaces/command-cli-options/index.js +20 -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/ToolingReleaseCommandOptions.js +2 -0
- package/lib/src/interfaces/command-options/ValidateMRCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/index.js +24 -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 +82 -79
- package/lib/src/services/GitLabService.js +556 -553
- 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 +92 -88
- package/lib/src/startup/GetAction.js +68 -68
- package/lib/src/startup/SetupCommands.js +228 -191
- package/lib/src/tasks/BumpPackagesTask.js +230 -230
- package/lib/src/tasks/BumpVersionTxtTask.js +110 -110
- package/lib/src/tasks/{CommitPackageVersionsTask.js → ChangeMilestoneTask.js} +117 -116
- package/lib/src/tasks/CreateBranchTask.js +109 -104
- package/lib/src/tasks/CreateMergeRequestTask.js +126 -126
- package/lib/src/tasks/CreateNotesAuditTask.js +140 -140
- package/lib/src/tasks/CreateReleaseNotesTask.js +144 -144
- package/lib/src/tasks/InstallPackagesTask.js +409 -409
- 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 +164 -164
- package/lib/src/tasks/TagMasterTask.js +200 -196
- package/lib/src/tasks/ValidateCommitsTask.js +210 -210
- package/lib/src/tasks/ValidateDescriptionsTask.js +164 -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 -199
- package/lib/src/tasks/configure-projects/CreateToolingBranchTask.js +138 -138
- 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 +62 -60
- package/lib/src/utils/BranchNames.js +11 -11
- package/lib/src/utils/Commits.js +90 -82
- 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 +48 -48
- package/lib/src/utils/Versions.js +20 -20
- package/lib/src/utils/index.js +22 -22
- package/package.json +50 -50
- package/dist/I3/I3 Notes Audit.csv +0 -127
- package/dist/J1/J1 Notes Audit.csv +0 -38
- package/dist/J2/J2 Notes Audit.csv +0 -52
- package/dist/L1/L1 Notes Audit.csv +0 -139
|
@@ -1,138 +1,138 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
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;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
33
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
-
function step(op) {
|
|
37
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
-
while (_) try {
|
|
39
|
-
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;
|
|
40
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
-
switch (op[0]) {
|
|
42
|
-
case 0: case 1: t = op; break;
|
|
43
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
-
default:
|
|
47
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
-
if (t[2]) _.ops.pop();
|
|
52
|
-
_.trys.pop(); continue;
|
|
53
|
-
}
|
|
54
|
-
op = body.call(thisArg, _);
|
|
55
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.CreateToolingBranchTask = void 0;
|
|
61
|
-
require("reflect-metadata");
|
|
62
|
-
var inversify_1 = require("inversify");
|
|
63
|
-
var utils_1 = require("../../utils");
|
|
64
|
-
var BaseConfigureProjectsTask_1 = require("./primitives/BaseConfigureProjectsTask");
|
|
65
|
-
var TOOLING_BRANCH_NAME = 'tooling';
|
|
66
|
-
var CreateToolingBranchTask = /** @class */ (function (_super) {
|
|
67
|
-
__extends(CreateToolingBranchTask, _super);
|
|
68
|
-
function CreateToolingBranchTask() {
|
|
69
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
70
|
-
}
|
|
71
|
-
CreateToolingBranchTask.prototype.run = function (options) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var projectIds, _i, projectIds_1, projectId;
|
|
74
|
-
return __generator(this, function (_a) {
|
|
75
|
-
switch (_a.label) {
|
|
76
|
-
case 0: return [4 /*yield*/, this.getProjectIds(options)];
|
|
77
|
-
case 1:
|
|
78
|
-
projectIds = _a.sent();
|
|
79
|
-
utils_1.Logger.logTask('Adding "tooling" branch to all projects');
|
|
80
|
-
_i = 0, projectIds_1 = projectIds;
|
|
81
|
-
_a.label = 2;
|
|
82
|
-
case 2:
|
|
83
|
-
if (!(_i < projectIds_1.length)) return [3 /*break*/, 5];
|
|
84
|
-
projectId = projectIds_1[_i];
|
|
85
|
-
return [4 /*yield*/, this.runProject(projectId)];
|
|
86
|
-
case 3:
|
|
87
|
-
if (!(_a.sent()))
|
|
88
|
-
return [2 /*return*/, false];
|
|
89
|
-
_a.label = 4;
|
|
90
|
-
case 4:
|
|
91
|
-
_i++;
|
|
92
|
-
return [3 /*break*/, 2];
|
|
93
|
-
case 5: return [2 /*return*/, true];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
CreateToolingBranchTask.prototype.runProject = function (projectId) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
var project, toolingBranch, masterBranch;
|
|
101
|
-
return __generator(this, function (_a) {
|
|
102
|
-
switch (_a.label) {
|
|
103
|
-
case 0: return [4 /*yield*/, this.service.getProject(+projectId)];
|
|
104
|
-
case 1:
|
|
105
|
-
project = _a.sent();
|
|
106
|
-
if (!project) {
|
|
107
|
-
utils_1.Logger.logError("Could not fetch projectId: ".concat(projectId));
|
|
108
|
-
return [2 /*return*/, false];
|
|
109
|
-
}
|
|
110
|
-
return [4 /*yield*/, this.service.getBranch(projectId, TOOLING_BRANCH_NAME)];
|
|
111
|
-
case 2:
|
|
112
|
-
toolingBranch = _a.sent();
|
|
113
|
-
if (toolingBranch) {
|
|
114
|
-
utils_1.Logger.logInfo("\"tooling\" branch already exists for project: ".concat(project.title));
|
|
115
|
-
return [2 /*return*/, true];
|
|
116
|
-
}
|
|
117
|
-
return [4 /*yield*/, this.service.getBranch(projectId, 'master')];
|
|
118
|
-
case 3:
|
|
119
|
-
masterBranch = _a.sent();
|
|
120
|
-
if (!masterBranch) {
|
|
121
|
-
utils_1.Logger.logError("Could not find master branch to branch from for projectId: ".concat(projectId, "."));
|
|
122
|
-
return [2 /*return*/, false];
|
|
123
|
-
}
|
|
124
|
-
return [4 /*yield*/, this.service.createBranch(project, masterBranch.name, TOOLING_BRANCH_NAME)];
|
|
125
|
-
case 4:
|
|
126
|
-
_a.sent();
|
|
127
|
-
utils_1.Logger.logSuccess("Successfully added a \"tooling\" branch to project: ".concat(project.title));
|
|
128
|
-
return [2 /*return*/, true];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
CreateToolingBranchTask = __decorate([
|
|
134
|
-
(0, inversify_1.injectable)()
|
|
135
|
-
], CreateToolingBranchTask);
|
|
136
|
-
return CreateToolingBranchTask;
|
|
137
|
-
}(BaseConfigureProjectsTask_1.BaseConfigureProjectsTask));
|
|
138
|
-
exports.CreateToolingBranchTask = CreateToolingBranchTask;
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
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;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
33
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
+
function step(op) {
|
|
37
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
+
while (_) try {
|
|
39
|
+
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;
|
|
40
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
+
switch (op[0]) {
|
|
42
|
+
case 0: case 1: t = op; break;
|
|
43
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
+
default:
|
|
47
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
+
if (t[2]) _.ops.pop();
|
|
52
|
+
_.trys.pop(); continue;
|
|
53
|
+
}
|
|
54
|
+
op = body.call(thisArg, _);
|
|
55
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.CreateToolingBranchTask = void 0;
|
|
61
|
+
require("reflect-metadata");
|
|
62
|
+
var inversify_1 = require("inversify");
|
|
63
|
+
var utils_1 = require("../../utils");
|
|
64
|
+
var BaseConfigureProjectsTask_1 = require("./primitives/BaseConfigureProjectsTask");
|
|
65
|
+
var TOOLING_BRANCH_NAME = 'tooling';
|
|
66
|
+
var CreateToolingBranchTask = /** @class */ (function (_super) {
|
|
67
|
+
__extends(CreateToolingBranchTask, _super);
|
|
68
|
+
function CreateToolingBranchTask() {
|
|
69
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
70
|
+
}
|
|
71
|
+
CreateToolingBranchTask.prototype.run = function (options) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var projectIds, _i, projectIds_1, projectId;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0: return [4 /*yield*/, this.getProjectIds(options)];
|
|
77
|
+
case 1:
|
|
78
|
+
projectIds = _a.sent();
|
|
79
|
+
utils_1.Logger.logTask('Adding "tooling" branch to all projects');
|
|
80
|
+
_i = 0, projectIds_1 = projectIds;
|
|
81
|
+
_a.label = 2;
|
|
82
|
+
case 2:
|
|
83
|
+
if (!(_i < projectIds_1.length)) return [3 /*break*/, 5];
|
|
84
|
+
projectId = projectIds_1[_i];
|
|
85
|
+
return [4 /*yield*/, this.runProject(projectId)];
|
|
86
|
+
case 3:
|
|
87
|
+
if (!(_a.sent()))
|
|
88
|
+
return [2 /*return*/, false];
|
|
89
|
+
_a.label = 4;
|
|
90
|
+
case 4:
|
|
91
|
+
_i++;
|
|
92
|
+
return [3 /*break*/, 2];
|
|
93
|
+
case 5: return [2 /*return*/, true];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
CreateToolingBranchTask.prototype.runProject = function (projectId) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
var project, toolingBranch, masterBranch;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0: return [4 /*yield*/, this.service.getProject(+projectId)];
|
|
104
|
+
case 1:
|
|
105
|
+
project = _a.sent();
|
|
106
|
+
if (!project) {
|
|
107
|
+
utils_1.Logger.logError("Could not fetch projectId: ".concat(projectId));
|
|
108
|
+
return [2 /*return*/, false];
|
|
109
|
+
}
|
|
110
|
+
return [4 /*yield*/, this.service.getBranch(projectId, TOOLING_BRANCH_NAME)];
|
|
111
|
+
case 2:
|
|
112
|
+
toolingBranch = _a.sent();
|
|
113
|
+
if (toolingBranch) {
|
|
114
|
+
utils_1.Logger.logInfo("\"tooling\" branch already exists for project: ".concat(project.title));
|
|
115
|
+
return [2 /*return*/, true];
|
|
116
|
+
}
|
|
117
|
+
return [4 /*yield*/, this.service.getBranch(projectId, 'master')];
|
|
118
|
+
case 3:
|
|
119
|
+
masterBranch = _a.sent();
|
|
120
|
+
if (!masterBranch) {
|
|
121
|
+
utils_1.Logger.logError("Could not find master branch to branch from for projectId: ".concat(projectId, "."));
|
|
122
|
+
return [2 /*return*/, false];
|
|
123
|
+
}
|
|
124
|
+
return [4 /*yield*/, this.service.createBranch(project, masterBranch.name, TOOLING_BRANCH_NAME)];
|
|
125
|
+
case 4:
|
|
126
|
+
_a.sent();
|
|
127
|
+
utils_1.Logger.logSuccess("Successfully added a \"tooling\" branch to project: ".concat(project.title));
|
|
128
|
+
return [2 /*return*/, true];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
CreateToolingBranchTask = __decorate([
|
|
134
|
+
(0, inversify_1.injectable)()
|
|
135
|
+
], CreateToolingBranchTask);
|
|
136
|
+
return CreateToolingBranchTask;
|
|
137
|
+
}(BaseConfigureProjectsTask_1.BaseConfigureProjectsTask));
|
|
138
|
+
exports.CreateToolingBranchTask = CreateToolingBranchTask;
|
|
@@ -1,106 +1,106 @@
|
|
|
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.EnsureApprovalRulesTask = 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 AddApprovalRulesTask_1 = require("../../tasks/configure-projects/AddApprovalRulesTask");
|
|
58
|
-
var EnsureApprovalRulesTask = /** @class */ (function () {
|
|
59
|
-
function EnsureApprovalRulesTask(service) {
|
|
60
|
-
this.service = service;
|
|
61
|
-
}
|
|
62
|
-
EnsureApprovalRulesTask.prototype.run = function (options) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
var success, projects, _i, projects_1, project, approvalRules, approvalRule;
|
|
65
|
-
return __generator(this, function (_a) {
|
|
66
|
-
switch (_a.label) {
|
|
67
|
-
case 0:
|
|
68
|
-
utils_1.Logger.logTask('Ensuring Approval Rules');
|
|
69
|
-
success = true;
|
|
70
|
-
return [4 /*yield*/, this.service.
|
|
71
|
-
case 1:
|
|
72
|
-
projects = _a.sent();
|
|
73
|
-
_i = 0, projects_1 = projects;
|
|
74
|
-
_a.label = 2;
|
|
75
|
-
case 2:
|
|
76
|
-
if (!(_i < projects_1.length)) return [3 /*break*/, 5];
|
|
77
|
-
project = projects_1[_i];
|
|
78
|
-
return [4 /*yield*/, this.service.getApprovalRules(project.id)];
|
|
79
|
-
case 3:
|
|
80
|
-
approvalRules = _a.sent();
|
|
81
|
-
approvalRule = approvalRules === null || approvalRules === void 0 ? void 0 : approvalRules.find(function (r) { return r.name === AddApprovalRulesTask_1.APPROVAL_RULE_NAME; });
|
|
82
|
-
if (!approvalRule) {
|
|
83
|
-
utils_1.Logger.logError("Approval rule not found for project: ".concat(project.title));
|
|
84
|
-
success = false;
|
|
85
|
-
}
|
|
86
|
-
_a.label = 4;
|
|
87
|
-
case 4:
|
|
88
|
-
_i++;
|
|
89
|
-
return [3 /*break*/, 2];
|
|
90
|
-
case 5:
|
|
91
|
-
if (success) {
|
|
92
|
-
utils_1.Logger.logSuccess('Approval rules are configured for all projects');
|
|
93
|
-
}
|
|
94
|
-
return [2 /*return*/, success];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
EnsureApprovalRulesTask = __decorate([
|
|
100
|
-
(0, inversify_1.injectable)(),
|
|
101
|
-
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
102
|
-
__metadata("design:paramtypes", [services_1.GitLabService])
|
|
103
|
-
], EnsureApprovalRulesTask);
|
|
104
|
-
return EnsureApprovalRulesTask;
|
|
105
|
-
}());
|
|
106
|
-
exports.EnsureApprovalRulesTask = EnsureApprovalRulesTask;
|
|
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.EnsureApprovalRulesTask = 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 AddApprovalRulesTask_1 = require("../../tasks/configure-projects/AddApprovalRulesTask");
|
|
58
|
+
var EnsureApprovalRulesTask = /** @class */ (function () {
|
|
59
|
+
function EnsureApprovalRulesTask(service) {
|
|
60
|
+
this.service = service;
|
|
61
|
+
}
|
|
62
|
+
EnsureApprovalRulesTask.prototype.run = function (options) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
+
var success, projects, _i, projects_1, project, approvalRules, approvalRule;
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
switch (_a.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
utils_1.Logger.logTask('Ensuring Approval Rules');
|
|
69
|
+
success = true;
|
|
70
|
+
return [4 /*yield*/, this.service.getReleaseProjects(options.milestone, options.projectIds, options.omittedProjectIds, options.sourceBranch)];
|
|
71
|
+
case 1:
|
|
72
|
+
projects = _a.sent();
|
|
73
|
+
_i = 0, projects_1 = projects;
|
|
74
|
+
_a.label = 2;
|
|
75
|
+
case 2:
|
|
76
|
+
if (!(_i < projects_1.length)) return [3 /*break*/, 5];
|
|
77
|
+
project = projects_1[_i];
|
|
78
|
+
return [4 /*yield*/, this.service.getApprovalRules(project.id)];
|
|
79
|
+
case 3:
|
|
80
|
+
approvalRules = _a.sent();
|
|
81
|
+
approvalRule = approvalRules === null || approvalRules === void 0 ? void 0 : approvalRules.find(function (r) { return r.name === AddApprovalRulesTask_1.APPROVAL_RULE_NAME; });
|
|
82
|
+
if (!approvalRule) {
|
|
83
|
+
utils_1.Logger.logError("Approval rule not found for project: ".concat(project.title));
|
|
84
|
+
success = false;
|
|
85
|
+
}
|
|
86
|
+
_a.label = 4;
|
|
87
|
+
case 4:
|
|
88
|
+
_i++;
|
|
89
|
+
return [3 /*break*/, 2];
|
|
90
|
+
case 5:
|
|
91
|
+
if (success) {
|
|
92
|
+
utils_1.Logger.logSuccess('Approval rules are configured for all projects');
|
|
93
|
+
}
|
|
94
|
+
return [2 /*return*/, success];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
EnsureApprovalRulesTask = __decorate([
|
|
100
|
+
(0, inversify_1.injectable)(),
|
|
101
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
102
|
+
__metadata("design:paramtypes", [services_1.GitLabService])
|
|
103
|
+
], EnsureApprovalRulesTask);
|
|
104
|
+
return EnsureApprovalRulesTask;
|
|
105
|
+
}());
|
|
106
|
+
exports.EnsureApprovalRulesTask = EnsureApprovalRulesTask;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./AddApprovalRulesTask"), exports);
|
|
18
|
-
__exportStar(require("./CreateToolingBranchTask"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AddApprovalRulesTask"), exports);
|
|
18
|
+
__exportStar(require("./CreateToolingBranchTask"), exports);
|