@catladder/cli 0.0.0-fix-command-710f75f1 → 0.0.0-hidden-secrets-da086bf2

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.
@@ -38892,6 +38892,7 @@ var createCustomBuildJobs = function (context) {
38892
38892
  var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
38893
38893
  image: buildConfig.jobImage,
38894
38894
  variables: __assign({}, RUNNER_BUILD_VARIABLES),
38895
+ cache: buildConfig.jobCache,
38895
38896
  services: buildConfig.jobServices,
38896
38897
  script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
38897
38898
  artifacts: {
@@ -39052,18 +39053,22 @@ var requiresDockerBuild = function (context) {
39052
39053
  return false;
39053
39054
  };
39054
39055
  exports.requiresDockerBuild = requiresDockerBuild;
39056
+ var getDockerBaseVariables = function () {
39057
+ return {
39058
+ DOCKER_HOST: "tcp://0.0.0.0:2375",
39059
+ DOCKER_TLS_CERTDIR: "",
39060
+ DOCKER_DRIVER: "overlay2",
39061
+ DOCKER_BUILDKIT: "1"
39062
+ };
39063
+ };
39055
39064
  var getDockerBuildVariables = function (context) {
39056
39065
  var _a, _b, _c, _d;
39057
- return __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
39058
- DOCKER_BUILDKIT: "1",
39066
+ return __assign(__assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
39059
39067
  DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
39060
39068
  DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
39061
39069
  APP_DIR: context.componentConfig.dir,
39062
- DOCKER_HOST: "tcp://0.0.0.0:2375",
39063
- DOCKER_TLS_CERTDIR: "",
39064
- DOCKER_DIR: ".",
39065
- DOCKER_DRIVER: "overlay2"
39066
- }), (0, exports.getDockerImageVariables)(context));
39070
+ DOCKER_DIR: "."
39071
+ }), getDockerBaseVariables()), (0, exports.getDockerImageVariables)(context));
39067
39072
  };
39068
39073
  exports.getDockerBuildVariables = getDockerBuildVariables;
39069
39074
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
@@ -39074,7 +39079,7 @@ var getDockerJobBaseProps = function (context) {
39074
39079
  name: "docker:20-dind",
39075
39080
  command: ["--tls=false"]
39076
39081
  }],
39077
- variables: (0, exports.getDockerBuildVariables)(context)
39082
+ variables: getDockerBaseVariables()
39078
39083
  };
39079
39084
  };
39080
39085
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
@@ -39087,7 +39092,9 @@ var createDockerBuildJobBase = function (context, _a) {
39087
39092
  stage: "build"
39088
39093
  }, (0, exports.getDockerJobBaseProps)(context)), {
39089
39094
  script: script || []
39090
- }), def);
39095
+ }), {
39096
+ variables: (0, exports.getDockerBuildVariables)(context)
39097
+ }, def);
39091
39098
  };
39092
39099
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
39093
39100
  exports.gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
@@ -39173,7 +39180,13 @@ exports.BUILD_TYPES = {
39173
39180
  rails: {
39174
39181
  jobs: rails_1.createRailsJobs,
39175
39182
  defaults: function () {
39176
- return {};
39183
+ return {
39184
+ startCommand: "/cnb/process/web",
39185
+ cnbBuilder: {
39186
+ image: "heroku/buildpacks:20",
39187
+ packVersion: "0.28.0"
39188
+ }
39189
+ };
39177
39190
  }
39178
39191
  }
39179
39192
  };
@@ -39703,31 +39716,52 @@ exports.getYarnInstall = getYarnInstall;
39703
39716
  "use strict";
39704
39717
 
39705
39718
 
