@catladder/cli 0.0.0-main-d4f1e432 → 0.0.0-main-d184a023

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.
@@ -40112,7 +40112,7 @@ exports.readConfigSync = readConfigSync;
40112
40112
 
40113
40113
  exports.__esModule = true;
40114
40114
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40115
- exports.PIPELINE_IMAGE_TAG = "main-d4f1e432" || 0;
40115
+ exports.PIPELINE_IMAGE_TAG = "main-d184a023" || 0;
40116
40116
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40117
40117
 
40118
40118
  /***/ }),
@@ -42346,33 +42346,36 @@ var kubeEnv_1 = __nccwpck_require__(9449);
42346
42346
  var mongodb_1 = __nccwpck_require__(7601);
42347
42347
  var processSecretsAsFiles_1 = __nccwpck_require__(5187);
42348
42348
  var createAppConfig = function (context, application) {
42349
- var _a, _b, _c;
42350
42349
  if (application === false) {
42351
42350
  return {
42352
42351
  enabled: false
42353
42352
  };
42354
42353
  }
42354
+ var _a = application !== null && application !== void 0 ? application : {},
42355
+ healthRoute = _a.healthRoute,
42356
+ command = _a.command,
42357
+ rest = __rest(_a, ["healthRoute", "command"]);
42355
42358
  return (0, utils_1.mergeWithMergingArrays)({
42356
42359
  host: context.environment.host,
42357
- command: context.componentConfig.build.startCommand,
42360
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
42358
42361
  livenessProbe: {
42359
42362
  httpGet: {
42360
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
42363
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42361
42364
  }
42362
42365
  },
42363
42366
  readinessProbe: {
42364
42367
  httpGet: {
42365
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
42368
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42366
42369
  }
42367
42370
  },
42368
42371
  startupProbe: {
42369
42372
  httpGet: {
42370
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
42373
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42371
42374
  }
42372
42375
  }
42373
42376
  },
42374
42377
  // default
42375
- application // merge rest in
42378
+ rest // merge rest in
42376
42379
  );
42377
42380
  };
42378
42381
 
@@ -43008,22 +43011,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
43008
43011
 
43009
43012
  /***/ }),
43010
43013
 
43011
- /***/ 8974:
43014
+ /***/ 7052:
43012
43015
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43013
43016
 
43014
43017
  "use strict";
43015
43018
 
43016
43019
 
