@catladder/cli 0.0.0-refactor-needs-aae6e67d → 0.0.0-refactor-gitlab-jobs-a7359bde
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/dist/bundles/catenv/index.js +398 -158
- package/dist/bundles/cli/index.js +398 -158
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -351438,7 +351438,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351438
351438
|
|
|
351439
351439
|
exports.__esModule = true;
|
|
351440
351440
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351441
|
-
exports.PIPELINE_IMAGE_TAG = "refactor-
|
|
351441
|
+
exports.PIPELINE_IMAGE_TAG = "refactor-gitlab-jobs-a7359bde" || 0;
|
|
351442
351442
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351443
351443
|
|
|
351444
351444
|
/***/ }),
|
|
@@ -354334,22 +354334,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
|
|
|
354334
354334
|
|
|
354335
354335
|
/***/ }),
|
|
354336
354336
|
|
|
354337
|
-
/***/
|
|
354337
|
+
/***/ 17052:
|
|
354338
354338
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
354339
354339
|
|
|
354340
354340
|
"use strict";
|
|
354341
354341
|
|
|
354342
354342
|
|
|
354343
|
-
var
|
|
354344
|
-
|
|
354345
|
-
|
|
354346
|
-
|
|
354347
|
-
|
|
354343
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
354344
|
+
function adopt(value) {
|
|
354345
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
354346
|
+
resolve(value);
|
|
354347
|
+
});
|
|
354348
|
+
}
|
|
354349
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
354350
|
+
function fulfilled(value) {
|
|
354351
|
+
try {
|
|
354352
|
+
step(generator.next(value));
|
|
354353
|
+
} catch (e) {
|
|
354354
|
+
reject(e);
|
|
354355
|
+
}
|
|
354348
354356
|
}
|
|
354349
|
-
|
|
354350
|
-
|
|
354351
|
-
|
|
354357
|
+
function rejected(value) {
|
|
354358
|
+
try {
|
|
354359
|
+
step(generator["throw"](value));
|
|
354360
|
+
} catch (e) {
|
|
354361
|
+
reject(e);
|
|
354362
|
+
}
|
|
354363
|
+
}
|
|
354364
|
+
function step(result) {
|
|
354365
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
354366
|
+
}
|
|
354367
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
354368
|
+
});
|
|
354352
354369
|
};
|
|
354370
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
354371
|
+
var _ = {
|
|
354372
|
+
label: 0,
|
|
354373
|
+
sent: function () {
|
|
354374
|
+
if (t[0] & 1) throw t[1];
|
|
354375
|
+
return t[1];
|
|
354376
|
+
},
|
|
354377
|
+
trys: [],
|
|
354378
|
+
ops: []
|
|
354379
|
+
},
|
|
354380
|
+
f,
|
|
354381
|
+
y,
|
|
354382
|
+
t,
|
|
354383
|
+
g;
|
|
354384
|
+
return g = {
|
|
354385
|
+
next: verb(0),
|
|
354386
|
+
"throw": verb(1),
|
|
354387
|
+
"return": verb(2)
|
|
354388
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
354389
|
+
return this;
|
|
354390
|
+
}), g;
|
|
354391
|
+
function verb(n) {
|
|
354392
|
+
return function (v) {
|
|
354393
|
+
return step([n, v]);
|
|
354394
|
+
};
|
|
354395
|
+
}
|
|
354396
|
+
function step(op) {
|
|
354397
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
354398
|
+
while (_) try {
|
|
354399
|
+
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;
|
|
354400
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
354401
|
+
switch (op[0]) {
|
|
354402
|
+
case 0:
|
|
354403
|
+
case 1:
|
|
354404
|
+
t = op;
|
|
354405
|
+
break;
|
|
354406
|
+
case 4:
|
|
354407
|
+
_.label++;
|
|
354408
|
+
return {
|
|
354409
|
+
value: op[1],
|
|
354410
|
+
done: false
|
|
354411
|
+
};
|
|
354412
|
+
case 5:
|
|
354413
|
+
_.label++;
|
|
354414
|
+
y = op[1];
|
|
354415
|
+
op = [0];
|
|
354416
|
+
continue;
|
|
354417
|
+
case 7:
|
|
354418
|
+
op = _.ops.pop();
|
|
354419
|
+
_.trys.pop();
|
|
354420
|
+
continue;
|
|
354421
|
+
default:
|
|
354422
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
354423
|
+
_ = 0;
|
|
354424
|
+
continue;
|
|
354425
|
+
}
|
|
354426
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
354427
|
+
_.label = op[1];
|
|
354428
|
+
break;
|
|
354429
|
+
}
|
|
354430
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
354431
|
+
_.label = t[1];
|
|
354432
|
+
t = op;
|
|
354433
|
+
break;
|
|
354434
|
+
}
|
|
354435
|
+
if (t && _.label < t[2]) {
|
|
354436
|
+
_.label = t[2];
|
|
354437
|
+
_.ops.push(op);
|
|
354438
|
+
break;
|
|
354439
|
+
}
|
|
354440
|
+
if (t[2]) _.ops.pop();
|
|
354441
|
+
_.trys.pop();
|
|
354442
|
+
continue;
|
|
354443
|
+
}
|
|
354444
|
+
op = body.call(thisArg, _);
|
|
354445
|
+
} catch (e) {
|
|
354446
|
+
op = [6, e];
|
|
354447
|
+
y = 0;
|
|
354448
|
+
} finally {
|
|
354449
|
+
f = t = 0;
|
|
354450
|
+
}
|
|
354451
|
+
if (op[0] & 5) throw op[1];
|
|
354452
|
+
return {
|
|
354453
|
+
value: op[0] ? op[1] : void 0,
|
|
354454
|
+
done: true
|
|
354455
|
+
};
|
|
354456
|
+
}
|
|
354457
|
+
};
|
|
354458
|
+
exports.__esModule = true;
|
|
354459
|
+
exports.createAllJobs = void 0;
|
|
354460
|
+
var config_1 = __nccwpck_require__(33138);
|
|
354461
|
+
var createJobsForComponent_1 = __nccwpck_require__(80962);
|
|
354462
|
+
var createAllJobs = function (config, trigger) {
|
|
354463
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
354464
|
+
var _a, _b;
|
|
354465
|
+
return __generator(this, function (_c) {
|
|
354466
|
+
switch (_c.label) {
|
|
354467
|
+
case 0:
|
|
354468
|
+
_b = (_a = Object).fromEntries;
|
|
354469
|
+
return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
|
|
354470
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
354471
|
+
var envs, _a, _b, _c;
|
|
354472
|
+
return __generator(this, function (_d) {
|
|
354473
|
+
switch (_d.label) {
|
|
354474
|
+
case 0:
|
|
354475
|
+
envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
|
|
354476
|
+
_a = [componentName];
|
|
354477
|
+
_c = (_b = Object).fromEntries;
|
|
354478
|
+
return [4 /*yield*/, Promise.all(envs.map(function (env) {
|
|
354479
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
354480
|
+
var _a;
|
|
354481
|
+
return __generator(this, function (_b) {
|
|
354482
|
+
switch (_b.label) {
|
|
354483
|
+
case 0:
|
|
354484
|
+
_a = [env];
|
|
354485
|
+
return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
|
|
354486
|
+
case 1:
|
|
354487
|
+
return [2 /*return*/, _a.concat([_b.sent()])];
|
|
354488
|
+
}
|
|
354489
|
+
});
|
|
354490
|
+
});
|
|
354491
|
+
}))];
|
|
354492
|
+
case 1:
|
|
354493
|
+
return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
|
|
354494
|
+
}
|
|
354495
|
+
});
|
|
354496
|
+
});
|
|
354497
|
+
}))];
|
|
354498
|
+
case 1:
|
|
354499
|
+
return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
354500
|
+
}
|
|
354501
|
+
});
|
|
354502
|
+
});
|
|
354503
|
+
};
|
|
354504
|
+
exports.createAllJobs = createAllJobs;
|
|
354505
|
+
|
|
354506
|
+
/***/ }),
|
|
354507
|
+
|
|
354508
|
+
/***/ 78974:
|
|
354509
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
354510
|
+
|
|
354511
|
+
"use strict";
|
|
354512
|
+
|
|
354513
|
+
|
|
354353
354514
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
354354
354515
|
function adopt(value) {
|
|
354355
354516
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -354502,54 +354663,40 @@ var config_1 = __nccwpck_require__(33138);
|
|
|
354502
354663
|
var rules_1 = __nccwpck_require__(42020);
|
|
354503
354664
|
var runner_1 = __nccwpck_require__(55071);
|
|
354504
354665
|
var jobs_1 = __nccwpck_require__(62339);
|
|
354505
|
-
var
|
|
354666
|
+
var createAllJobs_1 = __nccwpck_require__(17052);
|
|
354667
|
+
var createGitlabJobs_1 = __nccwpck_require__(63920);
|
|
354506
354668
|
var createChildPipeline = function (type, trigger, config) {
|
|
354507
354669
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
354508
|
-
var
|
|
354509
|
-
|
|
354510
|
-
|
|
354670
|
+
var jobs, allEnvs, stages, pipeline;
|
|
354671
|
+
var _a;
|
|
354672
|
+
return __generator(this, function (_b) {
|
|
354673
|
+
switch (_b.label) {
|
|
354511
354674
|
case 0:
|
|
354512
|
-
|
|
354513
|
-
return [4 /*yield*/, components.reduce(function (acc, componentName) {
|
|
354514
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
354515
|
-
var envs, _a, _b;
|
|
354516
|
-
return __generator(this, function (_c) {
|
|
354517
|
-
switch (_c.label) {
|
|
354518
|
-
case 0:
|
|
354519
|
-
envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
|
|
354520
|
-
_a = [{}];
|
|
354521
|
-
return [4 /*yield*/, acc];
|
|
354522
|
-
case 1:
|
|
354523
|
-
_b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
|
|
354524
|
-
return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
|
|
354525
|
-
case 2:
|
|
354526
|
-
return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
|
|
354527
|
-
}
|
|
354528
|
-
});
|
|
354529
|
-
});
|
|
354530
|
-
}, Promise.resolve({}))];
|
|
354675
|
+
return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
|
|
354531
354676
|
case 1:
|
|
354532
|
-
jobs =
|
|
354677
|
+
jobs = _b.sent();
|
|
354533
354678
|
allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
|
|
354534
354679
|
stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
|
|
354535
354680
|
return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
|
|
354536
354681
|
return "".concat(baseStage, " ").concat(e);
|
|
354537
354682
|
})), false);
|
|
354538
354683
|
}, []);
|
|
354539
|
-
if (type === "gitlab")
|
|
354540
|
-
|
|
354541
|
-
|
|
354542
|
-
|
|
354543
|
-
|
|
354544
|
-
|
|
354545
|
-
|
|
354546
|
-
|
|
354547
|
-
|
|
354548
|
-
|
|
354549
|
-
|
|
354550
|
-
|
|
354551
|
-
|
|
354552
|
-
|
|
354684
|
+
if (!(type === "gitlab")) return [3 /*break*/, 3];
|
|
354685
|
+
_a = {
|
|
354686
|
+
image: (0, runner_1.getRunnerImage)("jobs-default"),
|
|
354687
|
+
variables: {
|
|
354688
|
+
FF_USE_FASTZIP: "true"
|
|
354689
|
+
},
|
|
354690
|
+
workflow: {
|
|
354691
|
+
rules: rules_1.RULES_ALWAYS
|
|
354692
|
+
},
|
|
354693
|
+
stages: stages
|
|
354694
|
+
};
|
|
354695
|
+
return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
|
|
354696
|
+
case 2:
|
|
354697
|
+
pipeline = (_a.jobs = _b.sent(), _a);
|
|
354698
|
+
return [2 /*return*/, pipeline];
|
|
354699
|
+
case 3:
|
|
354553
354700
|
throw new Error("".concat(type, " is not supported"));
|
|
354554
354701
|
}
|
|
354555
354702
|
});
|
|
@@ -354559,7 +354706,7 @@ exports.createChildPipeline = createChildPipeline;
|
|
|
354559
354706
|
|
|
354560
354707
|
/***/ }),
|
|
354561
354708
|
|
|
354562
|
-
/***/
|
|
354709
|
+
/***/ 80962:
|
|
354563
354710
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
354564
354711
|
|
|
354565
354712
|
"use strict";
|
|
@@ -354730,14 +354877,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
354730
354877
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
354731
354878
|
};
|
|
354732
354879
|
exports.__esModule = true;
|
|
354733
|
-
exports.
|
|
354880
|
+
exports.createJobsForComponent = void 0;
|
|
354734
354881
|
var lodash_1 = __nccwpck_require__(23255);
|
|
354735
354882
|
var build_1 = __nccwpck_require__(73760);
|
|
354736
354883
|
var context_1 = __nccwpck_require__(22041);
|
|
354737
354884
|
var deploy_1 = __nccwpck_require__(90223);
|
|
354738
|
-
var utils_1 = __nccwpck_require__(37461);
|
|
354739
354885
|
var getCommitInfo_1 = __nccwpck_require__(5923);
|
|
354740
|
-
var makeGitlabJob_1 = __nccwpck_require__(15715);
|
|
354741
354886
|
var packageManager_1 = __nccwpck_require__(69168);
|
|
354742
354887
|
var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
354743
354888
|
return jobs.map(function (_a) {
|
|
@@ -354765,71 +354910,9 @@ var createRawJobs = function (context) {
|
|
|
354765
354910
|
var customJobs = getCustomJobs(context);
|
|
354766
354911
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
354767
354912
|
};
|
|
354768
|
-
var
|
|
354769
|
-
if (env) {
|
|
354770
|
-
return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
|
|
354771
|
-
}
|
|
354772
|
-
return "".concat(componentName, " ").concat(name);
|
|
354773
|
-
};
|
|
354774
|
-
var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
|
|
354775
|
-
var referencedJob = allRawJobs.find(function (j) {
|
|
354776
|
-
return j.name === referencedJobName;
|
|
354777
|
-
});
|
|
354778
|
-
if (!referencedJob) {
|
|
354779
|
-
throw new Error("unknown job referenced: " + referencedJobName);
|
|
354780
|
-
}
|
|
354781
|
-
var envToSet = referencedJob.envMode !== "none" ? env : null;
|
|
354782
|
-
return getFullJobName(referencedJobName, componentName, envToSet);
|
|
354783
|
-
};
|
|
354784
|
-
// replaces references to other jobs with the full name
|
|
354785
|
-
// the full name contains the componentname and the env name (if any)
|
|
354786
|
-
var replaceReferences = function (job, componentName, env, allRawJobs) {
|
|
354787
|
-
var _a, _b, _c;
|
|
354788
|
-
var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
354789
|
-
var cleanedNeeds = __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read((_b = job.needsOtherComponent) !== null && _b !== void 0 ? _b : []), false);
|
|
354790
|
-
var needs = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
|
|
354791
|
-
var _a;
|
|
354792
|
-
return (0, lodash_1.isObject)(n) ? {
|
|
354793
|
-
job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allRawJobs),
|
|
354794
|
-
artifacts: n.artifacts
|
|
354795
|
-
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
354796
|
-
});
|
|
354797
|
-
return __assign(__assign({}, job), {
|
|
354798
|
-
stage: stage,
|
|
354799
|
-
needs: needs,
|
|
354800
|
-
environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
|
|
354801
|
-
on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
|
|
354802
|
-
}) : job.environment
|
|
354803
|
-
});
|
|
354804
|
-
};
|
|
354805
|
-
// this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
|
|
354806
|
-
var addStageNeeds = function (jobs) {
|
|
354807
|
-
// when a job defines needsStages, we add these as needs
|
|
354808
|
-
return jobs.map(function (job) {
|
|
354809
|
-
var _a;
|
|
354810
|
-
if (!job.needsStages || job.needsStages.length === 0) {
|
|
354811
|
-
return job;
|
|
354812
|
-
}
|
|
354813
|
-
var neededJobs = jobs.map(function (j) {
|
|
354814
|
-
var _a, _b;
|
|
354815
|
-
var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
|
|
354816
|
-
return j.stage === s.stage;
|
|
354817
|
-
});
|
|
354818
|
-
if (neededStage) {
|
|
354819
|
-
return {
|
|
354820
|
-
job: j.name,
|
|
354821
|
-
artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
|
|
354822
|
-
};
|
|
354823
|
-
}
|
|
354824
|
-
}).filter(utils_1.notNil);
|
|
354825
|
-
return __assign(__assign({}, job), {
|
|
354826
|
-
needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
|
|
354827
|
-
});
|
|
354828
|
-
});
|
|
354829
|
-
};
|
|
354830
|
-
var createJobs = function (type, envs, config, componentName, trigger) {
|
|
354913
|
+
var createJobsForComponent = function (config, componentName, env, trigger) {
|
|
354831
354914
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
354832
|
-
var commitInfo, _a, packageManagerInfo;
|
|
354915
|
+
var commitInfo, _a, packageManagerInfo, context;
|
|
354833
354916
|
return __generator(this, function (_b) {
|
|
354834
354917
|
switch (_b.label) {
|
|
354835
354918
|
case 0:
|
|
@@ -354842,47 +354925,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
|
|
|
354842
354925
|
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
|
|
354843
354926
|
case 2:
|
|
354844
354927
|
packageManagerInfo = _b.sent();
|
|
354845
|
-
return [
|
|
354846
|
-
|
|
354847
|
-
|
|
354848
|
-
|
|
354849
|
-
switch (_f.label) {
|
|
354850
|
-
case 0:
|
|
354851
|
-
return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
|
|
354852
|
-
case 1:
|
|
354853
|
-
context = _f.sent();
|
|
354854
|
-
jobs = addStageNeeds(createRawJobs(context));
|
|
354855
|
-
_a = [{}];
|
|
354856
|
-
return [4 /*yield*/, acc];
|
|
354857
|
-
case 2:
|
|
354858
|
-
_b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
|
|
354859
|
-
_d = (_c = jobs).reduce;
|
|
354860
|
-
_e = [function (acc, job) {
|
|
354861
|
-
var _a;
|
|
354862
|
-
var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
|
|
354863
|
-
var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
|
|
354864
|
-
if (type === "gitlab") {
|
|
354865
|
-
return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
|
|
354866
|
-
}
|
|
354867
|
-
throw new Error("not supported");
|
|
354868
|
-
}];
|
|
354869
|
-
return [4 /*yield*/, Promise.resolve({})];
|
|
354870
|
-
case 3:
|
|
354871
|
-
result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
|
|
354872
|
-
return [2 /*return*/, result];
|
|
354873
|
-
}
|
|
354874
|
-
});
|
|
354875
|
-
});
|
|
354876
|
-
}, {})];
|
|
354928
|
+
return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
|
|
354929
|
+
case 3:
|
|
354930
|
+
context = _b.sent();
|
|
354931
|
+
return [2 /*return*/, createRawJobs(context)];
|
|
354877
354932
|
}
|
|
354878
354933
|
});
|
|
354879
354934
|
});
|
|
354880
354935
|
};
|
|
354881
|
-
exports.
|
|
354936
|
+
exports.createJobsForComponent = createJobsForComponent;
|
|
354882
354937
|
|
|
354883
354938
|
/***/ }),
|
|
354884
354939
|
|
|
354885
|
-
/***/
|
|
354940
|
+
/***/ 63920:
|
|
354886
354941
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
354887
354942
|
|
|
354888
354943
|
"use strict";
|
|
@@ -354898,6 +354953,121 @@ var __assign = this && this.__assign || function () {
|
|
|
354898
354953
|
};
|
|
354899
354954
|
return __assign.apply(this, arguments);
|
|
354900
354955
|
};
|
|
354956
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
354957
|
+
function adopt(value) {
|
|
354958
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
354959
|
+
resolve(value);
|
|
354960
|
+
});
|
|
354961
|
+
}
|
|
354962
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
354963
|
+
function fulfilled(value) {
|
|
354964
|
+
try {
|
|
354965
|
+
step(generator.next(value));
|
|
354966
|
+
} catch (e) {
|
|
354967
|
+
reject(e);
|
|
354968
|
+
}
|
|
354969
|
+
}
|
|
354970
|
+
function rejected(value) {
|
|
354971
|
+
try {
|
|
354972
|
+
step(generator["throw"](value));
|
|
354973
|
+
} catch (e) {
|
|
354974
|
+
reject(e);
|
|
354975
|
+
}
|
|
354976
|
+
}
|
|
354977
|
+
function step(result) {
|
|
354978
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
354979
|
+
}
|
|
354980
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
354981
|
+
});
|
|
354982
|
+
};
|
|
354983
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
354984
|
+
var _ = {
|
|
354985
|
+
label: 0,
|
|
354986
|
+
sent: function () {
|
|
354987
|
+
if (t[0] & 1) throw t[1];
|
|
354988
|
+
return t[1];
|
|
354989
|
+
},
|
|
354990
|
+
trys: [],
|
|
354991
|
+
ops: []
|
|
354992
|
+
},
|
|
354993
|
+
f,
|
|
354994
|
+
y,
|
|
354995
|
+
t,
|
|
354996
|
+
g;
|
|
354997
|
+
return g = {
|
|
354998
|
+
next: verb(0),
|
|
354999
|
+
"throw": verb(1),
|
|
355000
|
+
"return": verb(2)
|
|
355001
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
355002
|
+
return this;
|
|
355003
|
+
}), g;
|
|
355004
|
+
function verb(n) {
|
|
355005
|
+
return function (v) {
|
|
355006
|
+
return step([n, v]);
|
|
355007
|
+
};
|
|
355008
|
+
}
|
|
355009
|
+
function step(op) {
|
|
355010
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
355011
|
+
while (_) try {
|
|
355012
|
+
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;
|
|
355013
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
355014
|
+
switch (op[0]) {
|
|
355015
|
+
case 0:
|
|
355016
|
+
case 1:
|
|
355017
|
+
t = op;
|
|
355018
|
+
break;
|
|
355019
|
+
case 4:
|
|
355020
|
+
_.label++;
|
|
355021
|
+
return {
|
|
355022
|
+
value: op[1],
|
|
355023
|
+
done: false
|
|
355024
|
+
};
|
|
355025
|
+
case 5:
|
|
355026
|
+
_.label++;
|
|
355027
|
+
y = op[1];
|
|
355028
|
+
op = [0];
|
|
355029
|
+
continue;
|
|
355030
|
+
case 7:
|
|
355031
|
+
op = _.ops.pop();
|
|
355032
|
+
_.trys.pop();
|
|
355033
|
+
continue;
|
|
355034
|
+
default:
|
|
355035
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
355036
|
+
_ = 0;
|
|
355037
|
+
continue;
|
|
355038
|
+
}
|
|
355039
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
355040
|
+
_.label = op[1];
|
|
355041
|
+
break;
|
|
355042
|
+
}
|
|
355043
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
355044
|
+
_.label = t[1];
|
|
355045
|
+
t = op;
|
|
355046
|
+
break;
|
|
355047
|
+
}
|
|
355048
|
+
if (t && _.label < t[2]) {
|
|
355049
|
+
_.label = t[2];
|
|
355050
|
+
_.ops.push(op);
|
|
355051
|
+
break;
|
|
355052
|
+
}
|
|
355053
|
+
if (t[2]) _.ops.pop();
|
|
355054
|
+
_.trys.pop();
|
|
355055
|
+
continue;
|
|
355056
|
+
}
|
|
355057
|
+
op = body.call(thisArg, _);
|
|
355058
|
+
} catch (e) {
|
|
355059
|
+
op = [6, e];
|
|
355060
|
+
y = 0;
|
|
355061
|
+
} finally {
|
|
355062
|
+
f = t = 0;
|
|
355063
|
+
}
|
|
355064
|
+
if (op[0] & 5) throw op[1];
|
|
355065
|
+
return {
|
|
355066
|
+
value: op[0] ? op[1] : void 0,
|
|
355067
|
+
done: true
|
|
355068
|
+
};
|
|
355069
|
+
}
|
|
355070
|
+
};
|
|
354901
355071
|
var __rest = this && this.__rest || function (s, e) {
|
|
354902
355072
|
var t = {};
|
|
354903
355073
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -354938,29 +355108,99 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
354938
355108
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
354939
355109
|
};
|
|
354940
355110
|
exports.__esModule = true;
|
|
354941
|
-
exports.makeGitlabJob = void 0;
|
|
355111
|
+
exports.createGitlabJobs = exports.makeGitlabJob = void 0;
|
|
354942
355112
|
var lodash_1 = __nccwpck_require__(23255);
|
|
354943
355113
|
var defaults_1 = __nccwpck_require__(87383);
|
|
355114
|
+
var getFullJobName = function (name, componentName, env) {
|
|
355115
|
+
if (env) {
|
|
355116
|
+
return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
|
|
355117
|
+
}
|
|
355118
|
+
return "".concat(componentName, " ").concat(name);
|
|
355119
|
+
};
|
|
355120
|
+
var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
|
|
355121
|
+
var _a, _b;
|
|
355122
|
+
var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
|
|
355123
|
+
return j.name === referencedJobName;
|
|
355124
|
+
});
|
|
355125
|
+
if (!referencedJob) {
|
|
355126
|
+
throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
|
|
355127
|
+
}
|
|
355128
|
+
var envToSet = referencedJob.envMode !== "none" ? env : null;
|
|
355129
|
+
return getFullJobName(referencedJobName, componentName, envToSet);
|
|
355130
|
+
};
|
|
354944
355131
|
var getJobName = function (need) {
|
|
354945
355132
|
return (0, lodash_1.isObject)(need) ? need.job : need;
|
|
354946
355133
|
};
|
|
354947
|
-
var makeGitlabJob = function (_a) {
|
|
355134
|
+
var makeGitlabJob = function (componentName, env, _a, allJobs) {
|
|
355135
|
+
var _b;
|
|
354948
355136
|
var envMode = _a.envMode,
|
|
354949
355137
|
needsStages = _a.needsStages,
|
|
354950
355138
|
needsOtherComponent = _a.needsOtherComponent,
|
|
354951
355139
|
name = _a.name,
|
|
354952
355140
|
needs = _a.needs,
|
|
354953
|
-
|
|
354954
|
-
|
|
355141
|
+
job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
|
|
355142
|
+
var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
355143
|
+
var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
|
|
355144
|
+
var _a, _b, _c, _d;
|
|
355145
|
+
var referencedComponentName = componentName;
|
|
355146
|
+
var allJobNamesFromThatStage = (_d = (_c = (_b = (_a = allJobs[referencedComponentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.filter(function (j) {
|
|
355147
|
+
return j.stage === n.stage;
|
|
355148
|
+
})) === null || _c === void 0 ? void 0 : _c.map(function (j) {
|
|
355149
|
+
return j.name;
|
|
355150
|
+
})) !== null && _d !== void 0 ? _d : [];
|
|
355151
|
+
return allJobNamesFromThatStage.map(function (job) {
|
|
355152
|
+
var _a;
|
|
355153
|
+
return {
|
|
355154
|
+
job: job,
|
|
355155
|
+
artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
|
|
355156
|
+
componentName: referencedComponentName
|
|
355157
|
+
};
|
|
355158
|
+
});
|
|
355159
|
+
});
|
|
355160
|
+
var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read(needs !== null && needs !== void 0 ? needs : []), false), __read(needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : []), false), __read(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []), false);
|
|
355161
|
+
var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
|
|
355162
|
+
var _a;
|
|
355163
|
+
return (0, lodash_1.isObject)(n) ? {
|
|
355164
|
+
job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
|
|
355165
|
+
artifacts: n.artifacts
|
|
355166
|
+
} : getFullReferencedJobName(n, componentName, env, allJobs);
|
|
355167
|
+
}).sort(function (a, b) {
|
|
355168
|
+
return getJobName(a).localeCompare(getJobName(b));
|
|
355169
|
+
});
|
|
355170
|
+
var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
|
|
355171
|
+
var gitlabJob = __assign(__assign({}, job), {
|
|
355172
|
+
stage: stage,
|
|
355173
|
+
environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
|
|
355174
|
+
on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
|
|
355175
|
+
}) : job.environment,
|
|
354955
355176
|
// sort in a predictable manner for snapshot tests
|
|
354956
|
-
needs:
|
|
354957
|
-
return getJobName(a).localeCompare(getJobName(b));
|
|
354958
|
-
}) : undefined,
|
|
355177
|
+
needs: gitlabNeeds,
|
|
354959
355178
|
retry: defaults_1.BASE_RETRY,
|
|
354960
355179
|
interruptible: true
|
|
354961
355180
|
});
|
|
355181
|
+
return [fullJobName, gitlabJob];
|
|
354962
355182
|
};
|
|
354963
355183
|
exports.makeGitlabJob = makeGitlabJob;
|
|
355184
|
+
var createGitlabJobs = function (allJobs) {
|
|
355185
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
355186
|
+
return __generator(this, function (_a) {
|
|
355187
|
+
return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
|
|
355188
|
+
var componentJobs = allJobs[componentName];
|
|
355189
|
+
return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
|
|
355190
|
+
var jobs = componentJobs[env];
|
|
355191
|
+
return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
|
|
355192
|
+
var _a;
|
|
355193
|
+
var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
|
|
355194
|
+
fullJobName = _b[0],
|
|
355195
|
+
gitlabJob = _b[1];
|
|
355196
|
+
return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
|
|
355197
|
+
}, {}));
|
|
355198
|
+
}, {}));
|
|
355199
|
+
}, {})];
|
|
355200
|
+
});
|
|
355201
|
+
});
|
|
355202
|
+
};
|
|
355203
|
+
exports.createGitlabJobs = createGitlabJobs;
|
|
354964
355204
|
|
|
354965
355205
|
/***/ }),
|
|
354966
355206
|
|
|
@@ -354987,7 +355227,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
|
354987
355227
|
};
|
|
354988
355228
|
exports.__esModule = true;
|
|
354989
355229
|
__exportStar(__nccwpck_require__(78974), exports);
|
|
354990
|
-
__exportStar(__nccwpck_require__(
|
|
355230
|
+
__exportStar(__nccwpck_require__(80962), exports);
|
|
354991
355231
|
|
|
354992
355232
|
/***/ }),
|
|
354993
355233
|
|