39706
- var __assign = this && this.__assign || function () {
39707
- __assign = Object.assign || function (t) {
39708
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39709
- s = arguments[i];
39710
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39719
+ var __read = this && this.__read || function (o, n) {
39720
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
39721
+ if (!m) return o;
39722
+ var i = m.call(o),
39723
+ r,
39724
+ ar = [],
39725
+ e;
39726
+ try {
39727
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
39728
+ } catch (error) {
39729
+ e = {
39730
+ error: error
39731
+ };
39732
+ } finally {
39733
+ try {
39734
+ if (r && !r.done && (m = i["return"])) m.call(i);
39735
+ } finally {
39736
+ if (e) throw e.error;
39711
39737
  }
39712
- return t;
39713
- };
39714
- return __assign.apply(this, arguments);
39738
+ }
39739
+ return ar;
39715
39740
  };
39716
39741
  exports.__esModule = true;
39717
39742
  exports.createRailsBuildJobs = void 0;
39743
+ var types_1 = __nccwpck_require__(1197);
39718
39744
  var docker_1 = __nccwpck_require__(3219);
39719
39745
  var createRailsBuildJobs = function (context) {
39746
+ var _a, _b, _c;
39747
+ var buildConfig = context.componentConfig.build;
39748
+ if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
39749
+ // should not happen
39750
+ throw new Error("build type is not rails");
39751
+ }
39752
+ var cnbConf = buildConfig.cnbBuilder;
39753
+ var packEnvArgs = Object.entries((_a = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
39754
+ var _b = __read(_a, 2),
39755
+ k = _b[0],
39756
+ v = _b[1];
39757
+ return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
39758
+ }).join(" ");
39720
39759
  return [(0, docker_1.createDockerBuildJobBase)(context, {
39721
- variables: __assign({
39722
- CNB_BUILDER: "heroku/buildpacks:18",
39723
- CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
39724
- CNB_EXTRA_ARGS: "",
39725
- CNB_PACK_VERSION: "0.20.0"
39726
- }, context.componentConfig.build.extraVars),
39760
+ variables: context.componentConfig.build.extraVars,
39727
39761
  // custom script
39728
- script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v$CNB_PACK_VERSION/pack-v$CNB_PACK_VERSION-linux.tgz | tar -zx --directory /usr/local/bin pack", "chmod +x /usr/local/bin/pack",
39762
+ script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
39729
39763
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
39730
- "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "for v in $CNB_ENV_VARS; do env_args=\"$env_args --env $v\"; done", "pack build $DOCKER_IMAGE:$DOCKER_IMAGE_TAG --builder $CNB_BUILDER --publish --cache-image $DOCKER_CACHE_IMAGE $env_args $CNB_EXTRA_ARGS"]
39764
+ "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")]
39731
39765
  })];
39732
39766
  };
39733
39767
  exports.createRailsBuildJobs = createRailsBuildJobs;
@@ -39851,9 +39885,8 @@ var createRailsTestJobs = function (context) {
39851
39885
  var bundlerCache = {
39852
39886
  key: {
39853
39887
  files: ["Gemfile.lock"],
39854
- prefix: "$CI_JOB_IMAGE" // a changed image might have different OS libraries which no longer work with the cached gems
39888
+ prefix: "$CI_JOB_IMAGE"
39855
39889
  },
39856
-
39857
39890
  paths: [bundlerCacheDir]
39858
39891
  };
39859
39892
  var auditJob = buildConfig.audit !== false ? __assign(__assign({
@@ -40074,7 +40107,7 @@ exports.readConfigSync = readConfigSync;
40074
40107
 
40075
40108
  exports.__esModule = true;
40076
40109
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40077
- exports.PIPELINE_IMAGE_TAG = "fix-command-710f75f1" || 0;
40110
+ exports.PIPELINE_IMAGE_TAG = "hidden-secrets-da086bf2" || 0;
40078
40111
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40079
40112
 
40080
40113
  /***/ }),
@@ -40269,6 +40302,7 @@ var getEnvironment = function (config, componentName, env, commitInfo) {
40269
40302
  url: url
40270
40303
  },
40271
40304
  fullName: envContext.fullName,
40305
+ slugPrefix: envContext.environmentSlugPrefix,
40272
40306
  slug: envContext.environmentSlug,
40273
40307
  shortName: env,
40274
40308
  envVars: envVars,
@@ -40292,20 +40326,22 @@ exports.__esModule = true;
40292
40326
  exports.getEnvironmentContext = void 0;
40293
40327
  var getEnvConfig_1 = __nccwpck_require__(5706);
40294
40328
  var getEnvType_1 = __nccwpck_require__(4811);
40295
- var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
40329
+ var getEnvironmentSlugPrefix = function (envConfig, env, commitInfo) {
40296
40330
  var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
40297
- return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
40331
+ return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug) : "".concat(env);
40298
40332
  };
40299
40333
  var getEnvironmentContext = function (config, env, componentName, commitInfo) {
40300
40334
  var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
40301
40335
  var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
40302
- var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
40336
+ var environmentSlugPrefix = getEnvironmentSlugPrefix(envConfigRaw, env, commitInfo);
40337
+ var environmentSlug = "".concat(environmentSlugPrefix, "-").concat(componentName);
40303
40338
  var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
40304
40339
  var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
40305
40340
  return {
40306
40341
  envConfigRaw: envConfigRaw,
40307
40342
  deployConfigRaw: envConfigRaw.deploy,
40308
40343
  buildConfigRaw: envConfigRaw.build,
40344
+ environmentSlugPrefix: environmentSlugPrefix,
40309
40345
  environmentSlug: environmentSlug,
40310
40346
  gitlabEnvironmentName: gitlabEnvironmentName,
40311
40347
  fullName: fullName,
@@ -40528,8 +40564,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
40528
40564
  }
40529
40565
  publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
40530
40566
  additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
40531
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []), false), __read(additionalSecretKeys), false);
40532
- secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
40567
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
40568
+ return {
40569
+ key: key
40570
+ };
40571
+ })), false), __read(additionalSecretKeys), false);
40572
+ secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
40573
+ var key = _a.key;
40533
40574
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
40534
40575
  }));