43017
- var __assign = this && this.__assign || function () {
43018
- __assign = Object.assign || function (t) {
43019
- for (var s, i = 1, n = arguments.length; i < n; i++) {
43020
- s = arguments[i];
43021
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43020
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43021
+ function adopt(value) {
43022
+ return value instanceof P ? value : new P(function (resolve) {
43023
+ resolve(value);
43024
+ });
43025
+ }
43026
+ return new (P || (P = Promise))(function (resolve, reject) {
43027
+ function fulfilled(value) {
43028
+ try {
43029
+ step(generator.next(value));
43030
+ } catch (e) {
43031
+ reject(e);
43032
+ }
43022
43033
  }
43023
- return t;
43024
- };
43025
- return __assign.apply(this, arguments);
43034
+ function rejected(value) {
43035
+ try {
43036
+ step(generator["throw"](value));
43037
+ } catch (e) {
43038
+ reject(e);
43039
+ }
43040
+ }
43041
+ function step(result) {
43042
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43043
+ }
43044
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43045
+ });
43046
+ };
43047
+ var __generator = this && this.__generator || function (thisArg, body) {
43048
+ var _ = {
43049
+ label: 0,
43050
+ sent: function () {
43051
+ if (t[0] & 1) throw t[1];
43052
+ return t[1];
43053
+ },
43054
+ trys: [],
43055
+ ops: []
43056
+ },
43057
+ f,
43058
+ y,
43059
+ t,
43060
+ g;
43061
+ return g = {
43062
+ next: verb(0),
43063
+ "throw": verb(1),
43064
+ "return": verb(2)
43065
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
43066
+ return this;
43067
+ }), g;
43068
+ function verb(n) {
43069
+ return function (v) {
43070
+ return step([n, v]);
43071
+ };
43072
+ }
43073
+ function step(op) {
43074
+ if (f) throw new TypeError("Generator is already executing.");
43075
+ while (_) try {
43076
+ 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;
43077
+ if (y = 0, t) op = [op[0] & 2, t.value];
43078
+ switch (op[0]) {
43079
+ case 0:
43080
+ case 1:
43081
+ t = op;
43082
+ break;
43083
+ case 4:
43084
+ _.label++;
43085
+ return {
43086
+ value: op[1],
43087
+ done: false
43088
+ };
43089
+ case 5:
43090
+ _.label++;
43091
+ y = op[1];
43092
+ op = [0];
43093
+ continue;
43094
+ case 7:
43095
+ op = _.ops.pop();
43096
+ _.trys.pop();
43097
+ continue;
43098
+ default:
43099
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
43100
+ _ = 0;
43101
+ continue;
43102
+ }
43103
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
43104
+ _.label = op[1];
43105
+ break;
43106
+ }
43107
+ if (op[0] === 6 && _.label < t[1]) {
43108
+ _.label = t[1];
43109
+ t = op;
43110
+ break;
43111
+ }
43112
+ if (t && _.label < t[2]) {
43113
+ _.label = t[2];
43114
+ _.ops.push(op);
43115
+ break;
43116
+ }
43117
+ if (t[2]) _.ops.pop();
43118
+ _.trys.pop();
43119
+ continue;
43120
+ }
43121
+ op = body.call(thisArg, _);
43122
+ } catch (e) {
43123
+ op = [6, e];
43124
+ y = 0;
43125
+ } finally {
43126
+ f = t = 0;
43127
+ }
43128
+ if (op[0] & 5) throw op[1];
43129
+ return {
43130
+ value: op[0] ? op[1] : void 0,
43131
+ done: true
43132
+ };
43133
+ }
43134
+ };
43135
+ exports.__esModule = true;
43136
+ exports.createAllJobs = void 0;
43137
+ var config_1 = __nccwpck_require__(3138);
43138
+ var createJobsForComponent_1 = __nccwpck_require__(962);
43139
+ var createAllJobs = function (config, trigger) {
43140
+ return __awaiter(void 0, void 0, void 0, function () {
43141
+ var _a, _b;
43142
+ return __generator(this, function (_c) {
43143
+ switch (_c.label) {
43144
+ case 0:
43145
+ _b = (_a = Object).fromEntries;
43146
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
43147
+ return __awaiter(void 0, void 0, void 0, function () {
43148
+ var envs, _a, _b, _c;
43149
+ return __generator(this, function (_d) {
43150
+ switch (_d.label) {
43151
+ case 0:
43152
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
43153
+ _a = [componentName];
43154
+ _c = (_b = Object).fromEntries;
43155
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
43156
+ return __awaiter(void 0, void 0, void 0, function () {
43157
+ var _a;
43158
+ return __generator(this, function (_b) {
43159
+ switch (_b.label) {
43160
+ case 0:
43161
+ _a = [env];
43162
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
43163
+ case 1:
43164
+ return [2 /*return*/, _a.concat([_b.sent()])];
43165
+ }
43166
+ });
43167
+ });
43168
+ }))];
43169
+ case 1:
43170
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
43171
+ }
43172
+ });
43173
+ });
43174
+ }))];
43175
+ case 1:
43176
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
43177
+ }
43178
+ });
43179
+ });
43026
43180
  };
