@catladder/cli 0.0.0-fix-cloud-run-instance-number-619b31f2 → 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-cloud-run-instance-number-619b31f2" || 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,
@@ -41338,7 +41379,8 @@ var createGoogleCloudRunDeployJobs = function (context) {
41338
41379
  var customConfig = service !== true ? service : undefined;
41339
41380
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
41340
41381
  var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
41341
- command: command ? '"' + command.split(" ").join(",") + '"' : undefined
41382
+ // command as empty string resets it to default (uses the image's entrypoint)
41383
+ command: command ? '"' + command.split(" ").join(",") + '"' : '""'
41342
41384
  }, commonDeployArgs), {
41343
41385
  "env-vars-file": "____envvars.yaml",
41344
41386
  "min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
@@ -41508,15 +41550,15 @@ var jobName_1 = __nccwpck_require__(7311);
41508
41550
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41509
41551
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41510
41552
  var getCloudSqlVariables = function (_a) {
41511
- var _b, _c, _d;
41553
+ var _b, _c, _d, _e;
41512
41554
  var deployConfigRaw = _a.deployConfigRaw,
41513
- environmentSlug = _a.environmentSlug,
41555
+ environmentSlugPrefix = _a.environmentSlugPrefix,
41514
41556
  env = _a.env,
41515
41557
  componentName = _a.componentName,
41516
41558
  fullConfig = _a.fullConfig;
41517
41559
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
41518
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
41519
- 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) {
41520
41562
  var _b = __read(_a, 2),
41521
41563
  key = _b[0],
41522
41564
  value = _b[1];
@@ -41525,7 +41567,7 @@ var getCloudSqlVariables = function (_a) {
41525
41567
  return {
41526
41568
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
41527
41569
  DB_NAME: DB_NAME,
41528
- 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",
41529
41571
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
41530
41572
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
41531
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)
@@ -41548,7 +41590,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
41548
41590
  return {};
41549
41591
  },
41550
41592
  additionalSecretKeys: function (ctx) {
41551
- 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);
41552
41602
  },
41553
41603
  getAdditionalEnvVars: function (ctx) {
41554
41604
  var _a;
@@ -41946,7 +41996,11 @@ var additionalKubernetesSecretKeys = function (_a) {
41946
41996
  keys.push("POSTGRESQL_PASSWORD");
41947
41997
  keys.push("cloudsqlProxyCredentials");
41948
41998
  }
41949
- return keys;
41999
+ return keys.map(function (key) {
42000
+ return {
42001
+ key: key
42002
+ };
42003
+ });
41950
42004
  };
41951
42005
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41952
42006
 
@@ -42046,7 +42100,7 @@ var base_1 = __nccwpck_require__(9177);
42046
42100
  var types_1 = __nccwpck_require__(3109);
42047
42101
  var kubeValues_1 = __nccwpck_require__(1061);
42048
42102
  var createKubernetesDeployJobs = function (context) {
42049
- var _a, _b;
42103
+ var _a, _b, _c;
42050
42104
  var deployConfig = context.componentConfig.deploy;
42051
42105
  if (deployConfig === false) {
42052
42106
  return [];
@@ -42070,10 +42124,10 @@ var createKubernetesDeployJobs = function (context) {
42070
42124
  quotingType: "'",
42071
42125
  forceQuotes: true
42072
42126
  }),
42073
- HELM_GITLAB_CHART_NAME: "the-panter-chart",
42074
- 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(" "),
42075
42129
  COMPONENT_NAME: context.componentName,
42076
- 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
42077
42131
  })
42078
42132
  };
42079
42133
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -42304,33 +42358,36 @@ var kubeEnv_1 = __nccwpck_require__(9449);
42304
42358
  var mongodb_1 = __nccwpck_require__(7601);
42305
42359
  var processSecretsAsFiles_1 = __nccwpck_require__(5187);