40535
40576
  legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
@@ -41133,7 +41174,7 @@ var getBaseDeploymentJob = function (context) {
41133
41174
  return {
41134
41175
  name: exports.DEPLOY_JOB_NAME,
41135
41176
  envMode: "stagePerEnv",
41136
- needsOtherComponent: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
41177
+ needs: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
41137
41178
  return {
41138
41179
  componentName: c,
41139
41180
  job: exports.DEPLOY_JOB_NAME,
@@ -41509,15 +41550,15 @@ var jobName_1 = __nccwpck_require__(7311);
41509
41550
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41510
41551
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41511
41552
  var getCloudSqlVariables = function (_a) {
41512
- var _b, _c, _d;
41553
+ var _b, _c, _d, _e;
41513
41554
  var deployConfigRaw = _a.deployConfigRaw,
41514
- environmentSlug = _a.environmentSlug,
41555
+ environmentSlugPrefix = _a.environmentSlugPrefix,
41515
41556
  env = _a.env,
41516
41557
  componentName = _a.componentName,
41517
41558
  fullConfig = _a.fullConfig;
41518
41559
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
41519
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
41520
- var additionalQueryParamsString = Object.entries((_c = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
41560
+ var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
41561
+ var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
41521
41562
  var _b = __read(_a, 2),
41522
41563
  key = _b[0],
41523
41564
  value = _b[1];
@@ -41526,7 +41567,7 @@ var getCloudSqlVariables = function (_a) {
41526
41567
  return {
41527
41568
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
41528
41569
  DB_NAME: DB_NAME,
41529
- DB_USER: (_d = deployConfigRaw.cloudSql.dbUser) !== null && _d !== void 0 ? _d : "postgres",
41570
+ DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
41530
41571
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
41531
41572
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
41532
41573
  DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
@@ -41549,7 +41590,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
41549
41590
  return {};
41550
41591
  },
41551
41592
  additionalSecretKeys: function (ctx) {
41552
- return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
41593
+ return __spreadArray([{
41594
+ key: exports.GCLOUD_DEPLOY_CREDENTIALS_KEY,
41595
+ hidden: true
41596
+ }, {
41597
+ key: exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
41598
+ hidden: true
41599
+ }], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? [{
41600
+ key: "DB_PASSWORD"
41601
+ }] : []), false);
41553
41602
  },
41554
41603
  getAdditionalEnvVars: function (ctx) {
41555
41604
  var _a;
@@ -41947,7 +41996,11 @@ var additionalKubernetesSecretKeys = function (_a) {
41947
41996
  keys.push("POSTGRESQL_PASSWORD");
41948
41997
  keys.push("cloudsqlProxyCredentials");
41949
41998
  }
41950
- return keys;
41999
+ return keys.map(function (key) {
42000
+ return {
42001
+ key: key
42002
+ };
42003
+ });
41951
42004
  };
41952
42005
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41953
42006
 
@@ -42047,7 +42100,7 @@ var base_1 = __nccwpck_require__(9177);
42047
42100
  var types_1 = __nccwpck_require__(3109);
42048
42101
  var kubeValues_1 = __nccwpck_require__(1061);
42049
42102
  var createKubernetesDeployJobs = function (context) {
42050
- var _a, _b;
42103
+ var _a, _b, _c;
42051
42104
  var deployConfig = context.componentConfig.deploy;
42052
42105
  if (deployConfig === false) {
42053
42106
  return [];
@@ -42071,10 +42124,10 @@ var createKubernetesDeployJobs = function (context) {
42071
42124
  quotingType: "'",
42072
42125
  forceQuotes: true
42073
42126
  }),
42074
- HELM_GITLAB_CHART_NAME: "the-panter-chart",
42075
- HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_a = deployConfig.additionalHelmArgs) !== null && _a !== void 0 ? _a : []), false).join(" "),
42127
+ HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
42128
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
42076
42129
  COMPONENT_NAME: context.componentName,
42077
- BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
42130
+ BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
42078
42131
  })
42079
42132
  };
42080
42133
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -42305,33 +42358,36 @@ var kubeEnv_1 = __nccwpck_require__(9449);
42305
42358
  var mongodb_1 = __nccwpck_require__(7601);
42306
42359
  var processSecretsAsFiles_1 = __nccwpck_require__(5187);
42307
42360
  var createAppConfig = function (context, application) {
42308
- var _a, _b, _c;
42309
42361
  if (application === false) {
42310
42362
  return {
42311
42363
  enabled: false
42312
42364
  };
42313
42365
  }
42366
+ var _a = application !== null && application !== void 0 ? application : {},
42367
+ healthRoute = _a.healthRoute,
42368
+ command = _a.command,
42369
+ rest = __rest(_a, ["healthRoute", "command"]);
42314
42370
  return (0, utils_1.mergeWithMergingArrays)({
42315
42371
  host: context.environment.host,
42316
- command: context.componentConfig.build.startCommand,
42372
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
42317
42373
  livenessProbe: {
42318
42374
  httpGet: {
42319
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
42375
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42320
42376
  }
42321
42377
  },
42322
42378
  readinessProbe: {
42323
42379
  httpGet: {
42324
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
42380
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42325
42381
  }
42326
42382
  },
42327
42383
  startupProbe: {
42328
42384
  httpGet: {
42329
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
42385
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42330
42386
  }
42331
42387
  }
42332
42388
  },
42333
42389
  // default
42334
- application // merge rest in
42390
+ rest // merge rest in
42335
42391
  );
42336
42392
  };
42337
42393
 
@@ -42967,22 +43023,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
42967
43023
 
42968
43024
  /***/ }),
