@catladder/cli 0.0.0-fix-command-710f75f1 → 0.0.0-fix-error-sql-db-delete-b3878c2e

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 = "fix-error-sql-db-delete-b3878c2e" || 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;
@@ -41782,7 +41831,7 @@ var runner_1 = __nccwpck_require__(5071);
41782
41831
  var base_1 = __nccwpck_require__(9177);
41783
41832
  var types_1 = __nccwpck_require__(3109);
41784
41833
  var createCustomDeployJobs = function (context) {
41785
- var _a, _b;
41834
+ var _a, _b, _c;
41786
41835
  var deployConfig = context.componentConfig.deploy;
41787
41836
  if (deployConfig === false) {
41788
41837
  return [];
@@ -41793,11 +41842,14 @@ var createCustomDeployJobs = function (context) {
41793
41842
  }
41794
41843
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
41795
41844
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
41796
- return [(0, lodash_1.merge)({}, baseDeploymentJob, {
41845
+ return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
41797
41846
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
41798
41847
  cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
41799
41848
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
41800
- })];
41849
+ })], __read(deployConfig.stopScript ? [(0, lodash_1.merge)({}, (0, base_1.getBaseDeploymentStopJob)(context), {
41850
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
41851
+ script: deployConfig.stopScript
41852
+ })] : []), false);
41801
41853
  };
41802
41854
  exports.createCustomDeployJobs = createCustomDeployJobs;
41803
41855
 
@@ -41947,7 +41999,11 @@ var additionalKubernetesSecretKeys = function (_a) {
41947
41999
  keys.push("POSTGRESQL_PASSWORD");
41948
42000
  keys.push("cloudsqlProxyCredentials");
41949
42001
  }
41950
- return keys;
42002
+ return keys.map(function (key) {
42003
+ return {
42004
+ key: key
42005
+ };
42006
+ });
41951
42007
  };
41952
42008
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41953
42009
 
@@ -42047,7 +42103,7 @@ var base_1 = __nccwpck_require__(9177);
42047
42103
  var types_1 = __nccwpck_require__(3109);
42048
42104
  var kubeValues_1 = __nccwpck_require__(1061);
42049
42105
  var createKubernetesDeployJobs = function (context) {
42050
- var _a, _b;
42106
+ var _a, _b, _c;
42051
42107
  var deployConfig = context.componentConfig.deploy;
42052
42108
  if (deployConfig === false) {
42053
42109
  return [];
@@ -42071,10 +42127,10 @@ var createKubernetesDeployJobs = function (context) {
42071
42127
  quotingType: "'",
42072
42128
  forceQuotes: true
42073
42129
  }),
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(" "),
42130
+ HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
42131
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
42076
42132
  COMPONENT_NAME: context.componentName,
42077
- BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
42133
+ BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
42078
42134
  })
42079
42135
  };
42080
42136
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -42305,33 +42361,36 @@ var kubeEnv_1 = __nccwpck_require__(9449);
42305
42361
  var mongodb_1 = __nccwpck_require__(7601);
42306
42362
  var processSecretsAsFiles_1 = __nccwpck_require__(5187);
42307
42363
  var createAppConfig = function (context, application) {
42308
- var _a, _b, _c;
42309
42364
  if (application === false) {
42310
42365
  return {
42311
42366
  enabled: false
42312
42367
  };
42313
42368
  }
42369
+ var _a = application !== null && application !== void 0 ? application : {},
42370
+ healthRoute = _a.healthRoute,
42371
+ command = _a.command,
42372
+ rest = __rest(_a, ["healthRoute", "command"]);
42314
42373
  return (0, utils_1.mergeWithMergingArrays)({
42315
42374
  host: context.environment.host,
42316
- command: context.componentConfig.build.startCommand,
42375
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
42317
42376
  livenessProbe: {
42318
42377
  httpGet: {
42319
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
42378
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42320
42379
  }
42321
42380
  },
42322
42381
  readinessProbe: {
42323
42382
  httpGet: {
42324
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
42383
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42325
42384
  }
42326
42385
  },
42327
42386
  startupProbe: {
42328
42387
  httpGet: {
42329
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
42388
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42330
42389
  }
42331
42390
  }
42332
42391
  },
42333
42392
  // default
42334
- application // merge rest in
42393
+ rest // merge rest in
42335
42394
  );
42336
42395
  };
