@clickview/ship-it 0.0.32 → 0.0.33
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/lib/config.json +20 -20
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +439 -439
- package/lib/src/api-clients/git-lab/GitLabMapper.js +82 -82
- 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 +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 +129 -129
- 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 -30
- package/lib/src/constants/CommandTypeMapping.js +20 -20
- 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 -68
- package/lib/src/constants/SlackUserEmailList.js +13 -13
- package/lib/src/constants/TeamCityBuildIDs.js +45 -45
- 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/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 +22 -22
- 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 -75
- package/lib/src/services/GitLabService.js +508 -508
- 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 +168 -168
- 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/CreateNotesAuditTask.js +140 -140
- package/lib/src/tasks/CreateReleaseNotesTask.js +144 -144
- package/lib/src/tasks/InstallPackagesTask.js +407 -407
- 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 +186 -186
- 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/index.js +34 -34
- package/lib/src/types.js +57 -57
- 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
- package/dist/F1/Analytics Web.md +0 -8
- package/dist/F1/AutoCaptions.md +0 -30
- package/dist/F1/Classroom.Api.md +0 -23
- package/dist/F1/ClickView Online.md +0 -17
- package/dist/F1/ClickView.Curator.md +0 -100
- package/dist/F1/ClickView.EmailService.md +0 -53
- package/dist/F1/ClickView.OnlineApi.md +0 -13
- package/dist/F1/Clients.md +0 -19
- package/dist/F1/Domain.Api.md +0 -23
- package/dist/F1/Exchange.Web.md +0 -8
- package/dist/F1/Image.Api.md +0 -8
- package/dist/F1/Integrations.Api.md +0 -23
- package/dist/F1/Krakend.md +0 -8
- package/dist/F1/Library Editor.md +0 -0
- package/dist/F1/Lite.md +0 -60
- package/dist/F1/Master.Api.md +0 -58
- package/dist/F1/Master.Auth.md +0 -22
- package/dist/F1/Objects.Api.md +0 -12
- package/dist/F1/Permissions.Api.md +0 -12
- package/dist/F1/RealtimeSalesforceSync.md +0 -14
- package/dist/F1/Release Notes.md +0 -990
- package/dist/F1/Search.Api.md +0 -12
- package/dist/F1/StreamableLearning.Web.md +0 -35
- package/dist/F1/Users.Api.md +0 -13
- package/dist/F1/VideoProcessorService.md +0 -23
- package/dist/F1/clickview.md +0 -321
- package/dist/F2/Analytics Web.md +0 -7
- package/dist/F2/Batch.Api.md +0 -27
- package/dist/F2/ClickView Online.md +0 -12
- package/dist/F2/ClickView.Curator.md +0 -166
- package/dist/F2/Clients.md +0 -14
- package/dist/F2/CurriculumIngestion.Api.md +0 -13
- package/dist/F2/Discover.Api.md +0 -64
- package/dist/F2/Domain.Api.md +0 -16
- package/dist/F2/Exchange.Web.md +0 -7
- package/dist/F2/Krakend.md +0 -12
- package/dist/F2/Library Editor.md +0 -11
- package/dist/F2/Lite.md +0 -30
- package/dist/F2/Objects.Api.md +0 -12
- package/dist/F2/Release Notes.md +0 -759
- package/dist/F2/Search.Api.md +0 -30
- package/dist/F2/Share.Api.md +0 -12
- package/dist/F2/StreamableLearning.Web.md +0 -14
- package/dist/F2/Subjects.API.md +0 -12
- package/dist/F2/Tv.Web.md +0 -8
- package/dist/F2/Users.Api.md +0 -21
- package/dist/F2/clickview.md +0 -200
- package/dist/F2/shortcode-api.md +0 -8
- package/dist/F3.1/Analytics Web.md +0 -8
- package/dist/F3.1/ClickView.Curator.md +0 -14
- package/dist/F3.1/Discover.Api.md +0 -14
- package/dist/F3.1/Domain.Api.md +0 -7
- package/dist/F3.1/Exchange.Web.md +0 -8
- package/dist/F3.1/Library Editor.md +0 -8
- package/dist/F3.1/Lite.md +0 -8
- package/dist/F3.1/Objects.Api.md +0 -7
- package/dist/F3.1/Release Notes.md +0 -207
- package/dist/F3.1/Search.Api.md +0 -14
- package/dist/F3.1/Share.Api.md +0 -10
- package/dist/F3.1/Subjects.API.md +0 -35
- package/dist/F3.1/VideoViews.Api.md +0 -7
- package/dist/F3.1/clickview.md +0 -28
- package/lib/src/commands/CreateTestingNotesCommand.js +0 -84
- package/lib/src/commands/StartConsumingProjectBuildsCommand.js +0 -76
- package/lib/src/tasks/CreateTestingNotesTask.js +0 -135
- package/lib/src/tasks/MergeMasterToDevTask.js +0 -147
- package/lib/src/tasks/StartConsumingProjectBuildsTask.js +0 -149
|
@@ -1,109 +1,109 @@
|
|
|
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.StartMonorepoBuildTask = 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 MonorepoProjectNames_1 = require("../constants/MonorepoProjectNames");
|
|
59
|
-
var StartMonorepoBuildTask = /** @class */ (function () {
|
|
60
|
-
function StartMonorepoBuildTask(teamCityService, gitLabService) {
|
|
61
|
-
this.teamCityService = teamCityService;
|
|
62
|
-
this.gitLabService = gitLabService;
|
|
63
|
-
}
|
|
64
|
-
StartMonorepoBuildTask.prototype.run = function (options) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var branchName, projects, packageNames, bulkBuildID, _i, projects_1, project, build;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
utils_1.Logger.logTask('Starting Monorepo build in TeamCity');
|
|
71
|
-
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.milestone)];
|
|
72
|
-
case 1:
|
|
73
|
-
branchName = _a.sent();
|
|
74
|
-
if (!branchName) {
|
|
75
|
-
utils_1.Logger.logError("Monorepo release branch with milestone \"".concat(options.milestone, "\" was not found."));
|
|
76
|
-
return [2 /*return*/, false];
|
|
77
|
-
}
|
|
78
|
-
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
79
|
-
case 2:
|
|
80
|
-
projects = _a.sent();
|
|
81
|
-
packageNames = [];
|
|
82
|
-
bulkBuildID = TeamCityBuildIDs_1.TeamCityBuildIds[utils_1.ProjectIds.MONOREPO_PROJECT_ID];
|
|
83
|
-
for (_i = 0, projects_1 = projects; _i < projects_1.length; _i++) {
|
|
84
|
-
project = projects_1[_i];
|
|
85
|
-
// Find all relevant monorepo project package names in release
|
|
86
|
-
if (MonorepoProjectNames_1.MonorepoProjectNames[project.id]) {
|
|
87
|
-
packageNames.push(MonorepoProjectNames_1.MonorepoProjectNames[project.id]);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
utils_1.Logger.logMessage("List of monorepo projects found in release: ".concat(String(packageNames)));
|
|
91
|
-
return [4 /*yield*/, this.teamCityService.startCustomBuild(bulkBuildID, branchName, String(packageNames))];
|
|
92
|
-
case 3:
|
|
93
|
-
build = _a.sent();
|
|
94
|
-
utils_1.Logger.logSuccess("Successfully started build in monorepo. View progress here: ".concat(build.webUrl));
|
|
95
|
-
return [2 /*return*/, true];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
StartMonorepoBuildTask = __decorate([
|
|
101
|
-
(0, inversify_1.injectable)(),
|
|
102
|
-
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
103
|
-
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
104
|
-
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
105
|
-
services_1.GitLabService])
|
|
106
|
-
], StartMonorepoBuildTask);
|
|
107
|
-
return StartMonorepoBuildTask;
|
|
108
|
-
}());
|
|
109
|
-
exports.StartMonorepoBuildTask = StartMonorepoBuildTask;
|
|
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.StartMonorepoBuildTask = 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 MonorepoProjectNames_1 = require("../constants/MonorepoProjectNames");
|
|
59
|
+
var StartMonorepoBuildTask = /** @class */ (function () {
|
|
60
|
+
function StartMonorepoBuildTask(teamCityService, gitLabService) {
|
|
61
|
+
this.teamCityService = teamCityService;
|
|
62
|
+
this.gitLabService = gitLabService;
|
|
63
|
+
}
|
|
64
|
+
StartMonorepoBuildTask.prototype.run = function (options) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
+
var branchName, projects, packageNames, bulkBuildID, _i, projects_1, project, build;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
utils_1.Logger.logTask('Starting Monorepo build in TeamCity');
|
|
71
|
+
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.milestone)];
|
|
72
|
+
case 1:
|
|
73
|
+
branchName = _a.sent();
|
|
74
|
+
if (!branchName) {
|
|
75
|
+
utils_1.Logger.logError("Monorepo release branch with milestone \"".concat(options.milestone, "\" was not found."));
|
|
76
|
+
return [2 /*return*/, false];
|
|
77
|
+
}
|
|
78
|
+
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
79
|
+
case 2:
|
|
80
|
+
projects = _a.sent();
|
|
81
|
+
packageNames = [];
|
|
82
|
+
bulkBuildID = TeamCityBuildIDs_1.TeamCityBuildIds[utils_1.ProjectIds.MONOREPO_PROJECT_ID];
|
|
83
|
+
for (_i = 0, projects_1 = projects; _i < projects_1.length; _i++) {
|
|
84
|
+
project = projects_1[_i];
|
|
85
|
+
// Find all relevant monorepo project package names in release
|
|
86
|
+
if (MonorepoProjectNames_1.MonorepoProjectNames[project.id]) {
|
|
87
|
+
packageNames.push(MonorepoProjectNames_1.MonorepoProjectNames[project.id]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
utils_1.Logger.logMessage("List of monorepo projects found in release: ".concat(String(packageNames)));
|
|
91
|
+
return [4 /*yield*/, this.teamCityService.startCustomBuild(bulkBuildID, branchName, String(packageNames))];
|
|
92
|
+
case 3:
|
|
93
|
+
build = _a.sent();
|
|
94
|
+
utils_1.Logger.logSuccess("Successfully started build in monorepo. View progress here: ".concat(build.webUrl));
|
|
95
|
+
return [2 /*return*/, true];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
StartMonorepoBuildTask = __decorate([
|
|
101
|
+
(0, inversify_1.injectable)(),
|
|
102
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
103
|
+
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
104
|
+
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
105
|
+
services_1.GitLabService])
|
|
106
|
+
], StartMonorepoBuildTask);
|
|
107
|
+
return StartMonorepoBuildTask;
|
|
108
|
+
}());
|
|
109
|
+
exports.StartMonorepoBuildTask = StartMonorepoBuildTask;
|
|
@@ -1,170 +1,170 @@
|
|
|
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.StartProjectBuildsTask = 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 StartProjectBuildsTask = /** @class */ (function () {
|
|
59
|
-
function StartProjectBuildsTask(teamCityService, gitLabService) {
|
|
60
|
-
this.teamCityService = teamCityService;
|
|
61
|
-
this.gitLabService = gitLabService;
|
|
62
|
-
}
|
|
63
|
-
StartProjectBuildsTask.prototype.run = function (_options) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var projectName, project, buildId, build, 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.targetBranchName && _options.projectIds)) return [3 /*break*/, 3];
|
|
71
|
-
utils_1.Logger.logMessage("Starting consuming project build for given target branch ".concat(_options.targetBranchName));
|
|
72
|
-
if (_options.projectIds.length > 1) {
|
|
73
|
-
utils_1.Logger.logError("More than one project found!");
|
|
74
|
-
return [2 /*return*/, false];
|
|
75
|
-
}
|
|
76
|
-
projectName = _options.projectIds[0];
|
|
77
|
-
return [4 /*yield*/, this.gitLabService.getProject(projectName)];
|
|
78
|
-
case 1:
|
|
79
|
-
project = _a.sent();
|
|
80
|
-
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id];
|
|
81
|
-
if (!buildId) {
|
|
82
|
-
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
83
|
-
return [2 /*return*/, false];
|
|
84
|
-
}
|
|
85
|
-
return [4 /*yield*/, this.teamCityService.startBuild(buildId, _options.targetBranchName)];
|
|
86
|
-
case 2:
|
|
87
|
-
build = _a.sent();
|
|
88
|
-
utils_1.Logger.logInfo("[".concat(project.title, "]: ").concat(build.webUrl));
|
|
89
|
-
return [2 /*return*/, true];
|
|
90
|
-
case 3:
|
|
91
|
-
if (!_options.monorepoBranchName && !_options.milestone) {
|
|
92
|
-
utils_1.Logger.logError('Please provide either a milestone or branch name argument.');
|
|
93
|
-
return [2 /*return*/, false];
|
|
94
|
-
}
|
|
95
|
-
milestone = _options.milestone;
|
|
96
|
-
if (!!milestone) return [3 /*break*/, 5];
|
|
97
|
-
utils_1.Logger.logInfo("Searching for a merge request in project \"monorepo\" with branch name \"".concat(_options.monorepoBranchName, "\"..."));
|
|
98
|
-
return [4 /*yield*/, this.gitLabService.getMilestoneByBranchName(utils_1.ProjectIds.MONOREPO_PROJECT_ID, _options.monorepoBranchName)];
|
|
99
|
-
case 4:
|
|
100
|
-
milestone = _a.sent();
|
|
101
|
-
_a.label = 5;
|
|
102
|
-
case 5:
|
|
103
|
-
if (!milestone)
|
|
104
|
-
return [2 /*return*/, false];
|
|
105
|
-
utils_1.Logger.logInfo("Found milestone \"".concat(milestone, "\". Proceeding to run builds for consuming projects..."));
|
|
106
|
-
options = {
|
|
107
|
-
version: _options.version,
|
|
108
|
-
projectIds: _options.projectIds,
|
|
109
|
-
omittedProjectIds: _options.omittedProjectIds,
|
|
110
|
-
milestone: milestone
|
|
111
|
-
};
|
|
112
|
-
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
113
|
-
case 6:
|
|
114
|
-
projects = _a.sent();
|
|
115
|
-
consumingProjects = projects.filter(function (p) { return p.id.toString() !== utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
116
|
-
if (!consumingProjects.length) {
|
|
117
|
-
utils_1.Logger.logError("No projects that consume monorepo could be found");
|
|
118
|
-
return [2 /*return*/, false];
|
|
119
|
-
}
|
|
120
|
-
projectBuildMap = {};
|
|
121
|
-
_i = 0, consumingProjects_1 = consumingProjects;
|
|
122
|
-
_a.label = 7;
|
|
123
|
-
case 7:
|
|
124
|
-
if (!(_i < consumingProjects_1.length)) return [3 /*break*/, 11];
|
|
125
|
-
project = consumingProjects_1[_i];
|
|
126
|
-
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(project.id, options.milestone)];
|
|
127
|
-
case 8:
|
|
128
|
-
branchName = _a.sent();
|
|
129
|
-
if (!branchName) {
|
|
130
|
-
utils_1.Logger.logWarning("Release branch in project \"".concat(project.title, "\" with milestone \"").concat(options.milestone, "\" was not found. Skipping project..."));
|
|
131
|
-
return [3 /*break*/, 10];
|
|
132
|
-
}
|
|
133
|
-
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id.toString()];
|
|
134
|
-
if (!buildId) {
|
|
135
|
-
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
136
|
-
return [3 /*break*/, 10];
|
|
137
|
-
}
|
|
138
|
-
return [4 /*yield*/, this.teamCityService.startBuild(buildId, branchName)];
|
|
139
|
-
case 9:
|
|
140
|
-
build = _a.sent();
|
|
141
|
-
projectBuildMap[project.title] = build;
|
|
142
|
-
_a.label = 10;
|
|
143
|
-
case 10:
|
|
144
|
-
_i++;
|
|
145
|
-
return [3 /*break*/, 7];
|
|
146
|
-
case 11:
|
|
147
|
-
totalBuilds = Object.keys(projectBuildMap).length;
|
|
148
|
-
if (!totalBuilds) {
|
|
149
|
-
utils_1.Logger.logWarning("No releases found in consuming projects with milestone \"".concat(options.milestone, "\"."));
|
|
150
|
-
return [2 /*return*/, true];
|
|
151
|
-
}
|
|
152
|
-
utils_1.Logger.logSuccess("Successfully started builds in ".concat(totalBuilds, " projects."));
|
|
153
|
-
for (project in projectBuildMap) {
|
|
154
|
-
utils_1.Logger.logInfo("[".concat(project, "]: ").concat(projectBuildMap[project].webUrl));
|
|
155
|
-
}
|
|
156
|
-
return [2 /*return*/, true];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
StartProjectBuildsTask = __decorate([
|
|
162
|
-
(0, inversify_1.injectable)(),
|
|
163
|
-
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
164
|
-
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
165
|
-
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
166
|
-
services_1.GitLabService])
|
|
167
|
-
], StartProjectBuildsTask);
|
|
168
|
-
return StartProjectBuildsTask;
|
|
169
|
-
}());
|
|
170
|
-
exports.StartProjectBuildsTask = StartProjectBuildsTask;
|
|
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.StartProjectBuildsTask = 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 StartProjectBuildsTask = /** @class */ (function () {
|
|
59
|
+
function StartProjectBuildsTask(teamCityService, gitLabService) {
|
|
60
|
+
this.teamCityService = teamCityService;
|
|
61
|
+
this.gitLabService = gitLabService;
|
|
62
|
+
}
|
|
63
|
+
StartProjectBuildsTask.prototype.run = function (_options) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var projectName, project, buildId, build, 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.targetBranchName && _options.projectIds)) return [3 /*break*/, 3];
|
|
71
|
+
utils_1.Logger.logMessage("Starting consuming project build for given target branch ".concat(_options.targetBranchName));
|
|
72
|
+
if (_options.projectIds.length > 1) {
|
|
73
|
+
utils_1.Logger.logError("More than one project found!");
|
|
74
|
+
return [2 /*return*/, false];
|
|
75
|
+
}
|
|
76
|
+
projectName = _options.projectIds[0];
|
|
77
|
+
return [4 /*yield*/, this.gitLabService.getProject(projectName)];
|
|
78
|
+
case 1:
|
|
79
|
+
project = _a.sent();
|
|
80
|
+
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id];
|
|
81
|
+
if (!buildId) {
|
|
82
|
+
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
83
|
+
return [2 /*return*/, false];
|
|
84
|
+
}
|
|
85
|
+
return [4 /*yield*/, this.teamCityService.startBuild(buildId, _options.targetBranchName)];
|
|
86
|
+
case 2:
|
|
87
|
+
build = _a.sent();
|
|
88
|
+
utils_1.Logger.logInfo("[".concat(project.title, "]: ").concat(build.webUrl));
|
|
89
|
+
return [2 /*return*/, true];
|
|
90
|
+
case 3:
|
|
91
|
+
if (!_options.monorepoBranchName && !_options.milestone) {
|
|
92
|
+
utils_1.Logger.logError('Please provide either a milestone or branch name argument.');
|
|
93
|
+
return [2 /*return*/, false];
|
|
94
|
+
}
|
|
95
|
+
milestone = _options.milestone;
|
|
96
|
+
if (!!milestone) return [3 /*break*/, 5];
|
|
97
|
+
utils_1.Logger.logInfo("Searching for a merge request in project \"monorepo\" with branch name \"".concat(_options.monorepoBranchName, "\"..."));
|
|
98
|
+
return [4 /*yield*/, this.gitLabService.getMilestoneByBranchName(utils_1.ProjectIds.MONOREPO_PROJECT_ID, _options.monorepoBranchName)];
|
|
99
|
+
case 4:
|
|
100
|
+
milestone = _a.sent();
|
|
101
|
+
_a.label = 5;
|
|
102
|
+
case 5:
|
|
103
|
+
if (!milestone)
|
|
104
|
+
return [2 /*return*/, false];
|
|
105
|
+
utils_1.Logger.logInfo("Found milestone \"".concat(milestone, "\". Proceeding to run builds for consuming projects..."));
|
|
106
|
+
options = {
|
|
107
|
+
version: _options.version,
|
|
108
|
+
projectIds: _options.projectIds,
|
|
109
|
+
omittedProjectIds: _options.omittedProjectIds,
|
|
110
|
+
milestone: milestone
|
|
111
|
+
};
|
|
112
|
+
return [4 /*yield*/, this.gitLabService.getProjects(options)];
|
|
113
|
+
case 6:
|
|
114
|
+
projects = _a.sent();
|
|
115
|
+
consumingProjects = projects.filter(function (p) { return p.id.toString() !== utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
116
|
+
if (!consumingProjects.length) {
|
|
117
|
+
utils_1.Logger.logError("No projects that consume monorepo could be found");
|
|
118
|
+
return [2 /*return*/, false];
|
|
119
|
+
}
|
|
120
|
+
projectBuildMap = {};
|
|
121
|
+
_i = 0, consumingProjects_1 = consumingProjects;
|
|
122
|
+
_a.label = 7;
|
|
123
|
+
case 7:
|
|
124
|
+
if (!(_i < consumingProjects_1.length)) return [3 /*break*/, 11];
|
|
125
|
+
project = consumingProjects_1[_i];
|
|
126
|
+
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(project.id, options.milestone)];
|
|
127
|
+
case 8:
|
|
128
|
+
branchName = _a.sent();
|
|
129
|
+
if (!branchName) {
|
|
130
|
+
utils_1.Logger.logWarning("Release branch in project \"".concat(project.title, "\" with milestone \"").concat(options.milestone, "\" was not found. Skipping project..."));
|
|
131
|
+
return [3 /*break*/, 10];
|
|
132
|
+
}
|
|
133
|
+
buildId = TeamCityBuildIDs_1.TeamCityBuildIds[project.id.toString()];
|
|
134
|
+
if (!buildId) {
|
|
135
|
+
utils_1.Logger.logWarning("Skipping build for ".concat(project.title, " as no Team City build ID has been specified"));
|
|
136
|
+
return [3 /*break*/, 10];
|
|
137
|
+
}
|
|
138
|
+
return [4 /*yield*/, this.teamCityService.startBuild(buildId, branchName)];
|
|
139
|
+
case 9:
|
|
140
|
+
build = _a.sent();
|
|
141
|
+
projectBuildMap[project.title] = build;
|
|
142
|
+
_a.label = 10;
|
|
143
|
+
case 10:
|
|
144
|
+
_i++;
|
|
145
|
+
return [3 /*break*/, 7];
|
|
146
|
+
case 11:
|
|
147
|
+
totalBuilds = Object.keys(projectBuildMap).length;
|
|
148
|
+
if (!totalBuilds) {
|
|
149
|
+
utils_1.Logger.logWarning("No releases found in consuming projects with milestone \"".concat(options.milestone, "\"."));
|
|
150
|
+
return [2 /*return*/, true];
|
|
151
|
+
}
|
|
152
|
+
utils_1.Logger.logSuccess("Successfully started builds in ".concat(totalBuilds, " projects."));
|
|
153
|
+
for (project in projectBuildMap) {
|
|
154
|
+
utils_1.Logger.logInfo("[".concat(project, "]: ").concat(projectBuildMap[project].webUrl));
|
|
155
|
+
}
|
|
156
|
+
return [2 /*return*/, true];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
StartProjectBuildsTask = __decorate([
|
|
162
|
+
(0, inversify_1.injectable)(),
|
|
163
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
164
|
+
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
165
|
+
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
166
|
+
services_1.GitLabService])
|
|
167
|
+
], StartProjectBuildsTask);
|
|
168
|
+
return StartProjectBuildsTask;
|
|
169
|
+
}());
|
|
170
|
+
exports.StartProjectBuildsTask = StartProjectBuildsTask;
|