42969
43025
 
42970
- /***/ 8974:
43026
+ /***/ 7052:
42971
43027
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42972
43028
 
42973
43029
  "use strict";
42974
43030
 
42975
43031
 
42976
- var __assign = this && this.__assign || function () {
42977
- __assign = Object.assign || function (t) {
42978
- for (var s, i = 1, n = arguments.length; i < n; i++) {
42979
- s = arguments[i];
42980
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43032
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43033
+ function adopt(value) {
43034
+ return value instanceof P ? value : new P(function (resolve) {
43035
+ resolve(value);
43036
+ });
43037
+ }
43038
+ return new (P || (P = Promise))(function (resolve, reject) {
43039
+ function fulfilled(value) {
43040
+ try {
43041
+ step(generator.next(value));
43042
+ } catch (e) {
43043
+ reject(e);
43044
+ }
42981
43045
  }
42982
- return t;
42983
- };
42984
- return __assign.apply(this, arguments);
43046
+ function rejected(value) {
43047
+ try {
43048
+ step(generator["throw"](value));
43049
+ } catch (e) {
43050
+ reject(e);
43051
+ }
43052
+ }
43053
+ function step(result) {
43054
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43055
+ }
43056
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43057
+ });
43058
+ };
43059
+ var __generator = this && this.__generator || function (thisArg, body) {
43060
+ var _ = {
43061
+ label: 0,
43062
+ sent: function () {
43063
+ if (t[0] & 1) throw t[1];
43064
+ return t[1];
43065
+ },
43066
+ trys: [],
43067
+ ops: []
43068
+ },
43069
+ f,
43070
+ y,
43071
+ t,
43072
+ g;
43073
+ return g = {
43074
+ next: verb(0),
43075
+ "throw": verb(1),
43076
+ "return": verb(2)
43077
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
43078
+ return this;
43079
+ }), g;
43080
+ function verb(n) {
43081
+ return function (v) {
43082
+ return step([n, v]);
43083
+ };
43084
+ }
43085
+ function step(op) {
43086
+ if (f) throw new TypeError("Generator is already executing.");
43087
+ while (_) try {
43088
+ 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;
43089
+ if (y = 0, t) op = [op[0] & 2, t.value];
43090
+ switch (op[0]) {
43091
+ case 0:
43092
+ case 1:
43093
+ t = op;
43094
+ break;
43095
+ case 4:
43096
+ _.label++;
43097
+ return {
43098
+ value: op[1],
43099
+ done: false
43100
+ };
43101
+ case 5:
43102
+ _.label++;
43103
+ y = op[1];
43104
+ op = [0];
43105
+ continue;
43106
+ case 7:
43107
+ op = _.ops.pop();
43108
+ _.trys.pop();
43109
+ continue;
43110
+ default:
43111
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
43112
+ _ = 0;
43113
+ continue;
43114
+ }
43115
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
43116
+ _.label = op[1];
43117
+ break;
43118
+ }
43119
+ if (op[0] === 6 && _.label < t[1]) {
43120
+ _.label = t[1];
43121
+ t = op;
43122
+ break;
43123
+ }
43124
+ if (t && _.label < t[2]) {
43125
+ _.label = t[2];
43126
+ _.ops.push(op);
43127
+ break;
43128
+ }
43129
+ if (t[2]) _.ops.pop();
43130
+ _.trys.pop();
43131
+ continue;
43132
+ }
43133
+ op = body.call(thisArg, _);
43134
+ } catch (e) {
43135
+ op = [6, e];
43136
+ y = 0;
43137
+ } finally {
43138
+ f = t = 0;
43139
+ }
43140
+ if (op[0] & 5) throw op[1];
43141
+ return {
43142
+ value: op[0] ? op[1] : void 0,
43143
+ done: true
43144
+ };
43145
+ }
42985
43146
  };
