@clickview/ship-it 0.0.25 → 0.0.27-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +33 -0
- package/README.md +48 -48
- package/config.json +19 -10
- package/dist/F1/Analytics Web.md +8 -0
- package/dist/F1/AutoCaptions.md +30 -0
- package/dist/F1/Classroom.Api.md +23 -0
- package/dist/F1/ClickView Online.md +17 -0
- package/dist/F1/ClickView.Curator.md +100 -0
- package/dist/F1/ClickView.EmailService.md +53 -0
- package/dist/F1/ClickView.OnlineApi.md +13 -0
- package/dist/F1/Clients.md +19 -0
- package/dist/F1/Domain.Api.md +23 -0
- package/dist/F1/Exchange.Web.md +8 -0
- package/dist/F1/Image.Api.md +8 -0
- package/dist/F1/Integrations.Api.md +23 -0
- package/dist/F1/Krakend.md +8 -0
- package/dist/F1/Library Editor.md +0 -0
- package/dist/F1/Lite.md +60 -0
- package/dist/F1/Master.Api.md +58 -0
- package/dist/F1/Master.Auth.md +22 -0
- package/dist/F1/Objects.Api.md +12 -0
- package/dist/F1/Permissions.Api.md +12 -0
- package/dist/F1/RealtimeSalesforceSync.md +14 -0
- package/dist/F1/Release Notes.md +990 -0
- package/dist/F1/Search.Api.md +12 -0
- package/dist/F1/StreamableLearning.Web.md +35 -0
- package/dist/F1/Users.Api.md +13 -0
- package/dist/F1/VideoProcessorService.md +23 -0
- package/dist/F1/clickview.md +321 -0
- package/dist/F2/Analytics Web.md +7 -0
- package/dist/F2/Batch.Api.md +27 -0
- package/dist/F2/ClickView Online.md +12 -0
- package/dist/F2/ClickView.Curator.md +166 -0
- package/dist/F2/Clients.md +14 -0
- package/dist/F2/CurriculumIngestion.Api.md +13 -0
- package/dist/F2/Discover.Api.md +64 -0
- package/dist/F2/Domain.Api.md +16 -0
- package/dist/F2/Exchange.Web.md +7 -0
- package/dist/F2/Krakend.md +12 -0
- package/dist/F2/Library Editor.md +11 -0
- package/dist/F2/Lite.md +30 -0
- package/dist/F2/Objects.Api.md +12 -0
- package/dist/F2/Release Notes.md +759 -0
- package/dist/F2/Search.Api.md +30 -0
- package/dist/F2/Share.Api.md +12 -0
- package/dist/F2/StreamableLearning.Web.md +14 -0
- package/dist/F2/Subjects.API.md +12 -0
- package/dist/F2/Tv.Web.md +8 -0
- package/dist/F2/Users.Api.md +21 -0
- package/dist/F2/clickview.md +200 -0
- package/dist/F2/shortcode-api.md +8 -0
- package/dist/F3.1/Analytics Web.md +8 -0
- package/dist/F3.1/ClickView.Curator.md +14 -0
- package/dist/F3.1/Discover.Api.md +14 -0
- package/dist/F3.1/Domain.Api.md +7 -0
- package/dist/F3.1/Exchange.Web.md +8 -0
- package/dist/F3.1/Library Editor.md +8 -0
- package/dist/F3.1/Lite.md +8 -0
- package/dist/F3.1/Objects.Api.md +7 -0
- package/dist/F3.1/Release Notes.md +207 -0
- package/dist/F3.1/Search.Api.md +14 -0
- package/dist/F3.1/Share.Api.md +10 -0
- package/dist/F3.1/Subjects.API.md +35 -0
- package/dist/F3.1/VideoViews.Api.md +7 -0
- package/dist/F3.1/clickview.md +28 -0
- package/lib/config.json +20 -11
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +423 -404
- package/lib/src/api-clients/git-lab/GitLabMapper.js +82 -81
- package/lib/src/api-clients/index.js +20 -18
- package/lib/src/api-clients/slack/SlackApiClient.js +206 -0
- package/lib/src/api-clients/team-city/TeamCityApiClient.js +100 -100
- package/lib/src/api-clients/trello/TrelloApiClient.js +145 -0
- 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 +95 -84
- package/lib/src/commands/CreateTestingNotesCommand.js +84 -84
- package/lib/src/commands/CreateTrelloCardsCommand.js +77 -0
- package/lib/src/commands/InstallPackagesCommand.js +76 -76
- package/lib/src/commands/ListProjectsCommand.js +76 -76
- package/lib/src/commands/ReleaseCommand.js +117 -129
- package/lib/src/commands/StartConsumingProjectBuildsCommand.js +76 -76
- package/lib/src/commands/StartProjectBuildsCommand.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 +30 -29
- package/lib/src/constants/CommandTypeMapping.js +20 -19
- package/lib/src/constants/GitLabMemberIds.js +6 -6
- package/lib/src/constants/MonorepoPackageJsonFiles.js +17 -17
- package/lib/src/constants/MonorepoProjectNames.js +16 -16
- package/lib/src/constants/ProjectNames.js +68 -67
- package/lib/src/constants/SlackUserEmailList.js +13 -0
- package/lib/src/constants/TeamCityBuildIDs.js +45 -44
- 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 -0
- package/lib/src/interfaces/command-cli-options/index.js +19 -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/StatusCommandOptions.js +2 -0
- package/lib/src/interfaces/command-options/ValidateMRCommandOptions.js +2 -2
- package/lib/src/interfaces/command-options/index.js +22 -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 +75 -67
- package/lib/src/services/GitLabService.js +505 -498
- package/lib/src/services/SlackService.js +139 -0
- package/lib/src/services/TeamCityService.js +37 -37
- package/lib/src/services/TrelloService.js +84 -0
- package/lib/src/services/index.js +20 -18
- package/lib/src/startup/AddMilestoneCommand.js +95 -95
- package/lib/src/startup/GetAction.js +68 -68
- package/lib/src/startup/SetupCommands.js +169 -128
- 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 +144 -122
- package/lib/src/tasks/CreateTestingNotesTask.js +135 -135
- package/lib/src/tasks/InstallPackagesTask.js +407 -407
- package/lib/src/tasks/ListProjectsTask.js +87 -87
- package/lib/src/tasks/PopulateTrelloBoardTask.js +140 -0
- package/lib/src/tasks/StartConsumingProjectBuildsTask.js +149 -149
- package/lib/src/tasks/StartMonorepoBuildTask.js +109 -109
- package/lib/src/tasks/StartProjectBuildsTask.js +170 -149
- package/lib/src/tasks/TagMasterTask.js +121 -121
- package/lib/src/tasks/ValidateCommitsTask.js +143 -119
- package/lib/src/tasks/ValidateDescriptionsTask.js +178 -151
- package/lib/src/tasks/ValidateMergeRequestTask.js +115 -115
- package/lib/src/tasks/ValidateTask.js +419 -240
- package/lib/src/tasks/VersionTask.js +98 -98
- package/lib/src/tasks/index.js +34 -33
- package/lib/src/types.js +57 -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 +50 -47
|
@@ -1,87 +1,87 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
19
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (_) try {
|
|
24
|
-
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;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.ListProjectsTask = void 0;
|
|
49
|
-
var lodash_1 = __importDefault(require("lodash"));
|
|
50
|
-
require("reflect-metadata");
|
|
51
|
-
var inversify_1 = require("inversify");
|
|
52
|
-
var utils_1 = require("../utils");
|
|
53
|
-
var constants_1 = require("../constants");
|
|
54
|
-
var ListProjectsTask = /** @class */ (function () {
|
|
55
|
-
function ListProjectsTask() {
|
|
56
|
-
}
|
|
57
|
-
ListProjectsTask.prototype.run = function () {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
utils_1.Logger.logTask('Listing projects');
|
|
61
|
-
this.logAvailableProjects(constants_1.PROJECT_NAMES);
|
|
62
|
-
utils_1.Logger.logSuccess("Available project names are listed above to be used for -p arg\n");
|
|
63
|
-
return [2 /*return*/, true];
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
ListProjectsTask.prototype.logAvailableProjects = function (projectNames) {
|
|
68
|
-
for (var _i = 0, _a = Object.keys(projectNames); _i < _a.length; _i++) {
|
|
69
|
-
var key = _a[_i];
|
|
70
|
-
var groupTitle = "".concat(lodash_1.default.capitalize(key), " project names:");
|
|
71
|
-
this.logProjectsByGroup(groupTitle, projectNames[key]);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
ListProjectsTask.prototype.logProjectsByGroup = function (groupName, projectInfo) {
|
|
75
|
-
utils_1.Logger.logMessage(groupName);
|
|
76
|
-
for (var _i = 0, _a = Object.keys(projectInfo); _i < _a.length; _i++) {
|
|
77
|
-
var key = _a[_i];
|
|
78
|
-
utils_1.Logger.logInfo(key);
|
|
79
|
-
}
|
|
80
|
-
utils_1.Logger.logInfo('');
|
|
81
|
-
};
|
|
82
|
-
ListProjectsTask = __decorate([
|
|
83
|
-
(0, inversify_1.injectable)()
|
|
84
|
-
], ListProjectsTask);
|
|
85
|
-
return ListProjectsTask;
|
|
86
|
-
}());
|
|
87
|
-
exports.ListProjectsTask = ListProjectsTask;
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
19
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (_) try {
|
|
24
|
+
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;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.ListProjectsTask = void 0;
|
|
49
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
50
|
+
require("reflect-metadata");
|
|
51
|
+
var inversify_1 = require("inversify");
|
|
52
|
+
var utils_1 = require("../utils");
|
|
53
|
+
var constants_1 = require("../constants");
|
|
54
|
+
var ListProjectsTask = /** @class */ (function () {
|
|
55
|
+
function ListProjectsTask() {
|
|
56
|
+
}
|
|
57
|
+
ListProjectsTask.prototype.run = function () {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
utils_1.Logger.logTask('Listing projects');
|
|
61
|
+
this.logAvailableProjects(constants_1.PROJECT_NAMES);
|
|
62
|
+
utils_1.Logger.logSuccess("Available project names are listed above to be used for -p arg\n");
|
|
63
|
+
return [2 /*return*/, true];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
ListProjectsTask.prototype.logAvailableProjects = function (projectNames) {
|
|
68
|
+
for (var _i = 0, _a = Object.keys(projectNames); _i < _a.length; _i++) {
|
|
69
|
+
var key = _a[_i];
|
|
70
|
+
var groupTitle = "".concat(lodash_1.default.capitalize(key), " project names:");
|
|
71
|
+
this.logProjectsByGroup(groupTitle, projectNames[key]);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
ListProjectsTask.prototype.logProjectsByGroup = function (groupName, projectInfo) {
|
|
75
|
+
utils_1.Logger.logMessage(groupName);
|
|
76
|
+
for (var _i = 0, _a = Object.keys(projectInfo); _i < _a.length; _i++) {
|
|
77
|
+
var key = _a[_i];
|
|
78
|
+
utils_1.Logger.logInfo(key);
|
|
79
|
+
}
|
|
80
|
+
utils_1.Logger.logInfo('');
|
|
81
|
+
};
|
|
82
|
+
ListProjectsTask = __decorate([
|
|
83
|
+
(0, inversify_1.injectable)()
|
|
84
|
+
], ListProjectsTask);
|
|
85
|
+
return ListProjectsTask;
|
|
86
|
+
}());
|
|
87
|
+
exports.ListProjectsTask = ListProjectsTask;
|
|
@@ -0,0 +1,140 @@
|
|
|
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.PopulateTrelloBoardTask = 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 IN_RELEASE_LIST_NAME = 'Created Release';
|
|
58
|
+
var IN_PROD_LIST_NAME = 'In Production';
|
|
59
|
+
var PopulateTrelloBoardTask = /** @class */ (function () {
|
|
60
|
+
function PopulateTrelloBoardTask(service, trelloService) {
|
|
61
|
+
this.service = service;
|
|
62
|
+
this.trelloService = trelloService;
|
|
63
|
+
}
|
|
64
|
+
PopulateTrelloBoardTask.prototype.run = function (options) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
+
var projects, listProdId, releaseListId, _i, projects_1, project, _a, tag, branchName, nextVersion, description, mergeRequest, cardId;
|
|
67
|
+
return __generator(this, function (_b) {
|
|
68
|
+
switch (_b.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
utils_1.Logger.logTask('Starting Trello Board population');
|
|
71
|
+
return [4 /*yield*/, this.service.getProjects(options)];
|
|
72
|
+
case 1:
|
|
73
|
+
projects = _b.sent();
|
|
74
|
+
utils_1.Logger.logMessage("Found ".concat(projects.length, " projects that need to be released"));
|
|
75
|
+
return [4 /*yield*/, this.trelloService.getBoardListId(IN_PROD_LIST_NAME)];
|
|
76
|
+
case 2:
|
|
77
|
+
listProdId = _b.sent();
|
|
78
|
+
return [4 /*yield*/, this.trelloService.getBoardListId(IN_RELEASE_LIST_NAME)];
|
|
79
|
+
case 3:
|
|
80
|
+
releaseListId = _b.sent();
|
|
81
|
+
if (!listProdId) {
|
|
82
|
+
utils_1.Logger.logMessage('Could not find Production Board ID!');
|
|
83
|
+
return [2 /*return*/, false];
|
|
84
|
+
}
|
|
85
|
+
if (!releaseListId) {
|
|
86
|
+
utils_1.Logger.logMessage('Could not find Release Board ID!');
|
|
87
|
+
return [2 /*return*/, false];
|
|
88
|
+
}
|
|
89
|
+
return [4 /*yield*/, this.trelloService.deleteAllCardsInList(listProdId)];
|
|
90
|
+
case 4:
|
|
91
|
+
// Delete all cards from the board
|
|
92
|
+
if (!(_b.sent()))
|
|
93
|
+
return [2 /*return*/, false];
|
|
94
|
+
return [4 /*yield*/, this.trelloService.deleteAllCardsInList(releaseListId)];
|
|
95
|
+
case 5:
|
|
96
|
+
if (!(_b.sent()))
|
|
97
|
+
return [2 /*return*/, false];
|
|
98
|
+
utils_1.Logger.logMessage('Deleted all cards from previous release!');
|
|
99
|
+
utils_1.Logger.logMessage('Starting to create new cards for current release!');
|
|
100
|
+
_i = 0, projects_1 = projects;
|
|
101
|
+
_b.label = 6;
|
|
102
|
+
case 6:
|
|
103
|
+
if (!(_i < projects_1.length)) return [3 /*break*/, 11];
|
|
104
|
+
project = projects_1[_i];
|
|
105
|
+
return [4 /*yield*/, this.service.getNextBranchInfo(project.id, options.version)];
|
|
106
|
+
case 7:
|
|
107
|
+
_a = _b.sent(), tag = _a.tag, branchName = _a.branchName;
|
|
108
|
+
nextVersion = utils_1.Versions.getNextVersion(tag.name, options.version);
|
|
109
|
+
description = '';
|
|
110
|
+
return [4 /*yield*/, this.service.getMergeRequest(project.id, branchName, 'opened')];
|
|
111
|
+
case 8:
|
|
112
|
+
mergeRequest = _b.sent();
|
|
113
|
+
if (mergeRequest) {
|
|
114
|
+
description = mergeRequest.url;
|
|
115
|
+
}
|
|
116
|
+
return [4 /*yield*/, this.trelloService.createCard("[".concat(nextVersion, "]: ").concat(project.title), description, releaseListId)];
|
|
117
|
+
case 9:
|
|
118
|
+
cardId = _b.sent();
|
|
119
|
+
if (cardId) {
|
|
120
|
+
utils_1.Logger.logMessage("New card has been created for ".concat(project.title));
|
|
121
|
+
}
|
|
122
|
+
_b.label = 10;
|
|
123
|
+
case 10:
|
|
124
|
+
_i++;
|
|
125
|
+
return [3 /*break*/, 6];
|
|
126
|
+
case 11: return [2 /*return*/, true];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
PopulateTrelloBoardTask = __decorate([
|
|
132
|
+
(0, inversify_1.injectable)(),
|
|
133
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
134
|
+
__param(1, (0, inversify_1.inject)(types_1.SERVICES.TrelloService)),
|
|
135
|
+
__metadata("design:paramtypes", [services_1.GitLabService,
|
|
136
|
+
services_1.TrelloService])
|
|
137
|
+
], PopulateTrelloBoardTask);
|
|
138
|
+
return PopulateTrelloBoardTask;
|
|
139
|
+
}());
|
|
140
|
+
exports.PopulateTrelloBoardTask = PopulateTrelloBoardTask;
|
|
@@ -1,149 +1,149 @@
|
|
|
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.StartConsumingProjectBuildsTask = void 0;
|
|
52
|
-
require("reflect-metadata");
|
|
53
|
-
var inversify_1 = require("inversify");
|
|
54
|
-
var utils_1 = require("../utils");
|
|
55
|
-
var services_1 = require("../services");
|
|
56
|
-
var types_1 = require("../types");
|
|
57
|
-
var TeamCityBuildIDs_1 = require("../constants/TeamCityBuildIDs");
|
|
58
|
-
var StartConsumingProjectBuildsTask = /** @class */ (function () {
|
|
59
|
-
function StartConsumingProjectBuildsTask(teamCityService, gitLabService) {
|
|
60
|
-
this.teamCityService = teamCityService;
|
|
61
|
-
this.gitLabService = gitLabService;
|
|
62
|
-
}
|
|
63
|
-
StartConsumingProjectBuildsTask.prototype.run = function (_options) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var milestone, options, projects, consumingProjects, projectBuildMap, _i, consumingProjects_1, project, branchName, buildId, build, totalBuilds, project;
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0:
|
|
69
|
-
utils_1.Logger.logTask('Starting builds for consuming projects in TeamCity');
|
|
70
|
-
if (!_options.monorepoBranchName && !_options.milestone) {
|
|
71
|
-
utils_1.Logger.logError('Please provide either a milestone or branch name argument.');
|
|
72
|
-
return [2 /*return*/, false];
|
|
73
|
-
}
|
|
74
|
-
milestone = _options.milestone;
|
|
75
|
-
if (!!milestone) return [3 /*break*/, 2];
|
|
76
|
-
utils_1.Logger.logInfo("Searching for a merge request in project \"monorepo\" with branch name \"".concat(_options.monorepoBranchName, "\"..."));
|
|
77
|
-
return [4 /*yield*/, this.gitLabService.getMilestoneByBranchName(utils_1.ProjectIds.MONOREPO_PROJECT_ID, _options.monorepoBranchName)];
|
|
78
|
-
case 1:
|
|
79
|
-
milestone = _a.sent();
|
|
80
|
-
_a.label = 2;
|
|
81
|
-
case 2:
|
|
82
|
-
if (!milestone)
|
|
83
|
-
return [2 /*return*/, false];
|
|
84
|
-
utils_1.Logger.logInfo("Found milestone \"".concat(milestone, "\". Proceeding to run builds for consuming projects..."));
|
|
85
|
-
options = {
|
|
86
|
-
version: _options.version,
|
|
87
|
-
projectIds: _options.projectIds,
|
|
88
|
-
omittedProjectIds: _options.omittedProjectIds,
|
|
89
|
-
milestone: milestone
|
|
90
|
-
};
|
|
91
|
-
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
92
|
-
case 3:
|
|
93
|
-
projects = _a.sent();
|
|
94
|
-
consumingProjects = projects.filter(function (p) { return p.id.toString() !== utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
95
|
-
if (!consumingProjects.length) {
|
|
96
|
-
utils_1.Logger.logError("No projects that consume monorepo could be found");
|
|
97
|
-
return [2 /*return*/, false];
|
|
98
|
-
}
|
|
99
|
-
projectBuildMap = {};
|
|
100
|
-
_i = 0, consumingProjects_1 = consumingProjects;
|
|
101
|
-
_a.label = 4;
|
|
102
|
-
case 4:
|
|
103
|
-
if (!(_i < consumingProjects_1.length)) return [3 /*break*/, 8];
|
|
104
|
-
project = consumingProjects_1[_i];
|
|
105
|
-
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(project.id, options.milestone)];
|
|
106
|
-
case 5:
|
|
107
|
-
branchName = _a.sent();
|
|
108
|
-
if (!branchName) {
|
|
109
|
-
utils_1.Logger.logWarning("Release branch in project \"".concat(project.title, "\" with milestone \"").concat(options.milestone, "\" was not found. Skipping project..."));
|
|
110
|
-
return [3 /*break*/, 7];
|
|
111
|
-
}
|
|
112
|
-
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id.toString()];
|
|
113
|
-
if (!buildId) {
|
|
114
|
-
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
115
|
-
return [3 /*break*/, 7];
|
|
116
|
-
}
|
|
117
|
-
return [4 /*yield*/, this.teamCityService.startBuild(buildId, branchName)];
|
|
118
|
-
case 6:
|
|
119
|
-
build = _a.sent();
|
|
120
|
-
projectBuildMap[project.title] = build;
|
|
121
|
-
_a.label = 7;
|
|
122
|
-
case 7:
|
|
123
|
-
_i++;
|
|
124
|
-
return [3 /*break*/, 4];
|
|
125
|
-
case 8:
|
|
126
|
-
totalBuilds = Object.keys(projectBuildMap).length;
|
|
127
|
-
if (!totalBuilds) {
|
|
128
|
-
utils_1.Logger.logWarning("No releases found in consuming projects with milestone \"".concat(options.milestone, "\"."));
|
|
129
|
-
return [2 /*return*/, true];
|
|
130
|
-
}
|
|
131
|
-
utils_1.Logger.logSuccess("Successfully started builds in ".concat(totalBuilds, " projects."));
|
|
132
|
-
for (project in projectBuildMap) {
|
|
133
|
-
utils_1.Logger.logInfo("[".concat(project, "]: ").concat(projectBuildMap[project].webUrl));
|
|
134
|
-
}
|
|
135
|
-
return [2 /*return*/, true];
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
StartConsumingProjectBuildsTask = __decorate([
|
|
141
|
-
(0, inversify_1.injectable)(),
|
|
142
|
-
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
143
|
-
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
144
|
-
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
145
|
-
services_1.GitLabService])
|
|
146
|
-
], StartConsumingProjectBuildsTask);
|
|
147
|
-
return StartConsumingProjectBuildsTask;
|
|
148
|
-
}());
|
|
149
|
-
exports.StartConsumingProjectBuildsTask = StartConsumingProjectBuildsTask;
|
|
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.StartConsumingProjectBuildsTask = void 0;
|
|
52
|
+
require("reflect-metadata");
|
|
53
|
+
var inversify_1 = require("inversify");
|
|
54
|
+
var utils_1 = require("../utils");
|
|
55
|
+
var services_1 = require("../services");
|
|
56
|
+
var types_1 = require("../types");
|
|
57
|
+
var TeamCityBuildIDs_1 = require("../constants/TeamCityBuildIDs");
|
|
58
|
+
var StartConsumingProjectBuildsTask = /** @class */ (function () {
|
|
59
|
+
function StartConsumingProjectBuildsTask(teamCityService, gitLabService) {
|
|
60
|
+
this.teamCityService = teamCityService;
|
|
61
|
+
this.gitLabService = gitLabService;
|
|
62
|
+
}
|
|
63
|
+
StartConsumingProjectBuildsTask.prototype.run = function (_options) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var milestone, options, projects, consumingProjects, projectBuildMap, _i, consumingProjects_1, project, branchName, buildId, build, totalBuilds, project;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
utils_1.Logger.logTask('Starting builds for consuming projects in TeamCity');
|
|
70
|
+
if (!_options.monorepoBranchName && !_options.milestone) {
|
|
71
|
+
utils_1.Logger.logError('Please provide either a milestone or branch name argument.');
|
|
72
|
+
return [2 /*return*/, false];
|
|
73
|
+
}
|
|
74
|
+
milestone = _options.milestone;
|
|
75
|
+
if (!!milestone) return [3 /*break*/, 2];
|
|
76
|
+
utils_1.Logger.logInfo("Searching for a merge request in project \"monorepo\" with branch name \"".concat(_options.monorepoBranchName, "\"..."));
|
|
77
|
+
return [4 /*yield*/, this.gitLabService.getMilestoneByBranchName(utils_1.ProjectIds.MONOREPO_PROJECT_ID, _options.monorepoBranchName)];
|
|
78
|
+
case 1:
|
|
79
|
+
milestone = _a.sent();
|
|
80
|
+
_a.label = 2;
|
|
81
|
+
case 2:
|
|
82
|
+
if (!milestone)
|
|
83
|
+
return [2 /*return*/, false];
|
|
84
|
+
utils_1.Logger.logInfo("Found milestone \"".concat(milestone, "\". Proceeding to run builds for consuming projects..."));
|
|
85
|
+
options = {
|
|
86
|
+
version: _options.version,
|
|
87
|
+
projectIds: _options.projectIds,
|
|
88
|
+
omittedProjectIds: _options.omittedProjectIds,
|
|
89
|
+
milestone: milestone
|
|
90
|
+
};
|
|
91
|
+
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
92
|
+
case 3:
|
|
93
|
+
projects = _a.sent();
|
|
94
|
+
consumingProjects = projects.filter(function (p) { return p.id.toString() !== utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
95
|
+
if (!consumingProjects.length) {
|
|
96
|
+
utils_1.Logger.logError("No projects that consume monorepo could be found");
|
|
97
|
+
return [2 /*return*/, false];
|
|
98
|
+
}
|
|
99
|
+
projectBuildMap = {};
|
|
100
|
+
_i = 0, consumingProjects_1 = consumingProjects;
|
|
101
|
+
_a.label = 4;
|
|
102
|
+
case 4:
|
|
103
|
+
if (!(_i < consumingProjects_1.length)) return [3 /*break*/, 8];
|
|
104
|
+
project = consumingProjects_1[_i];
|
|
105
|
+
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(project.id, options.milestone)];
|
|
106
|
+
case 5:
|
|
107
|
+
branchName = _a.sent();
|
|
108
|
+
if (!branchName) {
|
|
109
|
+
utils_1.Logger.logWarning("Release branch in project \"".concat(project.title, "\" with milestone \"").concat(options.milestone, "\" was not found. Skipping project..."));
|
|
110
|
+
return [3 /*break*/, 7];
|
|
111
|
+
}
|
|
112
|
+
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id.toString()];
|
|
113
|
+
if (!buildId) {
|
|
114
|
+
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
115
|
+
return [3 /*break*/, 7];
|
|
116
|
+
}
|
|
117
|
+
return [4 /*yield*/, this.teamCityService.startBuild(buildId, branchName)];
|
|
118
|
+
case 6:
|
|
119
|
+
build = _a.sent();
|
|
120
|
+
projectBuildMap[project.title] = build;
|
|
121
|
+
_a.label = 7;
|
|
122
|
+
case 7:
|
|
123
|
+
_i++;
|
|
124
|
+
return [3 /*break*/, 4];
|
|
125
|
+
case 8:
|
|
126
|
+
totalBuilds = Object.keys(projectBuildMap).length;
|
|
127
|
+
if (!totalBuilds) {
|
|
128
|
+
utils_1.Logger.logWarning("No releases found in consuming projects with milestone \"".concat(options.milestone, "\"."));
|
|
129
|
+
return [2 /*return*/, true];
|
|
130
|
+
}
|
|
131
|
+
utils_1.Logger.logSuccess("Successfully started builds in ".concat(totalBuilds, " projects."));
|
|
132
|
+
for (project in projectBuildMap) {
|
|
133
|
+
utils_1.Logger.logInfo("[".concat(project, "]: ").concat(projectBuildMap[project].webUrl));
|
|
134
|
+
}
|
|
135
|
+
return [2 /*return*/, true];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
StartConsumingProjectBuildsTask = __decorate([
|
|
141
|
+
(0, inversify_1.injectable)(),
|
|
142
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
143
|
+
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
144
|
+
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
145
|
+
services_1.GitLabService])
|
|
146
|
+
], StartConsumingProjectBuildsTask);
|
|
147
|
+
return StartConsumingProjectBuildsTask;
|
|
148
|
+
}());
|
|
149
|
+
exports.StartConsumingProjectBuildsTask = StartConsumingProjectBuildsTask;
|