42337
42396
 
@@ -42967,22 +43026,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
42967
43026
 
42968
43027
  /***/ }),
42969
43028
 
42970
- /***/ 8974:
43029
+ /***/ 7052:
42971
43030
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42972
43031
 
42973
43032
  "use strict";
42974
43033
 
42975
43034
 
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];
43035
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43036
+ function adopt(value) {
43037
+ return value instanceof P ? value : new P(function (resolve) {
43038
+ resolve(value);
43039
+ });
43040
+ }
43041
+ return new (P || (P = Promise))(function (resolve, reject) {
43042
+ function fulfilled(value) {
43043
+ try {
43044
+ step(generator.next(value));
43045
+ } catch (e) {
43046
+ reject(e);
43047
+ }
42981
43048
  }
42982
- return t;
42983
- };
42984
- return __assign.apply(this, arguments);
43049
+ function rejected(value) {
43050
+ try {
43051
+ step(generator["throw"](value));
43052
+ } catch (e) {
43053
+ reject(e);
43054
+ }
43055
+ }
43056
+ function step(result) {
43057
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43058
+ }
43059
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43060
+ });
43061
+ };
43062
+ var __generator = this && this.__generator || function (thisArg, body) {
43063
+ var _ = {
43064
+ label: 0,
43065
+ sent: function () {
43066
+ if (t[0] & 1) throw t[1];
43067
+ return t[1];
43068
+ },
43069
+ trys: [],
43070
+ ops: []
43071
+ },
43072
+ f,
43073
+ y,
43074
+ t,
43075
+ g;
43076
+ return g = {
43077
+ next: verb(0),
43078
+ "throw": verb(1),
43079
+ "return": verb(2)
43080
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
43081
+ return this;
43082
+ }), g;
43083
+ function verb(n) {
43084
+ return function (v) {
43085
+ return step([n, v]);
43086
+ };
43087
+ }
43088
+ function step(op) {
43089
+ if (f) throw new TypeError("Generator is already executing.");
43090
+ while (_) try {
43091
+ 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;
43092
+ if (y = 0, t) op = [op[0] & 2, t.value];
43093
+ switch (op[0]) {
43094
+ case 0:
43095
+ case 1:
43096
+ t = op;
43097
+ break;
43098
+ case 4:
43099
+ _.label++;
43100
+ return {
43101
+ value: op[1],
43102
+ done: false
43103
+ };
43104
+ case 5:
43105
+ _.label++;
43106
+ y = op[1];
43107
+ op = [0];
43108
+ continue;
43109
+ case 7:
43110
+ op = _.ops.pop();
43111
+ _.trys.pop();
43112
+ continue;
43113
+ default:
43114
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
43115
+ _ = 0;
43116
+ continue;
43117
+ }
43118
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
43119
+ _.label = op[1];
43120
+ break;
43121
+ }
43122
+ if (op[0] === 6 && _.label < t[1]) {
43123
+ _.label = t[1];
43124
+ t = op;
43125
+ break;
43126
+ }
43127
+ if (t && _.label < t[2]) {
43128
+ _.label = t[2];
43129
+ _.ops.push(op);
43130
+ break;
43131
+ }
43132
+ if (t[2]) _.ops.pop();
43133
+ _.trys.pop();
43134
+ continue;
43135
+ }
43136
+ op = body.call(thisArg, _);
43137
+ } catch (e) {
43138
+ op = [6, e];
43139
+ y = 0;
43140
+ } finally {
43141
+ f = t = 0;
43142
+ }
43143
+ if (op[0] & 5) throw op[1];
43144
+ return {
43145
+ value: op[0] ? op[1] : void 0,
43146
+ done: true
43147
+ };
43148
+ }
43149
+ };
43150
+ exports.__esModule = true;
43151
+ exports.createAllJobs = void 0;
43152
+ var config_1 = __nccwpck_require__(3138);
43153
+ var createJobsForComponent_1 = __nccwpck_require__(962);
43154
+ var createAllJobs = function (config, trigger) {
43155
+ return __awaiter(void 0, void 0, void 0, function () {
43156
+ var _a, _b;
43157
+ return __generator(this, function (_c) {
43158
+ switch (_c.label) {
43159
+ case 0:
43160
+ _b = (_a = Object).fromEntries;
43161
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
43162
+ return __awaiter(void 0, void 0, void 0, function () {
43163
+ var envs, _a, _b, _c;
43164
+ return __generator(this, function (_d) {
43165
+ switch (_d.label) {
43166
+ case 0:
43167
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
43168
+ _a = [componentName];
43169
+ _c = (_b = Object).fromEntries;
43170
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
43171
+ return __awaiter(void 0, void 0, void 0, function () {
43172
+ var _a;
43173
+ return __generator(this, function (_b) {
43174
+ switch (_b.label) {
43175
+ case 0:
43176
+ _a = [env];
43177
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
43178
+ case 1:
43179
+ return [2 /*return*/, _a.concat([_b.sent()])];
43180
+ }
43181
+ });
43182
+ });
43183
+ }))];
43184
+ case 1:
43185
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
43186
+ }
43187
+ });
43188
+ });
43189
+ }))];
43190
+ case 1:
43191
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
43192
+ }
43193
+ });
43194
+ });
42985
43195
  };