43147
+ exports.__esModule = true;
43148
+ exports.createAllJobs = void 0;
43149
+ var config_1 = __nccwpck_require__(3138);
43150
+ var createJobsForComponent_1 = __nccwpck_require__(962);
43151
+ var createAllJobs = function (config, trigger) {
43152
+ return __awaiter(void 0, void 0, void 0, function () {
43153
+ var _a, _b;
43154
+ return __generator(this, function (_c) {
43155
+ switch (_c.label) {
43156
+ case 0:
43157
+ _b = (_a = Object).fromEntries;
43158
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
43159
+ return __awaiter(void 0, void 0, void 0, function () {
43160
+ var envs, _a, _b, _c;
43161
+ return __generator(this, function (_d) {
43162
+ switch (_d.label) {
43163
+ case 0:
43164
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
43165
+ _a = [componentName];
43166
+ _c = (_b = Object).fromEntries;
43167
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
43168
+ return __awaiter(void 0, void 0, void 0, function () {
43169
+ var _a;
43170
+ return __generator(this, function (_b) {
43171
+ switch (_b.label) {
43172
+ case 0:
43173
+ _a = [env];
43174
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
43175
+ case 1:
43176
+ return [2 /*return*/, _a.concat([_b.sent()])];
43177
+ }
43178
+ });
43179
+ });
43180
+ }))];
43181
+ case 1:
43182
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
43183
+ }
43184
+ });
43185
+ });
43186
+ }))];
43187
+ case 1:
43188
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
43189
+ }
43190
+ });
43191
+ });
43192
+ };
43193
+ exports.createAllJobs = createAllJobs;
43194
+
43195
+ /***/ }),
43196
+
43197
+ /***/ 8974:
43198
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43199
+
43200
+ "use strict";
43201
+
43202
+
42986
43203
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
42987
43204
  function adopt(value) {
42988
43205
  return value instanceof P ? value : new P(function (resolve) {
@@ -43135,54 +43352,40 @@ var config_1 = __nccwpck_require__(3138);
43135
43352
  var rules_1 = __nccwpck_require__(2020);
43136
43353
  var runner_1 = __nccwpck_require__(5071);
43137
43354
  var jobs_1 = __nccwpck_require__(2339);
43138
- var createJobs_1 = __nccwpck_require__(7726);
43355
+ var createAllJobs_1 = __nccwpck_require__(7052);
43356
+ var createGitlabJobs_1 = __nccwpck_require__(3920);
43139
43357
  var createChildPipeline = function (type, trigger, config) {
43140
43358
  return __awaiter(void 0, void 0, void 0, function () {
43141
- var components, jobs, allEnvs, stages, pipeline;
43142
- return __generator(this, function (_a) {
43143
- switch (_a.label) {
43359
+ var jobs, allEnvs, stages, pipeline;
43360
+ var _a;
43361
+ return __generator(this, function (_b) {
43362
+ switch (_b.label) {
43144
43363
  case 0:
43145
- components = Object.keys(config.components);
43146
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
43147
- return __awaiter(void 0, void 0, void 0, function () {
43148
- var envs, _a, _b;
43149
- return __generator(this, function (_c) {
43150
- switch (_c.label) {
43151
- case 0:
43152
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
43153
- _a = [{}];
43154
- return [4 /*yield*/, acc];
43155
- case 1:
43156
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
43157
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
43158
- case 2:
43159
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
43160
- }
43161
- });
43162
- });
43163
- }, Promise.resolve({}))];
43364
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
43164
43365
  case 1:
43165
- jobs = _a.sent();
43366
+ jobs = _b.sent();
43166
43367
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
43167
43368
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
43168
43369
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
43169
43370
  return "".concat(baseStage, " ").concat(e);
43170
43371
  })), false);
43171
43372
  }, []);
43172
- if (type === "gitlab") {
43173
- pipeline = {
43174
- image: (0, runner_1.getRunnerImage)("jobs-default"),
43175
- variables: {
43176
- FF_USE_FASTZIP: "true"
43177
- },
43178
- workflow: {
43179
- rules: rules_1.RULES_ALWAYS
43180
- },
43181
- stages: stages,
43182
- jobs: jobs
43183
- };
43184
- return [2 /*return*/, pipeline];
43185
- }
43373
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
43374
+ _a = {
43375
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
43376
+ variables: {
43377
+ FF_USE_FASTZIP: "true"
43378
+ },
43379
+ workflow: {
43380
+ rules: rules_1.RULES_ALWAYS
43381
+ },
43382
+ stages: stages
43383
+ };
43384
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
43385
+ case 2:
43386
+ pipeline = (_a.jobs = _b.sent(), _a);
43387
+ return [2 /*return*/, pipeline];
43388
+ case 3:
43186
43389
  throw new Error("".concat(type, " is not supported"));
43187
43390
  }
43188
43391
  });
@@ -43192,7 +43395,7 @@ exports.createChildPipeline = createChildPipeline;
43192
43395
 