43181
+ exports.createAllJobs = createAllJobs;
43182
+
43183
+ /***/ }),
43184
+
43185
+ /***/ 8974:
43186
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43187
+
43188
+ "use strict";
43189
+
43190
+
43027
43191
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43028
43192
  function adopt(value) {
43029
43193
  return value instanceof P ? value : new P(function (resolve) {
@@ -43176,54 +43340,40 @@ var config_1 = __nccwpck_require__(3138);
43176
43340
  var rules_1 = __nccwpck_require__(2020);
43177
43341
  var runner_1 = __nccwpck_require__(5071);
43178
43342
  var jobs_1 = __nccwpck_require__(2339);
43179
- var createJobs_1 = __nccwpck_require__(7726);
43343
+ var createAllJobs_1 = __nccwpck_require__(7052);
43344
+ var createGitlabJobs_1 = __nccwpck_require__(3920);
43180
43345
  var createChildPipeline = function (type, trigger, config) {
43181
43346
  return __awaiter(void 0, void 0, void 0, function () {
43182
- var components, jobs, allEnvs, stages, pipeline;
43183
- return __generator(this, function (_a) {
43184
- switch (_a.label) {
43347
+ var jobs, allEnvs, stages, pipeline;
43348
+ var _a;
43349
+ return __generator(this, function (_b) {
43350
+ switch (_b.label) {
43185
43351
  case 0:
43186
- components = Object.keys(config.components);
43187
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
43188
- return __awaiter(void 0, void 0, void 0, function () {
43189
- var envs, _a, _b;
43190
- return __generator(this, function (_c) {
43191
- switch (_c.label) {
43192
- case 0:
43193
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
43194
- _a = [{}];
43195
- return [4 /*yield*/, acc];
43196
- case 1:
43197
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
43198
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
43199
- case 2:
43200
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
43201
- }
43202
- });
43203
- });
43204
- }, Promise.resolve({}))];
43352
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
43205
43353
  case 1:
43206
- jobs = _a.sent();
43354
+ jobs = _b.sent();
43207
43355
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
43208
43356
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
43209
43357
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
43210
43358
  return "".concat(baseStage, " ").concat(e);
43211
43359
  })), false);
43212
43360
  }, []);
43213
- if (type === "gitlab") {
43214
- pipeline = {
43215
- image: (0, runner_1.getRunnerImage)("jobs-default"),
43216
- variables: {
43217
- FF_USE_FASTZIP: "true"
43218
- },
43219
- workflow: {
43220
- rules: rules_1.RULES_ALWAYS
43221
- },
43222
- stages: stages,
43223
- jobs: jobs
43224
- };
43225
- return [2 /*return*/, pipeline];
43226
- }
43361
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
43362
+ _a = {
43363
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
43364
+ variables: {
43365
+ FF_USE_FASTZIP: "true"
43366
+ },
43367
+ workflow: {
43368
+ rules: rules_1.RULES_ALWAYS
43369
+ },
43370
+ stages: stages
43371
+ };
43372
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
43373
+ case 2:
43374
+ pipeline = (_a.jobs = _b.sent(), _a);
43375
+ return [2 /*return*/, pipeline];
43376
+ case 3:
43227
43377
  throw new Error("".concat(type, " is not supported"));
43228
43378
  }
43229
43379
  });
@@ -43233,7 +43383,7 @@ exports.createChildPipeline = createChildPipeline;
43233
43383
 
43234
43384
  /***/ }),
43235
43385
 
43236
- /***/ 7726:
43386
+ /***/ 962:
43237
43387
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43238
43388
 
43239
43389
  "use strict";
@@ -43404,14 +43554,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43404
43554
  return to.concat(ar || Array.prototype.slice.call(from));
43405
43555
  };
43406
43556
  exports.__esModule = true;
43407
- exports.createJobs = void 0;
43557
+ exports.createJobsForComponent = void 0;
43408
43558
  var lodash_1 = __nccwpck_require__(3255);
43409
43559
  var build_1 = __nccwpck_require__(3760);
43410
43560
  var context_1 = __nccwpck_require__(2041);
43411
43561
  var deploy_1 = __nccwpck_require__(223);
43412
- var utils_1 = __nccwpck_require__(7461);
43413
43562
  var getCommitInfo_1 = __nccwpck_require__(5923);
43414
- var makeGitlabJob_1 = __nccwpck_require__(5715);
43415
43563
  var packageManager_1 = __nccwpck_require__(9168);