43196
+ exports.createAllJobs = createAllJobs;
43197
+
43198
+ /***/ }),
43199
+
43200
+ /***/ 8974:
43201
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43202
+
43203
+ "use strict";
43204
+
43205
+
42986
43206
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
42987
43207
  function adopt(value) {
42988
43208
  return value instanceof P ? value : new P(function (resolve) {
@@ -43135,54 +43355,40 @@ var config_1 = __nccwpck_require__(3138);
43135
43355
  var rules_1 = __nccwpck_require__(2020);
43136
43356
  var runner_1 = __nccwpck_require__(5071);
43137
43357
  var jobs_1 = __nccwpck_require__(2339);
43138
- var createJobs_1 = __nccwpck_require__(7726);
43358
+ var createAllJobs_1 = __nccwpck_require__(7052);
43359
+ var createGitlabJobs_1 = __nccwpck_require__(3920);
43139
43360
  var createChildPipeline = function (type, trigger, config) {
43140
43361
  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) {
43362
+ var jobs, allEnvs, stages, pipeline;
43363
+ var _a;
43364
+ return __generator(this, function (_b) {
43365
+ switch (_b.label) {
43144
43366
  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({}))];
43367
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
43164
43368
  case 1:
43165
- jobs = _a.sent();
43369
+ jobs = _b.sent();
43166
43370
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
43167
43371
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
43168
43372
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
43169
43373
  return "".concat(baseStage, " ").concat(e);
43170
43374
  })), false);
43171
43375
  }, []);
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
- }
43376
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
43377
+ _a = {
43378
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
43379
+ variables: {
43380
+ FF_USE_FASTZIP: "true"
43381
+ },
43382
+ workflow: {
43383
+ rules: rules_1.RULES_ALWAYS
43384
+ },
43385
+ stages: stages
43386
+ };
43387
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
43388
+ case 2:
43389
+ pipeline = (_a.jobs = _b.sent(), _a);
43390
+ return [2 /*return*/, pipeline];
43391
+ case 3:
43186
43392
  throw new Error("".concat(type, " is not supported"));
43187
43393
  }
43188
43394
  });