42306
42360
  var createAppConfig = function (context, application) {
42307
- var _a, _b, _c;
42308
42361
  if (application === false) {
42309
42362
  return {
42310
42363
  enabled: false
42311
42364
  };
42312
42365
  }
42366
+ var _a = application !== null && application !== void 0 ? application : {},
42367
+ healthRoute = _a.healthRoute,
42368
+ command = _a.command,
42369
+ rest = __rest(_a, ["healthRoute", "command"]);
42313
42370
  return (0, utils_1.mergeWithMergingArrays)({
42314
42371
  host: context.environment.host,
42315
- command: context.componentConfig.build.startCommand,
42372
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
42316
42373
  livenessProbe: {
42317
42374
  httpGet: {
42318
- 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"
42319
42376
  }
42320
42377
  },
42321
42378
  readinessProbe: {
42322
42379
  httpGet: {
42323
- 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"
42324
42381
  }
42325
42382
  },
42326
42383
  startupProbe: {
42327
42384
  httpGet: {
42328
- 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"
42329
42386
  }
42330
42387
  }
42331
42388
  },
42332
42389
  // default
42333
- application // merge rest in
42390
+ rest // merge rest in
42334
42391
  );
42335
42392
  };
42336
42393
 
@@ -42966,22 +43023,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
42966
43023
 
42967
43024
  /***/ }),
42968
43025
 
42969
- /***/ 8974:
43026
+ /***/ 7052:
42970
43027
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42971
43028
 
42972
43029
  "use strict";
42973
43030
 
42974
43031
 
42975
- var __assign = this && this.__assign || function () {
42976
- __assign = Object.assign || function (t) {
42977
- for (var s, i = 1, n = arguments.length; i < n; i++) {
42978
- s = arguments[i];
42979
- 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
+ }
42980
43045
  }
42981
- return t;
42982
- };
42983
- 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
+ }
42984
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
+
42985
43203
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
42986
43204
  function adopt(value) {
42987
43205
  return value instanceof P ? value : new P(function (resolve) {
@@ -43134,54 +43352,40 @@ var config_1 = __nccwpck_require__(3138);
43134
43352
  var rules_1 = __nccwpck_require__(2020);
43135
43353
  var runner_1 = __nccwpck_require__(5071);
43136
43354
  var jobs_1 = __nccwpck_require__(2339);
43137
- var createJobs_1 = __nccwpck_require__(7726);
43355
+ var createAllJobs_1 = __nccwpck_require__(7052);
43356
+ var createGitlabJobs_1 = __nccwpck_require__(3920);
43138
43357
  var createChildPipeline = function (type, trigger, config) {
43139
43358
  return __awaiter(void 0, void 0, void 0, function () {
43140
- var components, jobs, allEnvs, stages, pipeline;
43141
- return __generator(this, function (_a) {
43142
- switch (_a.label) {
43359
+ var jobs, allEnvs, stages, pipeline;
43360
+ var _a;
43361
+ return __generator(this, function (_b) {
43362
+ switch (_b.label) {
43143
43363
  case 0:
43144
- components = Object.keys(config.components);
43145
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
43146
- return __awaiter(void 0, void 0, void 0, function () {
43147
- var envs, _a, _b;
43148
- return __generator(this, function (_c) {
43149
- switch (_c.label) {
43150
- case 0:
43151
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
43152
- _a = [{}];
43153
- return [4 /*yield*/, acc];
43154
- case 1:
43155
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
43156
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
43157
- case 2:
43158
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
43159
- }
43160
- });
43161
- });
43162
- }, Promise.resolve({}))];
43364
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
43163
43365
  case 1:
43164
- jobs = _a.sent();
43366
+ jobs = _b.sent();
43165
43367
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
43166
43368
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
43167
43369
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
43168
43370
  return "".concat(baseStage, " ").concat(e);
43169
43371
  })), false);
43170
43372
  }, []);
43171
- if (type === "gitlab") {
43172
- pipeline = {
43173
- image: (0, runner_1.getRunnerImage)("jobs-default"),
43174
- variables: {
43175
- FF_USE_FASTZIP: "true"
43176
- },
43177
- workflow: {
43178
- rules: rules_1.RULES_ALWAYS
43179
- },
43180
- stages: stages,
43181
- jobs: jobs
43182
- };
43183
- return [2 /*return*/, pipeline];
43184
- }
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:
43185
43389
  throw new Error("".concat(type, " is not supported"));
43186
43390
  }
43187
43391
  });
