@clickview/ship-it 0.0.22 → 0.0.23
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/lib/src/api-clients/team-city/TeamCityApiClient.js +1 -1
- package/lib/src/commands/StartProjectBuildsCommand.js +76 -0
- package/lib/src/commands/index.js +1 -1
- package/lib/src/constants/CommandTypeMapping.js +1 -1
- package/lib/src/constants/MonorepoProjectNames.js +1 -1
- package/lib/src/constants/ProjectNames.js +4 -1
- package/lib/src/constants/TeamCityBuildIDs.js +29 -1
- package/lib/src/inversify.config.js +4 -4
- package/lib/src/startup/SetupCommands.js +3 -3
- package/lib/src/tasks/StartProjectBuildsTask.js +149 -0
- package/lib/src/tasks/index.js +1 -1
- package/lib/src/types.js +2 -2
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@ var TeamCityApiClient = /** @class */ (function () {
|
|
|
81
81
|
return __generator(this, function (_a) {
|
|
82
82
|
switch (_a.label) {
|
|
83
83
|
case 0:
|
|
84
|
-
buildXml = "\n <build branchName=\"".concat(branchName, "\">\n <buildType id=\"").concat(buildId, "\" />\n <properties>\n <property name=\"ProjectList\" value=\"").concat(pList, "\"/>\n <property name=\"ReleaseEnvironment\" value=\"rc\"/>\n </properties>\n </build>\n ");
|
|
84
|
+
buildXml = "\n <build branchName=\"".concat(branchName, "\">\n <buildType id=\"").concat(buildId, "\" />\n <properties>\n <property name=\"ProjectList\" value=\"").concat(pList, "\"/>\n <property name=\"ReleaseEnvironment\" value=\"rc\"/>\n <property name=\"TriggerProjectBuilds\" value=\"all\"/>\n </properties>\n </build>\n ");
|
|
85
85
|
return [4 /*yield*/, this.client.builds.startBuild(buildXml)];
|
|
86
86
|
case 1:
|
|
87
87
|
build = _a.sent();
|
|
@@ -0,0 +1,76 @@
|
|
|
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.StartProjectBuildsCommand = void 0;
|
|
52
|
+
require("reflect-metadata");
|
|
53
|
+
var inversify_1 = require("inversify");
|
|
54
|
+
var types_1 = require("../types");
|
|
55
|
+
var StartProjectBuildsCommand = /** @class */ (function () {
|
|
56
|
+
function StartProjectBuildsCommand(startProjectBuildsTask) {
|
|
57
|
+
this.startProjectBuildsTask = startProjectBuildsTask;
|
|
58
|
+
}
|
|
59
|
+
StartProjectBuildsCommand.prototype.run = function (options) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0: return [4 /*yield*/, this.startProjectBuildsTask.run(options)];
|
|
64
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
StartProjectBuildsCommand = __decorate([
|
|
70
|
+
(0, inversify_1.injectable)(),
|
|
71
|
+
__param(0, (0, inversify_1.inject)(types_1.TASKS.StartProjectBuildsTask)),
|
|
72
|
+
__metadata("design:paramtypes", [Object])
|
|
73
|
+
], StartProjectBuildsCommand);
|
|
74
|
+
return StartProjectBuildsCommand;
|
|
75
|
+
}());
|
|
76
|
+
exports.StartProjectBuildsCommand = StartProjectBuildsCommand;
|
|
@@ -22,7 +22,7 @@ __exportStar(require("./CreateReleaseNotesCommand"), exports);
|
|
|
22
22
|
__exportStar(require("./CreateTestingNotesCommand"), exports);
|
|
23
23
|
__exportStar(require("./InstallPackagesCommand"), exports);
|
|
24
24
|
__exportStar(require("./ReleaseCommand"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
25
|
+
__exportStar(require("./StartProjectBuildsCommand"), exports);
|
|
26
26
|
__exportStar(require("./StatusCommand"), exports);
|
|
27
27
|
__exportStar(require("./TagMasterCommand"), exports);
|
|
28
28
|
__exportStar(require("./ValidateMergeRequestCommand"), exports);
|
|
@@ -13,7 +13,7 @@ exports.CommandTypeMapping = {
|
|
|
13
13
|
'install-packages': types_1.COMMANDS.InstallPackagesCommand,
|
|
14
14
|
'bump-packages': types_1.COMMANDS.BumpPackagesCommand,
|
|
15
15
|
'validate-mr': types_1.COMMANDS.ValidateMergeRequestCommand,
|
|
16
|
-
'start-
|
|
16
|
+
'start-project-builds': types_1.COMMANDS.StartProjectBuildsCommand,
|
|
17
17
|
'tag-master': types_1.COMMANDS.TagMasterCommand,
|
|
18
18
|
'list-projects': types_1.COMMANDS.ListProjectsCommand
|
|
19
19
|
};
|
|
@@ -12,5 +12,5 @@ exports.MonorepoProjectNames = (_a = {},
|
|
|
12
12
|
_a[constants_1.PROJECT_NAMES.backend.auth] = 'auth',
|
|
13
13
|
_a[constants_1.PROJECT_NAMES.frontend.exchange] = 'exchange',
|
|
14
14
|
_a[constants_1.PROJECT_NAMES.backend.player] = 'player',
|
|
15
|
-
_a[constants_1.PROJECT_NAMES.frontend.
|
|
15
|
+
_a[constants_1.PROJECT_NAMES.frontend.streamable] = 'streamable-learning',
|
|
16
16
|
_a);
|
|
@@ -15,7 +15,7 @@ exports.PROJECT_NAMES = {
|
|
|
15
15
|
'analytics': '970',
|
|
16
16
|
'reports': '970',
|
|
17
17
|
'streamable-learning': '1144',
|
|
18
|
-
'
|
|
18
|
+
'streamable': '1144'
|
|
19
19
|
},
|
|
20
20
|
/**
|
|
21
21
|
* IMPORTANT: Please don't append "api" or "service" to these names unless it makes sense (like for tvweb vs tvapi)
|
|
@@ -42,6 +42,9 @@ exports.PROJECT_NAMES = {
|
|
|
42
42
|
webplayer: '262',
|
|
43
43
|
player: '917',
|
|
44
44
|
autocaptions: '852',
|
|
45
|
+
realtimesalesforcesync: '689',
|
|
46
|
+
master: '11',
|
|
47
|
+
permission: '906',
|
|
45
48
|
subject: '725',
|
|
46
49
|
subjects: '725',
|
|
47
50
|
filegen: '713',
|
|
@@ -12,5 +12,33 @@ exports.TeamCityBuildIds = (_a = {},
|
|
|
12
12
|
_a[constants_1.PROJECT_NAMES.frontend.lite] = 'ClickViewLiteWeb_BuildAndPackageDocker',
|
|
13
13
|
_a[constants_1.PROJECT_NAMES.backend.auth] = 'auth_web_B',
|
|
14
14
|
_a[constants_1.PROJECT_NAMES.frontend.exchange] = 'ExchangeWeb_BuildAndPackageDocker',
|
|
15
|
-
_a[constants_1.PROJECT_NAMES.frontend.
|
|
15
|
+
_a[constants_1.PROJECT_NAMES.frontend.streamable] = 'Web_StreamableLearningWeb_BuildAndPackageDocker',
|
|
16
|
+
_a[constants_1.PROJECT_NAMES.backend.integrations] = 'Api_IntegrationsApi_BuildAndPackageDocker',
|
|
17
|
+
_a[constants_1.PROJECT_NAMES.backend.online] = 'online_api_build_and_package',
|
|
18
|
+
_a[constants_1.PROJECT_NAMES.backend.email] = 'email_api_BuildAndPackageDocker',
|
|
19
|
+
_a[constants_1.PROJECT_NAMES.backend.launch] = 'Web_LaunchWeb_BuildAndPackageDocker',
|
|
20
|
+
_a[constants_1.PROJECT_NAMES.backend.videoprocessor] = 'app_VideoProcessorServiceApp_BuildAndPackageDocker',
|
|
21
|
+
_a[constants_1.PROJECT_NAMES.backend.image] = 'ImageApi_BuildAndPackageDocker',
|
|
22
|
+
_a[constants_1.PROJECT_NAMES.backend.hydration] = 'app_HydrationApp_BuildAndPackageDocker',
|
|
23
|
+
_a[constants_1.PROJECT_NAMES.backend.index] = 'app_IndexApp_BuildAndPackageDocker',
|
|
24
|
+
_a[constants_1.PROJECT_NAMES.backend.search] = 'Api_SearApi_BuildAndPackageDocker',
|
|
25
|
+
_a[constants_1.PROJECT_NAMES.backend.videoviews] = 'Api_VideoViewsApi_BuildAndPackageDocker',
|
|
26
|
+
_a[constants_1.PROJECT_NAMES.backend.domain] = 'domain_api_build_and_package',
|
|
27
|
+
_a[constants_1.PROJECT_NAMES.backend.batch] = 'Api_BatchApi_BuildAndPackageDocker',
|
|
28
|
+
_a[constants_1.PROJECT_NAMES.backend.discover] = 'Api_DiscoverApi_BuildAndPackageDocker',
|
|
29
|
+
_a[constants_1.PROJECT_NAMES.backend.library] = 'Api_LibraryApi_BuildAndPackageDocker',
|
|
30
|
+
_a[constants_1.PROJECT_NAMES.backend.webplayer] = 'web_player_web_BuildAndPackageDocker',
|
|
31
|
+
_a[constants_1.PROJECT_NAMES.backend.player] = 'Web_PlayerWeb_BuildAndPackageDocker',
|
|
32
|
+
_a[constants_1.PROJECT_NAMES.backend.autocaptions] = 'app_AutoCaptionsApp_BuildAndPackageDocker',
|
|
33
|
+
_a[constants_1.PROJECT_NAMES.backend.realtimesalesforcesync] = 'app_realtime_salesforce_sync_api_BuildAndPackageDocker',
|
|
34
|
+
_a[constants_1.PROJECT_NAMES.backend.master] = 'master_api_BuildAndPackageDocker',
|
|
35
|
+
_a[constants_1.PROJECT_NAMES.backend.permission] = 'Api_PermissionApi_BuildAndPackageDocker',
|
|
36
|
+
_a[constants_1.PROJECT_NAMES.backend.subject] = 'Api_SubjectsApi_BuildAndPackageDocker',
|
|
37
|
+
_a[constants_1.PROJECT_NAMES.backend.filegen] = 'app_file_generator_app_BuildAndPackageDocker',
|
|
38
|
+
_a[constants_1.PROJECT_NAMES.backend.objects] = 'Api_ObjectsApi_BuildAndPackageDocker',
|
|
39
|
+
_a[constants_1.PROJECT_NAMES.backend.classroom] = 'Api_ClassroomApi_BuildAndPackageDocker',
|
|
40
|
+
_a[constants_1.PROJECT_NAMES.backend.users] = 'Api_UsersApi_BuildAndPackageDocker',
|
|
41
|
+
_a[constants_1.PROJECT_NAMES.backend.tvweb] = 'tv_web_BuildAndPackageDocker',
|
|
42
|
+
_a[constants_1.PROJECT_NAMES.backend.clients] = 'Tooling_Clients_PublishToNuget',
|
|
43
|
+
_a[constants_1.PROJECT_NAMES.backend.goodstuff] = 'Tooling_GoodStuffInternal_PublishToNuget',
|
|
16
44
|
_a);
|
|
@@ -43,8 +43,8 @@ function createContainer(config) {
|
|
|
43
43
|
container.bind(types_1.TASKS.StartMonorepoBuildTask).to(tasks_1.StartMonorepoBuildTask);
|
|
44
44
|
container.bind(types_1.TASKS.TagMasterTask).to(tasks_1.TagMasterTask);
|
|
45
45
|
container.bind(types_1.TASKS.ListProjectsTask).to(tasks_1.ListProjectsTask);
|
|
46
|
-
container.bind(types_1.TASKS.
|
|
47
|
-
.to(tasks_1.
|
|
46
|
+
container.bind(types_1.TASKS.StartProjectBuildsTask)
|
|
47
|
+
.to(tasks_1.StartProjectBuildsTask);
|
|
48
48
|
/**
|
|
49
49
|
* Commands
|
|
50
50
|
*/
|
|
@@ -60,8 +60,8 @@ function createContainer(config) {
|
|
|
60
60
|
container.bind(types_1.COMMANDS.ValidateMergeRequestCommand).to(commands_1.ValidateMergeRequestCommand);
|
|
61
61
|
container.bind(types_1.COMMANDS.TagMasterCommand).to(commands_1.TagMasterCommand);
|
|
62
62
|
container.bind(types_1.COMMANDS.ListProjectsCommand).to(commands_1.ListProjectsCommand);
|
|
63
|
-
container.bind(types_1.COMMANDS.
|
|
64
|
-
.to(commands_1.
|
|
63
|
+
container.bind(types_1.COMMANDS.StartProjectBuildsCommand)
|
|
64
|
+
.to(commands_1.StartProjectBuildsCommand);
|
|
65
65
|
return container;
|
|
66
66
|
}
|
|
67
67
|
exports.createContainer = createContainer;
|
|
@@ -102,8 +102,8 @@ function setupCommands(program, container) {
|
|
|
102
102
|
.option('-p, --projectId <projectId>')
|
|
103
103
|
.option('-b, --branchName <branchName>')
|
|
104
104
|
.action(getAction('validate-mr'));
|
|
105
|
-
program.command('start-
|
|
106
|
-
.description('Trigger TeamCity builds in all
|
|
105
|
+
program.command('start-project-builds')
|
|
106
|
+
.description('Trigger TeamCity builds in all projects that are a part of a milestone')
|
|
107
107
|
.option('-m, --milestone <milestone>')
|
|
108
108
|
.option('--monorepoBranchName <monorepoBranchName>')
|
|
109
109
|
.option('-p, --projectIds <projectIds...>')
|
|
@@ -114,7 +114,7 @@ function setupCommands(program, container) {
|
|
|
114
114
|
switch (_a.label) {
|
|
115
115
|
case 0:
|
|
116
116
|
options = (0, AddMilestoneCommand_1.processMilestoneCommandOptions)(opts);
|
|
117
|
-
return [4 /*yield*/, getAction('start-
|
|
117
|
+
return [4 /*yield*/, getAction('start-project-builds')(options)];
|
|
118
118
|
case 1:
|
|
119
119
|
_a.sent();
|
|
120
120
|
return [2 /*return*/];
|
|
@@ -0,0 +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.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 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
|
+
StartProjectBuildsTask = __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
|
+
], StartProjectBuildsTask);
|
|
147
|
+
return StartProjectBuildsTask;
|
|
148
|
+
}());
|
|
149
|
+
exports.StartProjectBuildsTask = StartProjectBuildsTask;
|
package/lib/src/tasks/index.js
CHANGED
|
@@ -22,7 +22,7 @@ __exportStar(require("./CreateMergeRequestTask"), exports);
|
|
|
22
22
|
__exportStar(require("./CreateReleaseNotesTask"), exports);
|
|
23
23
|
__exportStar(require("./CreateTestingNotesTask"), exports);
|
|
24
24
|
__exportStar(require("./InstallPackagesTask"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
25
|
+
__exportStar(require("./StartProjectBuildsTask"), exports);
|
|
26
26
|
__exportStar(require("./StartMonorepoBuildTask"), exports);
|
|
27
27
|
__exportStar(require("./TagMasterTask"), exports);
|
|
28
28
|
__exportStar(require("./ListProjectsTask"), exports);
|
package/lib/src/types.js
CHANGED
|
@@ -28,7 +28,7 @@ exports.TASKS = {
|
|
|
28
28
|
CommitPackageVersionsTask: Symbol.for('CommitPackageVersionsTask'),
|
|
29
29
|
ValidateMergeRequestTask: Symbol.for('ValidateMergeRequestTask'),
|
|
30
30
|
StartMonorepoBuildTask: Symbol.for('StartMonorepoBuildTask'),
|
|
31
|
-
|
|
31
|
+
StartProjectBuildsTask: Symbol.for('StartProjectBuildsTask'),
|
|
32
32
|
TagMasterTask: Symbol.for('TagMasterTask'),
|
|
33
33
|
ListProjectsTask: Symbol.for('ListProjectsTask')
|
|
34
34
|
};
|
|
@@ -43,7 +43,7 @@ exports.COMMANDS = {
|
|
|
43
43
|
InstallPackagesCommand: Symbol.for('InstallPackagesCommand'),
|
|
44
44
|
BumpPackagesCommand: Symbol.for('BumpPackagesCommand'),
|
|
45
45
|
ValidateMergeRequestCommand: Symbol.for('ValidateMergeRequestCommand'),
|
|
46
|
-
|
|
46
|
+
StartProjectBuildsCommand: Symbol.for('StartProjectBuildsCommand'),
|
|
47
47
|
TagMasterCommand: Symbol.for('TagMasterCommand'),
|
|
48
48
|
ListProjectsCommand: Symbol.for('ListProjectsCommand')
|
|
49
49
|
};
|