@@ -43192,7 +43398,7 @@ exports.createChildPipeline = createChildPipeline;
43192
43398
 
43193
43399
  /***/ }),
43194
43400
 
43195
- /***/ 7726:
43401
+ /***/ 962:
43196
43402
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43197
43403
 
43198
43404
  "use strict";
@@ -43363,14 +43569,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43363
43569
  return to.concat(ar || Array.prototype.slice.call(from));
43364
43570
  };
43365
43571
  exports.__esModule = true;
43366
- exports.createJobs = void 0;
43572
+ exports.createJobsForComponent = void 0;
43367
43573
  var lodash_1 = __nccwpck_require__(3255);
43368
43574
  var build_1 = __nccwpck_require__(3760);
43369
43575
  var context_1 = __nccwpck_require__(2041);
43370
43576
  var deploy_1 = __nccwpck_require__(223);
43371
- var utils_1 = __nccwpck_require__(7461);
43372
43577
  var getCommitInfo_1 = __nccwpck_require__(5923);
43373
- var makeGitlabJob_1 = __nccwpck_require__(5715);
43374
43578
  var packageManager_1 = __nccwpck_require__(9168);
43375
43579
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
43376
43580
  return jobs.map(function (_a) {
@@ -43398,76 +43602,9 @@ var createRawJobs = function (context) {
43398
43602
  var customJobs = getCustomJobs(context);
43399
43603
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
43400
43604
  };
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) {
43605
+ var createJobsForComponent = function (config, componentName, env, trigger) {
43469
43606
  return __awaiter(void 0, void 0, void 0, function () {
43470
- var commitInfo, _a, packageManagerInfo;
43607
+ var commitInfo, _a, packageManagerInfo, context;
43471
43608
  return __generator(this, function (_b) {
43472
43609
  switch (_b.label) {
43473
43610
  case 0:
@@ -43480,47 +43617,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
43480
43617
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
43481
43618
  case 2:
43482
43619
  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
- }, {})];
43620
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
43621
+ case 3:
43622
+ context = _b.sent();
43623
+ return [2 /*return*/, createRawJobs(context)];
43515
43624
  }
43516
43625
  });
43517
43626
  });
43518
43627
  };
43519
- exports.createJobs = createJobs;
43628
+ exports.createJobsForComponent = createJobsForComponent;
43520
43629
 
43521
43630
  /***/ }),
43522
43631
 
43523
- /***/ 5715:
43632
+ /***/ 3920:
43524
43633
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43525
43634
 
43526
43635
  "use strict";
@@ -43536,6 +43645,121 @@ var __assign = this && this.__assign || function () {
43536
43645
  };
43537
43646
  return __assign.apply(this, arguments);
43538
43647
  };