43416
43564
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
43417
43565
  return jobs.map(function (_a) {
@@ -43439,71 +43587,9 @@ var createRawJobs = function (context) {
43439
43587
  var customJobs = getCustomJobs(context);
43440
43588
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
43441
43589
  };
43442
- var getFullJobName = function (name, componentName, env) {
43443
- if (env) {
43444
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
43445
- }
43446
- return "".concat(componentName, " ").concat(name);
43447
- };
43448
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
43449
- var referencedJob = allRawJobs.find(function (j) {
43450
- return j.name === referencedJobName;
43451
- });
43452
- if (!referencedJob) {
43453
- throw new Error("unknown job referenced: " + referencedJobName);
43454
- }
43455
- var envToSet = referencedJob.envMode !== "none" ? env : null;
43456
- return getFullJobName(referencedJobName, componentName, envToSet);
43457
- };
43458
- // replaces references to other jobs with the full name
43459
- // the full name contains the componentname and the env name (if any)
43460
- var replaceReferences = function (job, componentName, env, allRawJobs) {
43461
- var _a, _b, _c;
43462
- var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
43463
- var cleanedNeeds = __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read((_b = job.needsOtherComponent) !== null && _b !== void 0 ? _b : []), false);
43464
- var needs = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
43465
- var _a;
43466
- return (0, lodash_1.isObject)(n) ? {
43467
- job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allRawJobs),
43468
- artifacts: n.artifacts
43469
- } : getFullReferencedJobName(n, componentName, env, allRawJobs);
43470
- });
43471
- return __assign(__assign({}, job), {
43472
- stage: stage,
43473
- needs: needs,
43474
- environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
43475
- on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
43476
- }) : job.environment
43477
- });
43478
- };
43479
- // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
43480
- var addStageNeeds = function (jobs) {
43481
- // when a job defines needsStages, we add these as needs
43482
- return jobs.map(function (job) {
43483
- var _a;
43484
- if (!job.needsStages || job.needsStages.length === 0) {
43485
- return job;
43486
- }
43487
- var neededJobs = jobs.map(function (j) {
43488
- var _a, _b;
43489
- var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
43490
- return j.stage === s.stage;
43491
- });
43492
- if (neededStage) {
43493
- return {
43494
- job: j.name,
43495
- artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
43496
- };
43497
- }
43498
- }).filter(utils_1.notNil);
43499
- return __assign(__assign({}, job), {
43500
- needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
43501
- });
43502
- });
43503
- };
43504
- var createJobs = function (type, envs, config, componentName, trigger) {
43590
+ var createJobsForComponent = function (config, componentName, env, trigger) {
43505
43591
  return __awaiter(void 0, void 0, void 0, function () {
43506
- var commitInfo, _a, packageManagerInfo;
43592
+ var commitInfo, _a, packageManagerInfo, context;
43507
43593
  return __generator(this, function (_b) {
43508
43594
  switch (_b.label) {
43509
43595
  case 0:
@@ -43516,47 +43602,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
43516
43602
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
43517
43603
  case 2:
43518
43604
  packageManagerInfo = _b.sent();
43519
- return [2 /*return*/, envs.reduce(function (acc, env) {
43520
- return __awaiter(void 0, void 0, void 0, function () {
43521
- var context, jobs, result, _a, _b, _c, _d, _e;
43522
- return __generator(this, function (_f) {
43523
- switch (_f.label) {
43524
- case 0:
43525
- return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
43526
- case 1:
43527
- context = _f.sent();
43528
- jobs = addStageNeeds(createRawJobs(context));
43529
- _a = [{}];
43530
- return [4 /*yield*/, acc];
43531
- case 2:
43532
- _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
43533
- _d = (_c = jobs).reduce;
43534
- _e = [function (acc, job) {
43535
- var _a;
43536
- var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
43537
- var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
43538
- if (type === "gitlab") {
43539
- return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
43540
- }
43541
- throw new Error("not supported");
43542
- }];
43543
- return [4 /*yield*/, Promise.resolve({})];
43544
- case 3:
43545
- result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
43546
- return [2 /*return*/, result];
43547
- }
43548
- });
43549
- });
43550
- }, {})];
43605
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
43606
+ case 3:
43607
+ context = _b.sent();
43608
+ return [2 /*return*/, createRawJobs(context)];
43551
43609
  }
43552
43610
  });
43553
43611
  });
43554
43612
  };
43555
- exports.createJobs = createJobs;
43613
+ exports.createJobsForComponent = createJobsForComponent;
43556
43614
 
43557
43615
  /***/ }),