@@ -43191,7 +43395,7 @@ exports.createChildPipeline = createChildPipeline;
43191
43395
 
43192
43396
  /***/ }),
43193
43397
 
43194
- /***/ 7726:
43398
+ /***/ 962:
43195
43399
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43196
43400
 
43197
43401
  "use strict";
@@ -43362,14 +43566,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43362
43566
  return to.concat(ar || Array.prototype.slice.call(from));
43363
43567
  };
43364
43568
  exports.__esModule = true;
43365
- exports.createJobs = void 0;
43569
+ exports.createJobsForComponent = void 0;
43366
43570
  var lodash_1 = __nccwpck_require__(3255);
43367
43571
  var build_1 = __nccwpck_require__(3760);
43368
43572
  var context_1 = __nccwpck_require__(2041);
43369
43573
  var deploy_1 = __nccwpck_require__(223);
43370
- var utils_1 = __nccwpck_require__(7461);
43371
43574
  var getCommitInfo_1 = __nccwpck_require__(5923);
43372
- var makeGitlabJob_1 = __nccwpck_require__(5715);
43373
43575
  var packageManager_1 = __nccwpck_require__(9168);
43374
43576
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
43375
43577
  return jobs.map(function (_a) {
@@ -43397,76 +43599,9 @@ var createRawJobs = function (context) {
43397
43599
  var customJobs = getCustomJobs(context);
43398
43600
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
43399
43601
  };
43400
- var getFullJobName = function (name, componentName, env) {
43401
- if (env) {
43402
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
43403
- }
43404
- return "".concat(componentName, " ").concat(name);
43405
- };
43406
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
43407
- var referencedJob = allRawJobs.find(function (j) {
43408
- return j.name === referencedJobName;
43409
- });
43410
- if (!referencedJob) {
43411
- throw new Error("unknown job referenced: " + referencedJobName);
43412
- }
43413
- var envToSet = referencedJob.envMode !== "none" ? env : null;
43414
- return getFullJobName(referencedJobName, componentName, envToSet);
43415
- };
43416
- // replaces references to other jobs with the full name
43417
- // the full name contains the componentname and the env name (if any)
43418
- var replaceReferences = function (job, componentName, env, allRawJobs) {
43419
- var _a, _b, _c;
43420
- var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
43421
- var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
43422
- return (0, lodash_1.isObject)(n) ? {
43423
- job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
43424
- artifacts: n.artifacts
43425
- } : getFullReferencedJobName(n, componentName, env, allRawJobs);
43426
- });
43427
- var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
43428
- return {
43429
- artifacts: other.artifacts,
43430
- job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
43431
- };
43432
- });
43433
- var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
43434
- return __assign(__assign({}, job), {
43435
- stage: stage,
43436
- needs: needs,
43437
- environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
43438
- on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
43439
- }) : job.environment
43440
- });
43441
- };
43442
- // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
43443
- var addStageNeeds = function (jobs) {
43444
- // when a job defines needsStages, we add these as needs
43445
- return jobs.map(function (job) {
43446
- var _a;
43447
- if (!job.needsStages || job.needsStages.length === 0) {
43448
- return job;
43449
- }
43450
- var neededJobs = jobs.map(function (j) {
43451
- var _a, _b;
43452
- var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
43453
- return j.stage === s.stage;
43454
- });
43455
- if (neededStage) {
43456
- return {
43457
- job: j.name,
43458
- artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
43459
- };
43460
- }
43461
- }).filter(utils_1.notNil);
43462
- return __assign(__assign({}, job), {
43463
- needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
43464
- });
43465
- });
43466
- };
43467
- var createJobs = function (type, envs, config, componentName, trigger) {
43602
+ var createJobsForComponent = function (config, componentName, env, trigger) {
43468
43603
  return __awaiter(void 0, void 0, void 0, function () {
43469
- var commitInfo, _a, packageManagerInfo;
43604
+ var commitInfo, _a, packageManagerInfo, context;
43470
43605
  return __generator(this, function (_b) {
43471
43606
  switch (_b.label) {
43472
43607
  case 0:
@@ -43479,47 +43614,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
43479
43614
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
43480
43615
  case 2:
43481
43616
  packageManagerInfo = _b.sent();
43482
- return [2 /*return*/, envs.reduce(function (acc, env) {
43483
- return __awaiter(void 0, void 0, void 0, function () {
43484
- var context, jobs, result, _a, _b, _c, _d, _e;
43485
- return __generator(this, function (_f) {
43486
- switch (_f.label) {
43487
- case 0:
43488
- return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
43489
- case 1:
43490
- context = _f.sent();
43491
- jobs = addStageNeeds(createRawJobs(context));
43492
- _a = [{}];
43493
- return [4 /*yield*/, acc];
43494
- case 2:
43495
- _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
43496
- _d = (_c = jobs).reduce;
43497
- _e = [function (acc, job) {
43498
- var _a;
43499
- var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
43500
- var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
43501
- if (type === "gitlab") {
43502
- return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
43503
- }
43504
- throw new Error("not supported");
43505
- }];
43506
- return [4 /*yield*/, Promise.resolve({})];
43507
- case 3:
43508
- result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
43509
- return [2 /*return*/, result];
43510
- }
43511
- });
43512
- });
43513
- }, {})];
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)];
43514
43621
  }
43515
43622
  });
43516
43623
  });