43648
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
43649
+ function adopt(value) {
43650
+ return value instanceof P ? value : new P(function (resolve) {
43651
+ resolve(value);
43652
+ });
43653
+ }
43654
+ return new (P || (P = Promise))(function (resolve, reject) {
43655
+ function fulfilled(value) {
43656
+ try {
43657
+ step(generator.next(value));
43658
+ } catch (e) {
43659
+ reject(e);
43660
+ }
43661
+ }
43662
+ function rejected(value) {
43663
+ try {
43664
+ step(generator["throw"](value));
43665
+ } catch (e) {
43666
+ reject(e);
43667
+ }
43668
+ }
43669
+ function step(result) {
43670
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43671
+ }
43672
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43673
+ });
43674
+ };
43675
+ var __generator = this && this.__generator || function (thisArg, body) {
43676
+ var _ = {
43677
+ label: 0,
43678
+ sent: function () {
43679
+ if (t[0] & 1) throw t[1];
43680
+ return t[1];
43681
+ },
43682
+ trys: [],
43683
+ ops: []
43684
+ },
43685
+ f,
43686
+ y,
43687
+ t,
43688
+ g;
43689
+ return g = {
43690
+ next: verb(0),
43691
+ "throw": verb(1),
43692
+ "return": verb(2)
43693
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
43694
+ return this;
43695
+ }), g;
43696
+ function verb(n) {
43697
+ return function (v) {
43698
+ return step([n, v]);
43699
+ };
43700
+ }
43701
+ function step(op) {
43702
+ if (f) throw new TypeError("Generator is already executing.");
43703
+ while (_) try {
43704
+ 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;
43705
+ if (y = 0, t) op = [op[0] & 2, t.value];
43706
+ switch (op[0]) {
43707
+ case 0:
43708
+ case 1:
43709
+ t = op;
43710
+ break;
43711
+ case 4:
43712
+ _.label++;
43713
+ return {
43714
+ value: op[1],
43715
+ done: false
43716
+ };
43717
+ case 5:
43718
+ _.label++;
43719
+ y = op[1];
43720
+ op = [0];
43721
+ continue;
43722
+ case 7:
43723
+ op = _.ops.pop();
43724
+ _.trys.pop();
43725
+ continue;
43726
+ default:
43727
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
43728
+ _ = 0;
43729
+ continue;
43730
+ }
43731
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
43732
+ _.label = op[1];
43733
+ break;
43734
+ }
43735
+ if (op[0] === 6 && _.label < t[1]) {
43736
+ _.label = t[1];
43737
+ t = op;
43738
+ break;
43739
+ }
43740
+ if (t && _.label < t[2]) {
43741
+ _.label = t[2];
43742
+ _.ops.push(op);
43743
+ break;
43744
+ }
43745
+ if (t[2]) _.ops.pop();
43746
+ _.trys.pop();
43747
+ continue;
43748
+ }
43749
+ op = body.call(thisArg, _);
43750
+ } catch (e) {
43751
+ op = [6, e];
43752
+ y = 0;
43753
+ } finally {
43754
+ f = t = 0;
43755
+ }
43756
+ if (op[0] & 5) throw op[1];
43757
+ return {
43758
+ value: op[0] ? op[1] : void 0,
43759
+ done: true
43760
+ };
43761
+ }
43762
+ };
43539
43763
  var __rest = this && this.__rest || function (s, e) {
43540
43764
  var t = {};
43541
43765
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -43544,30 +43768,131 @@ var __rest = this && this.__rest || function (s, e) {
43544
43768
  }
43545
43769
  return t;
43546
43770
  };
43771
+ var __read = this && this.__read || function (o, n) {
43772
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
43773
+ if (!m) return o;
43774
+ var i = m.call(o),
43775
+ r,
43776
+ ar = [],
43777
+ e;
43778
+ try {
43779
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
43780
+ } catch (error) {
43781
+ e = {
43782
+ error: error
43783
+ };
43784
+ } finally {
43785
+ try {
43786
+ if (r && !r.done && (m = i["return"])) m.call(i);
43787
+ } finally {
43788
+ if (e) throw e.error;
43789
+ }
43790
+ }
43791
+ return ar;
43792
+ };
43793
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43794
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
43795
+ if (ar || !(i in from)) {
43796
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
43797
+ ar[i] = from[i];
43798
+ }
43799
+ }
43800
+ return to.concat(ar || Array.prototype.slice.call(from));
43801
+ };
43547
43802
  exports.__esModule = true;
43548
- exports.makeGitlabJob = void 0;
43803
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
43549
43804
  var lodash_1 = __nccwpck_require__(3255);
43550
43805
  var defaults_1 = __nccwpck_require__(7383);
43806
+ var getFullJobName = function (name, componentName, env) {
43807
+ if (env) {
43808
+ return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
43809
+ }
43810
+ return "".concat(componentName, " ").concat(name);
43811
+ };
43812
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
43813
+ var _a, _b;
43814
+ var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
43815
+ return j.name === referencedJobName;
43816
+ });
43817
+ if (!referencedJob) {
43818
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
43819
+ }
43820
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
43821
+ return getFullJobName(referencedJobName, componentName, envToSet);
43822
+ };
43551
43823
  var getJobName = function (need) {
43552
43824
  return (0, lodash_1.isObject)(need) ? need.job : need;
43553
43825
  };