43558
43616
 
43559
- /***/ 5715:
43617
+ /***/ 3920:
43560
43618
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43561
43619
 
43562
43620
  "use strict";
@@ -43572,6 +43630,121 @@ var __assign = this && this.__assign || function () {
43572
43630
  };
43573
43631
  return __assign.apply(this, arguments);
43574
43632
  };
43633
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43634
+ function adopt(value) {
43635
+ return value instanceof P ? value : new P(function (resolve) {
43636
+ resolve(value);
43637
+ });
43638
+ }
43639
+ return new (P || (P = Promise))(function (resolve, reject) {
43640
+ function fulfilled(value) {
43641
+ try {
43642
+ step(generator.next(value));
43643
+ } catch (e) {
43644
+ reject(e);
43645
+ }
43646
+ }
43647
+ function rejected(value) {
43648
+ try {
43649
+ step(generator["throw"](value));
43650
+ } catch (e) {
43651
+ reject(e);
43652
+ }
43653
+ }
43654
+ function step(result) {
43655
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43656
+ }
43657
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43658
+ });
43659
+ };
43660
+ var __generator = this && this.__generator || function (thisArg, body) {
43661
+ var _ = {
43662
+ label: 0,
43663
+ sent: function () {
43664
+ if (t[0] & 1) throw t[1];
43665
+ return t[1];
43666
+ },
43667
+ trys: [],
43668
+ ops: []
43669
+ },
43670
+ f,
43671
+ y,
43672
+ t,
43673
+ g;
43674
+ return g = {
43675
+ next: verb(0),
43676
+ "throw": verb(1),
43677
+ "return": verb(2)
43678
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
43679
+ return this;
43680
+ }), g;
43681
+ function verb(n) {
43682
+ return function (v) {
43683
+ return step([n, v]);
43684
+ };
43685
+ }
43686
+ function step(op) {
43687
+ if (f) throw new TypeError("Generator is already executing.");
43688
+ while (_) try {
43689
+ 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;
43690
+ if (y = 0, t) op = [op[0] & 2, t.value];
43691
+ switch (op[0]) {
43692
+ case 0:
43693
+ case 1:
43694
+ t = op;
43695
+ break;
43696
+ case 4:
43697
+ _.label++;
43698
+ return {
43699
+ value: op[1],
43700
+ done: false
43701
+ };
43702
+ case 5:
43703
+ _.label++;
43704
+ y = op[1];
43705
+ op = [0];
43706
+ continue;
43707
+ case 7:
43708
+ op = _.ops.pop();
43709
+ _.trys.pop();
43710
+ continue;
43711
+ default:
43712
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
43713
+ _ = 0;
43714
+ continue;
43715
+ }
43716
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
43717
+ _.label = op[1];
43718
+ break;
43719
+ }
43720
+ if (op[0] === 6 && _.label < t[1]) {
43721
+ _.label = t[1];
43722
+ t = op;
43723
+ break;
43724
+ }
43725
+ if (t && _.label < t[2]) {
43726
+ _.label = t[2];
43727
+ _.ops.push(op);
43728
+ break;
43729
+ }
43730
+ if (t[2]) _.ops.pop();
43731
+ _.trys.pop();
43732
+ continue;
43733
+ }
43734
+ op = body.call(thisArg, _);
43735
+ } catch (e) {
43736
+ op = [6, e];
43737
+ y = 0;
43738
+ } finally {
43739
+ f = t = 0;
43740
+ }
43741
+ if (op[0] & 5) throw op[1];
43742
+ return {
43743
+ value: op[0] ? op[1] : void 0,
43744
+ done: true
43745
+ };
43746
+ }
43747
+ };
43575
43748
  var __rest = this && this.__rest || function (s, e) {
43576
43749
  var t = {};
43577
43750
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -43612,29 +43785,99 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43612
43785
  return to.concat(ar || Array.prototype.slice.call(from));
43613
43786
  };
43614
43787
  exports.__esModule = true;
43615
- exports.makeGitlabJob = void 0;
43788
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
43616
43789
  var lodash_1 = __nccwpck_require__(3255);