43193
43396
  /***/ }),
43194
43397
 
43195
- /***/ 7726:
43398
+ /***/ 962:
43196
43399
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43197
43400
 
43198
43401
  "use strict";
@@ -43363,14 +43566,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43363
43566
  return to.concat(ar || Array.prototype.slice.call(from));
43364
43567
  };
43365
43568
  exports.__esModule = true;
43366
- exports.createJobs = void 0;
43569
+ exports.createJobsForComponent = void 0;
43367
43570
  var lodash_1 = __nccwpck_require__(3255);
43368
43571
  var build_1 = __nccwpck_require__(3760);
43369
43572
  var context_1 = __nccwpck_require__(2041);
43370
43573
  var deploy_1 = __nccwpck_require__(223);
43371
- var utils_1 = __nccwpck_require__(7461);
43372
43574
  var getCommitInfo_1 = __nccwpck_require__(5923);
43373
- var makeGitlabJob_1 = __nccwpck_require__(5715);
43374
43575
  var packageManager_1 = __nccwpck_require__(9168);
43375
43576
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
43376
43577
  return jobs.map(function (_a) {
@@ -43398,76 +43599,9 @@ var createRawJobs = function (context) {
43398
43599
  var customJobs = getCustomJobs(context);
43399
43600
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
43400
43601
  };
43401
- var getFullJobName = function (name, componentName, env) {
43402
- if (env) {
43403
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
43404
- }
43405
- return "".concat(componentName, " ").concat(name);
43406
- };
43407
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
43408
- var referencedJob = allRawJobs.find(function (j) {
43409
- return j.name === referencedJobName;
43410
- });
43411
- if (!referencedJob) {
43412
- throw new Error("unknown job referenced: " + referencedJobName);
43413
- }
43414
- var envToSet = referencedJob.envMode !== "none" ? env : null;
43415
- return getFullJobName(referencedJobName, componentName, envToSet);
43416
- };
43417
- // replaces references to other jobs with the full name
43418
- // the full name contains the componentname and the env name (if any)
43419
- var replaceReferences = function (job, componentName, env, allRawJobs) {
43420
- var _a, _b, _c;
43421
- var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
43422
- var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
43423
- return (0, lodash_1.isObject)(n) ? {
43424
- job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
43425
- artifacts: n.artifacts
43426
- } : getFullReferencedJobName(n, componentName, env, allRawJobs);
43427
- });
43428
- var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
43429
- return {
43430
- artifacts: other.artifacts,
43431
- job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
43432
- };
43433
- });
43434
- var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
43435
- return __assign(__assign({}, job), {
43436
- stage: stage,
43437
- needs: needs,
43438
- environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
43439
- on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
43440
- }) : job.environment
43441
- });
43442
- };
43443
- // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
43444
- var addStageNeeds = function (jobs) {
43445
- // when a job defines needsStages, we add these as needs
43446
- return jobs.map(function (job) {
43447
- var _a;
43448
- if (!job.needsStages || job.needsStages.length === 0) {
43449
- return job;
43450
- }
43451
- var neededJobs = jobs.map(function (j) {
43452
- var _a, _b;
43453
- var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
43454
- return j.stage === s.stage;
43455
- });
43456
- if (neededStage) {
43457
- return {
43458
- job: j.name,
43459
- artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
43460
- };
43461
- }
43462
- }).filter(utils_1.notNil);
43463
- return __assign(__assign({}, job), {
43464
- needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
43465
- });
43466
- });
43467
- };
43468
- var createJobs = function (type, envs, config, componentName, trigger) {
43602
+ var createJobsForComponent = function (config, componentName, env, trigger) {
43469
43603
  return __awaiter(void 0, void 0, void 0, function () {
43470
- var commitInfo, _a, packageManagerInfo;
43604
+ var commitInfo, _a, packageManagerInfo, context;
43471
43605
  return __generator(this, function (_b) {
43472
43606
  switch (_b.label) {
43473
43607
  case 0:
@@ -43480,47 +43614,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
43480
43614
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
43481
43615
  case 2:
43482
43616
  packageManagerInfo = _b.sent();
43483
- return [2 /*return*/, envs.reduce(function (acc, env) {
43484
- return __awaiter(void 0, void 0, void 0, function () {
43485
- var context, jobs, result, _a, _b, _c, _d, _e;
43486
- return __generator(this, function (_f) {
43487
- switch (_f.label) {
43488
- case 0:
43489
- return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
43490
- case 1:
43491
- context = _f.sent();
43492
- jobs = addStageNeeds(createRawJobs(context));
43493
- _a = [{}];
43494
- return [4 /*yield*/, acc];
43495
- case 2:
43496
- _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
43497
- _d = (_c = jobs).reduce;
43498
- _e = [function (acc, job) {
43499
- var _a;
43500
- var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
43501
- var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
43502
- if (type === "gitlab") {
43503
- return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
43504
- }
43505
- throw new Error("not supported");
43506
- }];
43507
- return [4 /*yield*/, Promise.resolve({})];
43508
- case 3:
43509
- result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
43510
- return [2 /*return*/, result];
43511
- }
43512
- });
43513
- });
43514
- }, {})];
43617
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
43618
+ case 3:
43619
+ context = _b.sent();
43620
+ return [2 /*return*/, createRawJobs(context)];
43515
43621
  }
43516
43622
  });
43517
43623
  });
43518
43624
  };
43519
- exports.createJobs = createJobs;
43625
+ exports.createJobsForComponent = createJobsForComponent;
43520
43626
 
43521
43627
  /***/ }),