43517
43624
  };
43518
- exports.createJobs = createJobs;
43625
+ exports.createJobsForComponent = createJobsForComponent;
43519
43626
 
43520
43627
  /***/ }),
43521
43628
 
43522
- /***/ 5715:
43629
+ /***/ 3920:
43523
43630
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43524
43631
 
43525
43632
  "use strict";
@@ -43535,6 +43642,121 @@ var __assign = this && this.__assign || function () {
43535
43642
  };
43536
43643
  return __assign.apply(this, arguments);
43537
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
+ };
43538
43760
  var __rest = this && this.__rest || function (s, e) {
43539
43761
  var t = {};
43540
43762
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -43543,30 +43765,131 @@ var __rest = this && this.__rest || function (s, e) {
43543
43765
  }
43544
43766
  return t;
43545
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
+ };
43546
43799
  exports.__esModule = true;
43547
- exports.makeGitlabJob = void 0;
43800
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
43548
43801
  var lodash_1 = __nccwpck_require__(3255);
43549
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
+ };
43550
43820
  var getJobName = function (need) {
43551
43821
  return (0, lodash_1.isObject)(need) ? need.job : need;
43552
43822
  };
43553
- var makeGitlabJob = function (_a) {
43823
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
43824
+ var _b;
43554
43825
  var envMode = _a.envMode,
43555
43826
  needsStages = _a.needsStages,
43556
43827
  needsOtherComponent = _a.needsOtherComponent,
43557
43828
  name = _a.name,
43558
43829
  needs = _a.needs,
43559
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43560
- 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,
43561
43865
  // sort in a predictable manner for snapshot tests
43562
- needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
43563
- return getJobName(a).localeCompare(getJobName(b));
43564
- }),
43866
+ needs: gitlabNeeds,
43565
43867
  retry: defaults_1.BASE_RETRY,
43566
43868
  interruptible: true
43567
43869
  });
43870
+ return [fullJobName, gitlabJob];
43568
43871
  };
43569
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;
43570
43893
 
43571
43894
  /***/ }),
43572
43895
 
@@ -43593,7 +43916,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
43593
43916
  };
43594
43917
  exports.__esModule = true;
43595
43918
  __exportStar(__nccwpck_require__(8974), exports);
43596
- __exportStar(__nccwpck_require__(7726), exports);
43919
+ __exportStar(__nccwpck_require__(962), exports);
43597
43920
 
43598
43921
  /***/ }),
43599
43922