43617
43790
  var defaults_1 = __nccwpck_require__(7383);
43791
+ var getFullJobName = function (name, componentName, env) {
43792
+ if (env) {
43793
+ return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
43794
+ }
43795
+ return "".concat(componentName, " ").concat(name);
43796
+ };
43797
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
43798
+ var _a, _b;
43799
+ var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
43800
+ return j.name === referencedJobName;
43801
+ });
43802
+ if (!referencedJob) {
43803
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
43804
+ }
43805
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
43806
+ return getFullJobName(referencedJobName, componentName, envToSet);
43807
+ };
43618
43808
  var getJobName = function (need) {
43619
43809
  return (0, lodash_1.isObject)(need) ? need.job : need;
43620
43810
  };
43621
- var makeGitlabJob = function (_a) {
43811
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
43812
+ var _b;
43622
43813
  var envMode = _a.envMode,
43623
43814
  needsStages = _a.needsStages,
43624
43815
  needsOtherComponent = _a.needsOtherComponent,
43625
43816
  name = _a.name,
43626
43817
  needs = _a.needs,
43627
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43628
- return __assign(__assign({}, rest), {
43818
+ job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43819
+ var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
43820
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
43821
+ var _a, _b, _c, _d;
43822
+ var referencedComponentName = componentName;
43823
+ 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) {
43824
+ return j.stage === n.stage;
43825
+ })) === null || _c === void 0 ? void 0 : _c.map(function (j) {
43826
+ return j.name;
43827
+ })) !== null && _d !== void 0 ? _d : [];
43828
+ return allJobNamesFromThatStage.map(function (job) {
43829
+ var _a;
43830
+ return {
43831
+ job: job,
43832
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
43833
+ componentName: referencedComponentName
43834
+ };
43835
+ });
43836
+ });
43837
+ 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);
43838
+ var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
43839
+ var _a;
43840
+ return (0, lodash_1.isObject)(n) ? {
43841
+ job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
43842
+ artifacts: n.artifacts
43843
+ } : getFullReferencedJobName(n, componentName, env, allJobs);
43844
+ }).sort(function (a, b) {
43845
+ return getJobName(a).localeCompare(getJobName(b));
43846
+ });
43847
+ var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
43848
+ var gitlabJob = __assign(__assign({}, job), {
43849
+ stage: stage,
43850
+ environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
43851
+ on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
43852
+ }) : job.environment,
43629
43853
  // sort in a predictable manner for snapshot tests
43630
- needs: needs ? __spreadArray([], __read(needs), false).sort(function (a, b) {
43631
- return getJobName(a).localeCompare(getJobName(b));
43632
- }) : undefined,
43854
+ needs: gitlabNeeds,
43633
43855
  retry: defaults_1.BASE_RETRY,
43634
43856
  interruptible: true
43635
43857
  });
43858
+ return [fullJobName, gitlabJob];
43636
43859
  };
43637
43860
  exports.makeGitlabJob = makeGitlabJob;
43861
+ var createGitlabJobs = function (allJobs) {
43862
+ return __awaiter(void 0, void 0, void 0, function () {
43863
+ return __generator(this, function (_a) {
43864
+ return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
43865
+ var componentJobs = allJobs[componentName];
43866
+ return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
43867
+ var jobs = componentJobs[env];
43868
+ return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
43869
+ var _a;
43870
+ var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
43871
+ fullJobName = _b[0],
43872
+ gitlabJob = _b[1];
43873
+ return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
43874
+ }, {}));
43875
+ }, {}));
43876
+ }, {})];
43877
+ });
43878
+ });
43879
+ };
43880
+ exports.createGitlabJobs = createGitlabJobs;
43638
43881
 
43639
43882
  /***/ }),
43640
43883
 
@@ -43661,7 +43904,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
43661
43904
  };
43662
43905
  exports.__esModule = true;
43663
43906
  __exportStar(__nccwpck_require__(8974), exports);
43664
- __exportStar(__nccwpck_require__(7726), exports);
43907
+ __exportStar(__nccwpck_require__(962), exports);
43665
43908
 
43666
43909
  /***/ }),
43667
43910