43522
43628
 
43523
- /***/ 5715:
43629
+ /***/ 3920:
43524
43630
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43525
43631
 
43526
43632
  "use strict";
@@ -43536,6 +43642,121 @@ var __assign = this && this.__assign || function () {
43536
43642
  };
43537
43643
  return __assign.apply(this, arguments);
43538
43644
  };
43645
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43646
+ function adopt(value) {
43647
+ return value instanceof P ? value : new P(function (resolve) {
43648
+ resolve(value);
43649
+ });
43650
+ }
43651
+ return new (P || (P = Promise))(function (resolve, reject) {
43652
+ function fulfilled(value) {
43653
+ try {
43654
+ step(generator.next(value));
43655
+ } catch (e) {
43656
+ reject(e);
43657
+ }
43658
+ }
43659
+ function rejected(value) {
43660
+ try {
43661
+ step(generator["throw"](value));
43662
+ } catch (e) {
43663
+ reject(e);
43664
+ }
43665
+ }
43666
+ function step(result) {
43667
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43668
+ }
43669
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43670
+ });
43671
+ };
43672
+ var __generator = this && this.__generator || function (thisArg, body) {
43673
+ var _ = {
43674
+ label: 0,
43675
+ sent: function () {
43676
+ if (t[0] & 1) throw t[1];
43677
+ return t[1];
43678
+ },
43679
+ trys: [],
43680
+ ops: []
43681
+ },
43682
+ f,
43683
+ y,
43684
+ t,
43685
+ g;
43686
+ return g = {
43687
+ next: verb(0),
43688
+ "throw": verb(1),
43689
+ "return": verb(2)
43690
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
43691
+ return this;
43692
+ }), g;
43693
+ function verb(n) {
43694
+ return function (v) {
43695
+ return step([n, v]);
43696
+ };
43697
+ }
43698
+ function step(op) {
43699
+ if (f) throw new TypeError("Generator is already executing.");
43700
+ while (_) try {
43701
+ 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;
43702
+ if (y = 0, t) op = [op[0] & 2, t.value];
43703
+ switch (op[0]) {
43704
+ case 0:
43705
+ case 1:
43706
+ t = op;
43707
+ break;
43708
+ case 4:
43709
+ _.label++;
43710
+ return {
43711
+ value: op[1],
43712
+ done: false
43713
+ };
43714
+ case 5:
43715
+ _.label++;
43716
+ y = op[1];
43717
+ op = [0];
43718
+ continue;
43719
+ case 7:
43720
+ op = _.ops.pop();
43721
+ _.trys.pop();
43722
+ continue;
43723
+ default:
43724
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
43725
+ _ = 0;
43726
+ continue;
43727
+ }
43728
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
43729
+ _.label = op[1];
43730
+ break;
43731
+ }
43732
+ if (op[0] === 6 && _.label < t[1]) {
43733
+ _.label = t[1];
43734
+ t = op;
43735
+ break;
43736
+ }
43737
+ if (t && _.label < t[2]) {
43738
+ _.label = t[2];
43739
+ _.ops.push(op);
43740
+ break;
43741
+ }
43742
+ if (t[2]) _.ops.pop();
43743
+ _.trys.pop();
43744
+ continue;
43745
+ }
43746
+ op = body.call(thisArg, _);
43747
+ } catch (e) {
43748
+ op = [6, e];
43749
+ y = 0;
43750
+ } finally {
43751
+ f = t = 0;
43752
+ }
43753
+ if (op[0] & 5) throw op[1];
43754
+ return {
43755
+ value: op[0] ? op[1] : void 0,
43756
+ done: true
43757
+ };
43758
+ }
43759
+ };
43539
43760
  var __rest = this && this.__rest || function (s, e) {
43540
43761
  var t = {};
43541
43762
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -43544,30 +43765,131 @@ var __rest = this && this.__rest || function (s, e) {
43544
43765
  }
43545
43766
  return t;
43546
43767
  };