43554
- var makeGitlabJob = function (_a) {
43826
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
43827
+ var _b;
43555
43828
  var envMode = _a.envMode,
43556
43829
  needsStages = _a.needsStages,
43557
43830
  needsOtherComponent = _a.needsOtherComponent,
43558
43831
  name = _a.name,
43559
43832
  needs = _a.needs,
43560
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43561
- return __assign(__assign({}, rest), {
43833
+ job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
43834
+ var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
43835
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
43836
+ var _a, _b, _c, _d;
43837
+ var referencedComponentName = componentName;
43838
+ 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) {
43839
+ return j.stage === n.stage;
43840
+ })) === null || _c === void 0 ? void 0 : _c.map(function (j) {
43841
+ return j.name;
43842
+ })) !== null && _d !== void 0 ? _d : [];
43843
+ return allJobNamesFromThatStage.map(function (job) {
43844
+ var _a;
43845
+ return {
43846
+ job: job,
43847
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
43848
+ componentName: referencedComponentName
43849
+ };
43850
+ });
43851
+ });
43852
+ 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);
43853
+ var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
43854
+ var _a;
43855
+ return (0, lodash_1.isObject)(n) ? {
43856
+ job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
43857
+ artifacts: n.artifacts
43858
+ } : getFullReferencedJobName(n, componentName, env, allJobs);
43859
+ }).sort(function (a, b) {
43860
+ return getJobName(a).localeCompare(getJobName(b));
43861
+ });
43862
+ var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
43863
+ var gitlabJob = __assign(__assign({}, job), {
43864
+ stage: stage,
43865
+ environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
43866
+ on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
43867
+ }) : job.environment,
43562
43868
  // 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
- }),
43869
+ needs: gitlabNeeds,
43566
43870
  retry: defaults_1.BASE_RETRY,
43567
43871
  interruptible: true
43568
43872
  });
43873
+ return [fullJobName, gitlabJob];
43569
43874
  };
43570
43875
  exports.makeGitlabJob = makeGitlabJob;
43876
+ var createGitlabJobs = function (allJobs) {
43877
+ return __awaiter(void 0, void 0, void 0, function () {
43878
+ return __generator(this, function (_a) {
43879
+ return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
43880
+ var componentJobs = allJobs[componentName];
43881
+ return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
43882
+ var jobs = componentJobs[env];
43883
+ return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
43884
+ var _a;
43885
+ var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
43886
+ fullJobName = _b[0],
43887
+ gitlabJob = _b[1];
43888
+ return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
43889
+ }, {}));
43890
+ }, {}));
43891
+ }, {})];
43892
+ });
43893
+ });
43894
+ };
43895
+ exports.createGitlabJobs = createGitlabJobs;
43571
43896
 
43572
43897
  /***/ }),
43573
43898
 
@@ -43594,7 +43919,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
43594
43919
  };
43595
43920
  exports.__esModule = true;
43596
43921
  __exportStar(__nccwpck_require__(8974), exports);
43597
- __exportStar(__nccwpck_require__(7726), exports);
43922
+ __exportStar(__nccwpck_require__(962), exports);
43598
43923
 
43599
43924
  /***/ }),
43600
43925
 
@@ -44257,7 +44582,7 @@ var sanitizeForBashVariable = function (name) {
44257
44582
  };
44258
44583
  exports.sanitizeForBashVariable = sanitizeForBashVariable;
44259
44584
  var repeatOnFailure = function (command, options) {
44260
- return "\n until ".concat(command, " &> /dev/null\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
44585
+ return "\n until ".concat(command, "\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
44261
44586
  };
44262
44587
  exports.repeatOnFailure = repeatOnFailure;
44263
44588