43768
+ var __read = this && this.__read || function (o, n) {
43769
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
43770
+ if (!m) return o;
43771
+ var i = m.call(o),
43772
+ r,
43773
+ ar = [],
43774
+ e;
43775
+ try {
43776
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
43777
+ } catch (error) {
43778
+ e = {
43779
+ error: error
43780
+ };
43781
+ } finally {
43782
+ try {
43783
+ if (r && !r.done && (m = i["return"])) m.call(i);
43784
+ } finally {
43785
+ if (e) throw e.error;
43786
+ }
43787
+ }
43788
+ return ar;
43789
+ };
43790
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43791
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
43792
+ if (ar || !(i in from)) {
43793
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
43794
+ ar[i] = from[i];
43795
+ }
43796
+ }
43797
+ return to.concat(ar || Array.prototype.slice.call(from));
43798
+ };
43547
43799
  exports.__esModule = true;
43548
- exports.makeGitlabJob = void 0;
43800
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
43549
43801
  var lodash_1 = __nccwpck_require__(3255);
43550
43802
  var defaults_1 = __nccwpck_require__(7383);
43803
+ var getFullJobName = function (name, componentName, env) {
43804
+ if (env) {
43805
+ return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
43806
+ }
43807
+ return "".concat(componentName, " ").concat(name);
43808
+ };
43809
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
43810
+ var _a, _b;
43811
+ var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
43812
+ return j.name === referencedJobName;
43813
+ });
43814
+ if (!referencedJob) {
43815
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
43816
+ }
43817
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
43818
+ return getFullJobName(referencedJobName, componentName, envToSet);
43819
+ };
43551
43820
  var getJobName = function (need) {
43552
43821
  return (0, lodash_1.isObject)(need) ? need.job : need;
43553
43822
  };
43554
- var makeGitlabJob = function (_a) {
43823
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
43824
+ var _b;
43555
43825
  var envMode = _a.envMode,
43556
43826
  needsStages = _a.needsStages,
43557
43827
  needsOtherComponent = _a.needsOtherComponent,
43558
43828
  name = _a.name,
43559
43829
  needs = _a.needs,
43560
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43561
- return __assign(__assign({}, rest), {
43830
+ job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43831
+ var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
43832
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
43833
+ var _a, _b, _c, _d;
43834
+ var referencedComponentName = componentName;
43835
+ 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) {
43836
+ return j.stage === n.stage;
43837
+ })) === null || _c === void 0 ? void 0 : _c.map(function (j) {
43838
+ return j.name;
43839
+ })) !== null && _d !== void 0 ? _d : [];
43840
+ return allJobNamesFromThatStage.map(function (job) {
43841
+ var _a;
43842
+ return {
43843
+ job: job,
43844
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
43845
+ componentName: referencedComponentName
43846
+ };
43847
+ });
43848
+ });
43849
+ 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);
43850
+ var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
43851
+ var _a;
43852
+ return (0, lodash_1.isObject)(n) ? {
43853
+ job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
43854
+ artifacts: n.artifacts
43855
+ } : getFullReferencedJobName(n, componentName, env, allJobs);
43856
+ }).sort(function (a, b) {
43857
+ return getJobName(a).localeCompare(getJobName(b));
43858
+ });
43859
+ var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
43860
+ var gitlabJob = __assign(__assign({}, job), {
43861
+ stage: stage,
43862
+ environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
43863
+ on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
43864
+ }) : job.environment,
43562
43865
  // sort in a predictable manner for snapshot tests
43563
- needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
43564
- return getJobName(a).localeCompare(getJobName(b));
43565
- }),
43866
+ needs: gitlabNeeds,
43566
43867
  retry: defaults_1.BASE_RETRY,
43567
43868
  interruptible: true
43568
43869
  });
43870
+ return [fullJobName, gitlabJob];
43569
43871
  };
43570
43872
  exports.makeGitlabJob = makeGitlabJob;
43873
+ var createGitlabJobs = function (allJobs) {
43874
+ return __awaiter(void 0, void 0, void 0, function () {
43875
+ return __generator(this, function (_a) {
43876
+ return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
43877
+ var componentJobs = allJobs[componentName];
43878
+ return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
43879
+ var jobs = componentJobs[env];
43880
+ return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
43881
+ var _a;
43882
+ var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
43883
+ fullJobName = _b[0],
43884
+ gitlabJob = _b[1];
43885
+ return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
43886
+ }, {}));
43887
+ }, {}));
43888
+ }, {})];
43889
+ });
43890
+ });
43891
+ };
43892
+ exports.createGitlabJobs = createGitlabJobs;
43571
43893
 
43572
43894
  /***/ }),
43573
43895
 
@@ -43594,7 +43916,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
43594
43916
  };
43595
43917
  exports.__esModule = true;
43596
43918
  __exportStar(__nccwpck_require__(8974), exports);
43597
- __exportStar(__nccwpck_require__(7726), exports);
43919
+ __exportStar(__nccwpck_require__(962), exports);
43598
43920
 
43599
43921
  /***/ }),
43600
43922