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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/build/custom/buildJob.js +1 -0
  2. package/dist/build/docker.d.ts +4 -18
  3. package/dist/build/docker.js +15 -9
  4. package/dist/build/index.js +7 -1
  5. package/dist/build/rails/build.js +37 -16
  6. package/dist/build/rails/index.d.ts +2 -2
  7. package/dist/build/rails/test.js +1 -2
  8. package/dist/build/types.d.ts +36 -4
  9. package/dist/bundles/catladder-gitlab/index.js +536 -214
  10. package/dist/constants.js +1 -1
  11. package/dist/context/getEnvironment.js +1 -0
  12. package/dist/context/getEnvironmentContext.js +5 -3
  13. package/dist/context/getEnvironmentVariables.d.ts +5 -1
  14. package/dist/context/getEnvironmentVariables.js +7 -2
  15. package/dist/deploy/base.js +1 -1
  16. package/dist/deploy/cloudRun/index.js +14 -6
  17. package/dist/deploy/index.d.ts +2 -1
  18. package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  19. package/dist/deploy/kubernetes/additionalSecretKeys.js +5 -1
  20. package/dist/deploy/kubernetes/deployJob.js +4 -4
  21. package/dist/deploy/kubernetes/kubeValues.d.ts +1 -0
  22. package/dist/deploy/kubernetes/kubeValues.js +9 -6
  23. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +1 -0
  24. package/dist/deploy/types/custom.d.ts +2 -1
  25. package/dist/deploy/types/googleCloudRun.d.ts +5 -1
  26. package/dist/deploy/types/kubernetes.d.ts +9 -0
  27. package/dist/pipeline/createAllJobs.d.ts +8 -0
  28. package/dist/pipeline/createAllJobs.js +164 -0
  29. package/dist/pipeline/createChildPipeline.js +24 -48
  30. package/dist/pipeline/createJobsForComponent.d.ts +3 -0
  31. package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +8 -105
  32. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
  33. package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
  34. package/dist/pipeline/index.d.ts +1 -1
  35. package/dist/pipeline/index.js +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/dist/types/config.d.ts +3 -3
  38. package/dist/types/context.d.ts +3 -1
  39. package/dist/types/environmentContext.d.ts +7 -0
  40. package/dist/types/gitlab-types.d.ts +5 -1
  41. package/dist/types/jobs.d.ts +9 -2
  42. package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +8 -20
  43. package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +8 -20
  44. package/examples/__snapshots__/cloud-run-non-public.ts.snap +8 -20
  45. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3092 -0
  46. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +16 -40
  47. package/examples/__snapshots__/custom-build-job.ts.snap +8 -20
  48. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
  49. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
  50. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
  51. package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
  52. package/examples/kubernetes-application-customization.ts +57 -0
  53. package/examples/rails-k8s-with-worker.ts +95 -0
  54. package/package.json +1 -1
  55. package/src/build/custom/buildJob.ts +1 -0
  56. package/src/build/docker.ts +13 -6
  57. package/src/build/index.ts +7 -1
  58. package/src/build/node/cache.ts +2 -2
  59. package/src/build/rails/build.ts +20 -10
  60. package/src/build/rails/index.ts +2 -2
  61. package/src/build/rails/test.ts +43 -39
  62. package/src/build/types.ts +40 -5
  63. package/src/config/configruedEnvs.ts +2 -8
  64. package/src/context/getEnvironment.ts +1 -0
  65. package/src/context/getEnvironmentContext.ts +6 -6
  66. package/src/context/getEnvironmentVariables.ts +9 -4
  67. package/src/deploy/base.ts +1 -1
  68. package/src/deploy/cloudRun/deployJob.ts +1 -1
  69. package/src/deploy/cloudRun/index.ts +12 -4
  70. package/src/deploy/index.ts +4 -1
  71. package/src/deploy/kubernetes/additionalSecretKeys.ts +1 -1
  72. package/src/deploy/kubernetes/deployJob.ts +2 -1
  73. package/src/deploy/kubernetes/kubeValues.ts +7 -5
  74. package/src/deploy/types/custom.ts +2 -1
  75. package/src/deploy/types/googleCloudRun.ts +6 -1
  76. package/src/deploy/types/kubernetes.ts +11 -1
  77. package/src/pipeline/createAllJobs.ts +38 -0
  78. package/src/pipeline/createChildPipeline.ts +6 -22
  79. package/src/pipeline/createJobsForComponent.ts +64 -0
  80. package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
  81. package/src/pipeline/index.ts +1 -1
  82. package/src/types/context.ts +3 -1
  83. package/src/types/environmentContext.ts +7 -0
  84. package/src/types/gitlab-types.ts +10 -3
  85. package/src/types/jobs.ts +11 -2
  86. package/dist/pipeline/createJobs.d.ts +0 -3
  87. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -10
  88. package/dist/pipeline/gitlab/makeGitlabJob.js +0 -44
  89. package/src/pipeline/createJobs.ts +0 -199
  90. package/src/pipeline/gitlab/makeGitlabJob.ts +0 -23
@@ -27071,6 +27071,7 @@ var createCustomBuildJobs = function (context) {
27071
27071
  var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
27072
27072
  image: buildConfig.jobImage,
27073
27073
  variables: __assign({}, RUNNER_BUILD_VARIABLES),
27074
+ cache: buildConfig.jobCache,
27074
27075
  services: buildConfig.jobServices,
27075
27076
  script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
27076
27077
  artifacts: {
@@ -27231,18 +27232,22 @@ var requiresDockerBuild = function (context) {
27231
27232
  return false;
27232
27233
  };
27233
27234
  exports.requiresDockerBuild = requiresDockerBuild;
27235
+ var getDockerBaseVariables = function () {
27236
+ return {
27237
+ DOCKER_HOST: "tcp://0.0.0.0:2375",
27238
+ DOCKER_TLS_CERTDIR: "",
27239
+ DOCKER_DRIVER: "overlay2",
27240
+ DOCKER_BUILDKIT: "1"
27241
+ };
27242
+ };
27234
27243
  var getDockerBuildVariables = function (context) {
27235
27244
  var _a, _b, _c, _d;
27236
- return __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
27237
- DOCKER_BUILDKIT: "1",
27245
+ return __assign(__assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
27238
27246
  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"),
27239
27247
  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"),
27240
27248
  APP_DIR: context.componentConfig.dir,
27241
- DOCKER_HOST: "tcp://0.0.0.0:2375",
27242
- DOCKER_TLS_CERTDIR: "",
27243
- DOCKER_DIR: ".",
27244
- DOCKER_DRIVER: "overlay2"
27245
- }), (0, exports.getDockerImageVariables)(context));
27249
+ DOCKER_DIR: "."
27250
+ }), getDockerBaseVariables()), (0, exports.getDockerImageVariables)(context));
27246
27251
  };
27247
27252
  exports.getDockerBuildVariables = getDockerBuildVariables;
27248
27253
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
@@ -27253,7 +27258,7 @@ var getDockerJobBaseProps = function (context) {
27253
27258
  name: "docker:20-dind",
27254
27259
  command: ["--tls=false"]
27255
27260
  }],
27256
- variables: (0, exports.getDockerBuildVariables)(context)
27261
+ variables: getDockerBaseVariables()
27257
27262
  };
27258
27263
  };
27259
27264
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
@@ -27266,7 +27271,9 @@ var createDockerBuildJobBase = function (context, _a) {
27266
27271
  stage: "build"
27267
27272
  }, (0, exports.getDockerJobBaseProps)(context)), {
27268
27273
  script: script || []
27269
- }), def);
27274
+ }), {
27275
+ variables: (0, exports.getDockerBuildVariables)(context)
27276
+ }, def);
27270
27277
  };
27271
27278
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
27272
27279
  exports.gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
@@ -27352,7 +27359,13 @@ exports.BUILD_TYPES = {
27352
27359
  rails: {
27353
27360
  jobs: rails_1.createRailsJobs,
27354
27361
  defaults: function () {
27355
- return {};
27362
+ return {
27363
+ startCommand: "/cnb/process/web",
27364
+ cnbBuilder: {
27365
+ image: "heroku/buildpacks:20",
27366
+ packVersion: "0.28.0"
27367
+ }
27368
+ };
27356
27369
  }
27357
27370
  }
27358
27371
  };
@@ -27882,31 +27895,52 @@ exports.getYarnInstall = getYarnInstall;
27882
27895
  "use strict";
27883
27896
 
27884
27897
 
27885
- var __assign = this && this.__assign || function () {
27886
- __assign = Object.assign || function (t) {
27887
- for (var s, i = 1, n = arguments.length; i < n; i++) {
27888
- s = arguments[i];
27889
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
27898
+ var __read = this && this.__read || function (o, n) {
27899
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27900
+ if (!m) return o;
27901
+ var i = m.call(o),
27902
+ r,
27903
+ ar = [],
27904
+ e;
27905
+ try {
27906
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27907
+ } catch (error) {
27908
+ e = {
27909
+ error: error
27910
+ };
27911
+ } finally {
27912
+ try {
27913
+ if (r && !r.done && (m = i["return"])) m.call(i);
27914
+ } finally {
27915
+ if (e) throw e.error;
27890
27916
  }
27891
- return t;
27892
- };
27893
- return __assign.apply(this, arguments);
27917
+ }
27918
+ return ar;
27894
27919
  };
27895
27920
  exports.__esModule = true;
27896
27921
  exports.createRailsBuildJobs = void 0;
27922
+ var types_1 = __nccwpck_require__(6575);
27897
27923
  var docker_1 = __nccwpck_require__(9953);
27898
27924
  var createRailsBuildJobs = function (context) {
27925
+ var _a, _b, _c;
27926
+ var buildConfig = context.componentConfig.build;
27927
+ if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
27928
+ // should not happen
27929
+ throw new Error("build type is not rails");
27930
+ }
27931
+ var cnbConf = buildConfig.cnbBuilder;
27932
+ var packEnvArgs = Object.entries((_a = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
27933
+ var _b = __read(_a, 2),
27934
+ k = _b[0],
27935
+ v = _b[1];
27936
+ return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
27937
+ }).join(" ");
27899
27938
  return [(0, docker_1.createDockerBuildJobBase)(context, {
27900
- variables: __assign({
27901
- CNB_BUILDER: "heroku/buildpacks:18",
27902
- CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
27903
- CNB_EXTRA_ARGS: "",
27904
- CNB_PACK_VERSION: "0.20.0"
27905
- }, context.componentConfig.build.extraVars),
27939
+ variables: context.componentConfig.build.extraVars,
27906
27940
  // custom script
27907
- 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",
27941
+ 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",
27908
27942
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
27909
- "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"]
27943
+ "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 : "")]
27910
27944
  })];
27911
27945
  };
27912
27946
  exports.createRailsBuildJobs = createRailsBuildJobs;
@@ -28030,9 +28064,8 @@ var createRailsTestJobs = function (context) {
28030
28064
  var bundlerCache = {
28031
28065
  key: {
28032
28066
  files: ["Gemfile.lock"],
28033
- prefix: "$CI_JOB_IMAGE" // a changed image might have different OS libraries which no longer work with the cached gems
28067
+ prefix: "$CI_JOB_IMAGE"
28034
28068
  },
28035
-
28036
28069
  paths: [bundlerCacheDir]
28037
28070
  };
28038
28071
  var auditJob = buildConfig.audit !== false ? __assign(__assign({
@@ -28318,7 +28351,7 @@ exports.readConfigSync = readConfigSync;
28318
28351
 
28319
28352
  exports.__esModule = true;
28320
28353
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
28321
- exports.PIPELINE_IMAGE_TAG = "fix-command-710f75f1" || 0;
28354
+ exports.PIPELINE_IMAGE_TAG = "hidden-secrets-da086bf2" || 0;
28322
28355
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
28323
28356
 
28324
28357
  /***/ }),
@@ -28513,6 +28546,7 @@ var getEnvironment = function (config, componentName, env, commitInfo) {
28513
28546
  url: url
28514
28547
  },
28515
28548
  fullName: envContext.fullName,
28549
+ slugPrefix: envContext.environmentSlugPrefix,
28516
28550
  slug: envContext.environmentSlug,
28517
28551
  shortName: env,
28518
28552
  envVars: envVars,
@@ -28536,20 +28570,22 @@ exports.__esModule = true;
28536
28570
  exports.getEnvironmentContext = void 0;
28537
28571
  var getEnvConfig_1 = __nccwpck_require__(1691);
28538
28572
  var getEnvType_1 = __nccwpck_require__(2187);
28539
- var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
28573
+ var getEnvironmentSlugPrefix = function (envConfig, env, commitInfo) {
28540
28574
  var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
28541
- return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
28575
+ return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug) : "".concat(env);
28542
28576
  };
28543
28577
  var getEnvironmentContext = function (config, env, componentName, commitInfo) {
28544
28578
  var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
28545
28579
  var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
28546
- var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
28580
+ var environmentSlugPrefix = getEnvironmentSlugPrefix(envConfigRaw, env, commitInfo);
28581
+ var environmentSlug = "".concat(environmentSlugPrefix, "-").concat(componentName);
28547
28582
  var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
28548
28583
  var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
28549
28584
  return {
28550
28585
  envConfigRaw: envConfigRaw,
28551
28586
  deployConfigRaw: envConfigRaw.deploy,
28552
28587
  buildConfigRaw: envConfigRaw.build,
28588
+ environmentSlugPrefix: environmentSlugPrefix,
28553
28589
  environmentSlug: environmentSlug,
28554
28590
  gitlabEnvironmentName: gitlabEnvironmentName,
28555
28591
  fullName: fullName,
@@ -28772,8 +28808,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
28772
28808
  }
28773
28809
  publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
28774
28810
  additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
28775
- 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);
28776
- secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
28811
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
28812
+ return {
28813
+ key: key
28814
+ };
28815
+ })), false), __read(additionalSecretKeys), false);
28816
+ secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
28817
+ var key = _a.key;
28777
28818
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
28778
28819
  }));
28779
28820
  legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
@@ -29377,7 +29418,7 @@ var getBaseDeploymentJob = function (context) {
29377
29418
  return {
29378
29419
  name: exports.DEPLOY_JOB_NAME,
29379
29420
  envMode: "stagePerEnv",
29380
- needsOtherComponent: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
29421
+ needs: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
29381
29422
  return {
29382
29423
  componentName: c,
29383
29424
  job: exports.DEPLOY_JOB_NAME,
@@ -29753,15 +29794,15 @@ var jobName_1 = __nccwpck_require__(9357);
29753
29794
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
29754
29795
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
29755
29796
  var getCloudSqlVariables = function (_a) {
29756
- var _b, _c, _d;
29797
+ var _b, _c, _d, _e;
29757
29798
  var deployConfigRaw = _a.deployConfigRaw,
29758
- environmentSlug = _a.environmentSlug,
29799
+ environmentSlugPrefix = _a.environmentSlugPrefix,
29759
29800
  env = _a.env,
29760
29801
  componentName = _a.componentName,
29761
29802
  fullConfig = _a.fullConfig;
29762
29803
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
29763
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
29764
- var additionalQueryParamsString = Object.entries((_c = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
29804
+ 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("-");
29805
+ var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
29765
29806
  var _b = __read(_a, 2),
29766
29807
  key = _b[0],
29767
29808
  value = _b[1];
@@ -29770,7 +29811,7 @@ var getCloudSqlVariables = function (_a) {
29770
29811
  return {
29771
29812
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
29772
29813
  DB_NAME: DB_NAME,
29773
- DB_USER: (_d = deployConfigRaw.cloudSql.dbUser) !== null && _d !== void 0 ? _d : "postgres",
29814
+ DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
29774
29815
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
29775
29816
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
29776
29817
  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)
@@ -29793,7 +29834,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
29793
29834
  return {};
29794
29835
  },
29795
29836
  additionalSecretKeys: function (ctx) {
29796
- return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
29837
+ return __spreadArray([{
29838
+ key: exports.GCLOUD_DEPLOY_CREDENTIALS_KEY,
29839
+ hidden: true
29840
+ }, {
29841
+ key: exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
29842
+ hidden: true
29843
+ }], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? [{
29844
+ key: "DB_PASSWORD"
29845
+ }] : []), false);
29797
29846
  },
29798
29847
  getAdditionalEnvVars: function (ctx) {
29799
29848
  var _a;
@@ -30191,7 +30240,11 @@ var additionalKubernetesSecretKeys = function (_a) {
30191
30240
  keys.push("POSTGRESQL_PASSWORD");
30192
30241
  keys.push("cloudsqlProxyCredentials");
30193
30242
  }
30194
- return keys;
30243
+ return keys.map(function (key) {
30244
+ return {
30245
+ key: key
30246
+ };
30247
+ });
30195
30248
  };
30196
30249
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
30197
30250
 
@@ -30291,7 +30344,7 @@ var base_1 = __nccwpck_require__(1188);
30291
30344
  var types_1 = __nccwpck_require__(4436);
30292
30345
  var kubeValues_1 = __nccwpck_require__(2830);
30293
30346
  var createKubernetesDeployJobs = function (context) {
30294
- var _a, _b;
30347
+ var _a, _b, _c;
30295
30348
  var deployConfig = context.componentConfig.deploy;
30296
30349
  if (deployConfig === false) {
30297
30350
  return [];
@@ -30315,10 +30368,10 @@ var createKubernetesDeployJobs = function (context) {
30315
30368
  quotingType: "'",
30316
30369
  forceQuotes: true
30317
30370
  }),
30318
- HELM_GITLAB_CHART_NAME: "the-panter-chart",
30319
- HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_a = deployConfig.additionalHelmArgs) !== null && _a !== void 0 ? _a : []), false).join(" "),
30371
+ HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
30372
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
30320
30373
  COMPONENT_NAME: context.componentName,
30321
- BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
30374
+ BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
30322
30375
  })
30323
30376
  };
30324
30377
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -30549,33 +30602,36 @@ var kubeEnv_1 = __nccwpck_require__(5296);
30549
30602
  var mongodb_1 = __nccwpck_require__(221);
30550
30603
  var processSecretsAsFiles_1 = __nccwpck_require__(5088);
30551
30604
  var createAppConfig = function (context, application) {
30552
- var _a, _b, _c;
30553
30605
  if (application === false) {
30554
30606
  return {
30555
30607
  enabled: false
30556
30608
  };
30557
30609
  }
30610
+ var _a = application !== null && application !== void 0 ? application : {},
30611
+ healthRoute = _a.healthRoute,
30612
+ command = _a.command,
30613
+ rest = __rest(_a, ["healthRoute", "command"]);
30558
30614
  return (0, utils_1.mergeWithMergingArrays)({
30559
30615
  host: context.environment.host,
30560
- command: context.componentConfig.build.startCommand,
30616
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
30561
30617
  livenessProbe: {
30562
30618
  httpGet: {
30563
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
30619
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
30564
30620
  }
30565
30621
  },
30566
30622
  readinessProbe: {
30567
30623
  httpGet: {
30568
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
30624
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
30569
30625
  }
30570
30626
  },
30571
30627
  startupProbe: {
30572
30628
  httpGet: {
30573
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
30629
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
30574
30630
  }
30575
30631
  }
30576
30632
  },
30577
30633
  // default
30578
- application // merge rest in
30634
+ rest // merge rest in
30579
30635
  );
30580
30636
  };
30581
30637
 
@@ -31211,22 +31267,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
31211
31267
 
31212
31268
  /***/ }),
31213
31269
 
31214
- /***/ 4244:
31270
+ /***/ 6579:
31215
31271
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31216
31272
 
31217
31273
  "use strict";
31218
31274
 
31219
31275
 
31220
- var __assign = this && this.__assign || function () {
31221
- __assign = Object.assign || function (t) {
31222
- for (var s, i = 1, n = arguments.length; i < n; i++) {
31223
- s = arguments[i];
31224
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
31276
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31277
+ function adopt(value) {
31278
+ return value instanceof P ? value : new P(function (resolve) {
31279
+ resolve(value);
31280
+ });
31281
+ }
31282
+ return new (P || (P = Promise))(function (resolve, reject) {
31283
+ function fulfilled(value) {
31284
+ try {
31285
+ step(generator.next(value));
31286
+ } catch (e) {
31287
+ reject(e);
31288
+ }
31225
31289
  }
31226
- return t;
31227
- };
31228
- return __assign.apply(this, arguments);
31290
+ function rejected(value) {
31291
+ try {
31292
+ step(generator["throw"](value));
31293
+ } catch (e) {
31294
+ reject(e);
31295
+ }
31296
+ }
31297
+ function step(result) {
31298
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
31299
+ }
31300
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
31301
+ });
31229
31302
  };
31303
+ var __generator = this && this.__generator || function (thisArg, body) {
31304
+ var _ = {
31305
+ label: 0,
31306
+ sent: function () {
31307
+ if (t[0] & 1) throw t[1];
31308
+ return t[1];
31309
+ },
31310
+ trys: [],
31311
+ ops: []
31312
+ },
31313
+ f,
31314
+ y,
31315
+ t,
31316
+ g;
31317
+ return g = {
31318
+ next: verb(0),
31319
+ "throw": verb(1),
31320
+ "return": verb(2)
31321
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
31322
+ return this;
31323
+ }), g;
31324
+ function verb(n) {
31325
+ return function (v) {
31326
+ return step([n, v]);
31327
+ };
31328
+ }
31329
+ function step(op) {
31330
+ if (f) throw new TypeError("Generator is already executing.");
31331
+ while (_) try {
31332
+ 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;
31333
+ if (y = 0, t) op = [op[0] & 2, t.value];
31334
+ switch (op[0]) {
31335
+ case 0:
31336
+ case 1:
31337
+ t = op;
31338
+ break;
31339
+ case 4:
31340
+ _.label++;
31341
+ return {
31342
+ value: op[1],
31343
+ done: false
31344
+ };
31345
+ case 5:
31346
+ _.label++;
31347
+ y = op[1];
31348
+ op = [0];
31349
+ continue;
31350
+ case 7:
31351
+ op = _.ops.pop();
31352
+ _.trys.pop();
31353
+ continue;
31354
+ default:
31355
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
31356
+ _ = 0;
31357
+ continue;
31358
+ }
31359
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
31360
+ _.label = op[1];
31361
+ break;
31362
+ }
31363
+ if (op[0] === 6 && _.label < t[1]) {
31364
+ _.label = t[1];
31365
+ t = op;
31366
+ break;
31367
+ }
31368
+ if (t && _.label < t[2]) {
31369
+ _.label = t[2];
31370
+ _.ops.push(op);
31371
+ break;
31372
+ }
31373
+ if (t[2]) _.ops.pop();
31374
+ _.trys.pop();
31375
+ continue;
31376
+ }
31377
+ op = body.call(thisArg, _);
31378
+ } catch (e) {
31379
+ op = [6, e];
31380
+ y = 0;
31381
+ } finally {
31382
+ f = t = 0;
31383
+ }
31384
+ if (op[0] & 5) throw op[1];
31385
+ return {
31386
+ value: op[0] ? op[1] : void 0,
31387
+ done: true
31388
+ };
31389
+ }
31390
+ };
31391
+ exports.__esModule = true;
31392
+ exports.createAllJobs = void 0;
31393
+ var config_1 = __nccwpck_require__(8906);
31394
+ var createJobsForComponent_1 = __nccwpck_require__(5327);
31395
+ var createAllJobs = function (config, trigger) {
31396
+ return __awaiter(void 0, void 0, void 0, function () {
31397
+ var _a, _b;
31398
+ return __generator(this, function (_c) {
31399
+ switch (_c.label) {
31400
+ case 0:
31401
+ _b = (_a = Object).fromEntries;
31402
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
31403
+ return __awaiter(void 0, void 0, void 0, function () {
31404
+ var envs, _a, _b, _c;
31405
+ return __generator(this, function (_d) {
31406
+ switch (_d.label) {
31407
+ case 0:
31408
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
31409
+ _a = [componentName];
31410
+ _c = (_b = Object).fromEntries;
31411
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
31412
+ return __awaiter(void 0, void 0, void 0, function () {
31413
+ var _a;
31414
+ return __generator(this, function (_b) {
31415
+ switch (_b.label) {
31416
+ case 0:
31417
+ _a = [env];
31418
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
31419
+ case 1:
31420
+ return [2 /*return*/, _a.concat([_b.sent()])];
31421
+ }
31422
+ });
31423
+ });
31424
+ }))];
31425
+ case 1:
31426
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
31427
+ }
31428
+ });
31429
+ });
31430
+ }))];
31431
+ case 1:
31432
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
31433
+ }
31434
+ });
31435
+ });
31436
+ };
31437
+ exports.createAllJobs = createAllJobs;
31438
+
31439
+ /***/ }),
31440
+
31441
+ /***/ 4244:
31442
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31443
+
31444
+ "use strict";
31445
+
31446
+
31230
31447
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31231
31448
  function adopt(value) {
31232
31449
  return value instanceof P ? value : new P(function (resolve) {
@@ -31379,54 +31596,40 @@ var config_1 = __nccwpck_require__(8906);
31379
31596
  var rules_1 = __nccwpck_require__(1410);
31380
31597
  var runner_1 = __nccwpck_require__(7666);
31381
31598
  var jobs_1 = __nccwpck_require__(9072);
31382
- var createJobs_1 = __nccwpck_require__(1820);
31599
+ var createAllJobs_1 = __nccwpck_require__(6579);
31600
+ var createGitlabJobs_1 = __nccwpck_require__(5569);
31383
31601
  var createChildPipeline = function (type, trigger, config) {
31384
31602
  return __awaiter(void 0, void 0, void 0, function () {
31385
- var components, jobs, allEnvs, stages, pipeline;
31386
- return __generator(this, function (_a) {
31387
- switch (_a.label) {
31603
+ var jobs, allEnvs, stages, pipeline;
31604
+ var _a;
31605
+ return __generator(this, function (_b) {
31606
+ switch (_b.label) {
31388
31607
  case 0:
31389
- components = Object.keys(config.components);
31390
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
31391
- return __awaiter(void 0, void 0, void 0, function () {
31392
- var envs, _a, _b;
31393
- return __generator(this, function (_c) {
31394
- switch (_c.label) {
31395
- case 0:
31396
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
31397
- _a = [{}];
31398
- return [4 /*yield*/, acc];
31399
- case 1:
31400
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
31401
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
31402
- case 2:
31403
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
31404
- }
31405
- });
31406
- });
31407
- }, Promise.resolve({}))];
31608
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
31408
31609
  case 1:
31409
- jobs = _a.sent();
31610
+ jobs = _b.sent();
31410
31611
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
31411
31612
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
31412
31613
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
31413
31614
  return "".concat(baseStage, " ").concat(e);
31414
31615
  })), false);
31415
31616
  }, []);
31416
- if (type === "gitlab") {
31417
- pipeline = {
31418
- image: (0, runner_1.getRunnerImage)("jobs-default"),
31419
- variables: {
31420
- FF_USE_FASTZIP: "true"
31421
- },
31422
- workflow: {
31423
- rules: rules_1.RULES_ALWAYS
31424
- },
31425
- stages: stages,
31426
- jobs: jobs
31427
- };
31428
- return [2 /*return*/, pipeline];
31429
- }
31617
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
31618
+ _a = {
31619
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
31620
+ variables: {
31621
+ FF_USE_FASTZIP: "true"
31622
+ },
31623
+ workflow: {
31624
+ rules: rules_1.RULES_ALWAYS
31625
+ },
31626
+ stages: stages
31627
+ };
31628
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
31629
+ case 2:
31630
+ pipeline = (_a.jobs = _b.sent(), _a);
31631
+ return [2 /*return*/, pipeline];
31632
+ case 3:
31430
31633
  throw new Error("".concat(type, " is not supported"));
31431
31634
  }
31432
31635
  });
@@ -31436,7 +31639,7 @@ exports.createChildPipeline = createChildPipeline;
31436
31639
 
31437
31640
  /***/ }),
31438
31641
 
31439
- /***/ 1820:
31642
+ /***/ 5327:
31440
31643
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31441
31644
 
31442
31645
  "use strict";
@@ -31607,14 +31810,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
31607
31810
  return to.concat(ar || Array.prototype.slice.call(from));
31608
31811
  };
31609
31812
  exports.__esModule = true;
31610
- exports.createJobs = void 0;
31813
+ exports.createJobsForComponent = void 0;
31611
31814
  var lodash_1 = __nccwpck_require__(3255);
31612
31815
  var build_1 = __nccwpck_require__(2004);
31613
31816
  var context_1 = __nccwpck_require__(7123);
31614
31817
  var deploy_1 = __nccwpck_require__(1264);
31615
- var utils_1 = __nccwpck_require__(1815);
31616
31818
  var getCommitInfo_1 = __nccwpck_require__(802);
31617
- var makeGitlabJob_1 = __nccwpck_require__(726);
31618
31819
  var packageManager_1 = __nccwpck_require__(3214);
31619
31820
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
31620
31821
  return jobs.map(function (_a) {
@@ -31642,76 +31843,9 @@ var createRawJobs = function (context) {
31642
31843
  var customJobs = getCustomJobs(context);
31643
31844
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
31644
31845
  };
31645
- var getFullJobName = function (name, componentName, env) {
31646
- if (env) {
31647
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
31648
- }
31649
- return "".concat(componentName, " ").concat(name);
31650
- };
31651
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
31652
- var referencedJob = allRawJobs.find(function (j) {
31653
- return j.name === referencedJobName;
31654
- });
31655
- if (!referencedJob) {
31656
- throw new Error("unknown job referenced: " + referencedJobName);
31657
- }
31658
- var envToSet = referencedJob.envMode !== "none" ? env : null;
31659
- return getFullJobName(referencedJobName, componentName, envToSet);
31660
- };
31661
- // replaces references to other jobs with the full name
31662
- // the full name contains the componentname and the env name (if any)
31663
- var replaceReferences = function (job, componentName, env, allRawJobs) {
31664
- var _a, _b, _c;
31665
- var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
31666
- var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
31667
- return (0, lodash_1.isObject)(n) ? {
31668
- job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
31669
- artifacts: n.artifacts
31670
- } : getFullReferencedJobName(n, componentName, env, allRawJobs);
31671
- });
31672
- var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
31673
- return {
31674
- artifacts: other.artifacts,
31675
- job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
31676
- };
31677
- });
31678
- var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
31679
- return __assign(__assign({}, job), {
31680
- stage: stage,
31681
- needs: needs,
31682
- environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
31683
- on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
31684
- }) : job.environment
31685
- });
31686
- };
31687
- // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
31688
- var addStageNeeds = function (jobs) {
31689
- // when a job defines needsStages, we add these as needs
31690
- return jobs.map(function (job) {
31691
- var _a;
31692
- if (!job.needsStages || job.needsStages.length === 0) {
31693
- return job;
31694
- }
31695
- var neededJobs = jobs.map(function (j) {
31696
- var _a, _b;
31697
- var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
31698
- return j.stage === s.stage;
31699
- });
31700
- if (neededStage) {
31701
- return {
31702
- job: j.name,
31703
- artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
31704
- };
31705
- }
31706
- }).filter(utils_1.notNil);
31707
- return __assign(__assign({}, job), {
31708
- needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
31709
- });
31710
- });
31711
- };
31712
- var createJobs = function (type, envs, config, componentName, trigger) {
31846
+ var createJobsForComponent = function (config, componentName, env, trigger) {
31713
31847
  return __awaiter(void 0, void 0, void 0, function () {
31714
- var commitInfo, _a, packageManagerInfo;
31848
+ var commitInfo, _a, packageManagerInfo, context;
31715
31849
  return __generator(this, function (_b) {
31716
31850
  switch (_b.label) {
31717
31851
  case 0:
@@ -31724,47 +31858,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
31724
31858
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
31725
31859
  case 2:
31726
31860
  packageManagerInfo = _b.sent();
31727
- return [2 /*return*/, envs.reduce(function (acc, env) {
31728
- return __awaiter(void 0, void 0, void 0, function () {
31729
- var context, jobs, result, _a, _b, _c, _d, _e;
31730
- return __generator(this, function (_f) {
31731
- switch (_f.label) {
31732
- case 0:
31733
- return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
31734
- case 1:
31735
- context = _f.sent();
31736
- jobs = addStageNeeds(createRawJobs(context));
31737
- _a = [{}];
31738
- return [4 /*yield*/, acc];
31739
- case 2:
31740
- _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
31741
- _d = (_c = jobs).reduce;
31742
- _e = [function (acc, job) {
31743
- var _a;
31744
- var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
31745
- var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
31746
- if (type === "gitlab") {
31747
- return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
31748
- }
31749
- throw new Error("not supported");
31750
- }];
31751
- return [4 /*yield*/, Promise.resolve({})];
31752
- case 3:
31753
- result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
31754
- return [2 /*return*/, result];
31755
- }
31756
- });
31757
- });
31758
- }, {})];
31861
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
31862
+ case 3:
31863
+ context = _b.sent();
31864
+ return [2 /*return*/, createRawJobs(context)];
31759
31865
  }
31760
31866
  });
31761
31867
  });
31762
31868
  };
31763
- exports.createJobs = createJobs;
31869
+ exports.createJobsForComponent = createJobsForComponent;
31764
31870
 
31765
31871
  /***/ }),
31766
31872
 
31767
- /***/ 726:
31873
+ /***/ 5569:
31768
31874
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31769
31875
 
31770
31876
  "use strict";
@@ -31780,6 +31886,121 @@ var __assign = this && this.__assign || function () {
31780
31886
  };
31781
31887
  return __assign.apply(this, arguments);
31782
31888
  };
31889
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31890
+ function adopt(value) {
31891
+ return value instanceof P ? value : new P(function (resolve) {
31892
+ resolve(value);
31893
+ });
31894
+ }
31895
+ return new (P || (P = Promise))(function (resolve, reject) {
31896
+ function fulfilled(value) {
31897
+ try {
31898
+ step(generator.next(value));
31899
+ } catch (e) {
31900
+ reject(e);
31901
+ }
31902
+ }
31903
+ function rejected(value) {
31904
+ try {
31905
+ step(generator["throw"](value));
31906
+ } catch (e) {
31907
+ reject(e);
31908
+ }
31909
+ }
31910
+ function step(result) {
31911
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
31912
+ }
31913
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
31914
+ });
31915
+ };
31916
+ var __generator = this && this.__generator || function (thisArg, body) {
31917
+ var _ = {
31918
+ label: 0,
31919
+ sent: function () {
31920
+ if (t[0] & 1) throw t[1];
31921
+ return t[1];
31922
+ },
31923
+ trys: [],
31924
+ ops: []
31925
+ },
31926
+ f,
31927
+ y,
31928
+ t,
31929
+ g;
31930
+ return g = {
31931
+ next: verb(0),
31932
+ "throw": verb(1),
31933
+ "return": verb(2)
31934
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
31935
+ return this;
31936
+ }), g;
31937
+ function verb(n) {
31938
+ return function (v) {
31939
+ return step([n, v]);
31940
+ };
31941
+ }
31942
+ function step(op) {
31943
+ if (f) throw new TypeError("Generator is already executing.");
31944
+ while (_) try {
31945
+ 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;
31946
+ if (y = 0, t) op = [op[0] & 2, t.value];
31947
+ switch (op[0]) {
31948
+ case 0:
31949
+ case 1:
31950
+ t = op;
31951
+ break;
31952
+ case 4:
31953
+ _.label++;
31954
+ return {
31955
+ value: op[1],
31956
+ done: false
31957
+ };
31958
+ case 5:
31959
+ _.label++;
31960
+ y = op[1];
31961
+ op = [0];
31962
+ continue;
31963
+ case 7:
31964
+ op = _.ops.pop();
31965
+ _.trys.pop();
31966
+ continue;
31967
+ default:
31968
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
31969
+ _ = 0;
31970
+ continue;
31971
+ }
31972
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
31973
+ _.label = op[1];
31974
+ break;
31975
+ }
31976
+ if (op[0] === 6 && _.label < t[1]) {
31977
+ _.label = t[1];
31978
+ t = op;
31979
+ break;
31980
+ }
31981
+ if (t && _.label < t[2]) {
31982
+ _.label = t[2];
31983
+ _.ops.push(op);
31984
+ break;
31985
+ }
31986
+ if (t[2]) _.ops.pop();
31987
+ _.trys.pop();
31988
+ continue;
31989
+ }
31990
+ op = body.call(thisArg, _);
31991
+ } catch (e) {
31992
+ op = [6, e];
31993
+ y = 0;
31994
+ } finally {
31995
+ f = t = 0;
31996
+ }
31997
+ if (op[0] & 5) throw op[1];
31998
+ return {
31999
+ value: op[0] ? op[1] : void 0,
32000
+ done: true
32001
+ };
32002
+ }
32003
+ };
31783
32004
  var __rest = this && this.__rest || function (s, e) {
31784
32005
  var t = {};
31785
32006
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -31788,30 +32009,131 @@ var __rest = this && this.__rest || function (s, e) {
31788
32009
  }
31789
32010
  return t;
31790
32011
  };
32012
+ var __read = this && this.__read || function (o, n) {
32013
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
32014
+ if (!m) return o;
32015
+ var i = m.call(o),
32016
+ r,
32017
+ ar = [],
32018
+ e;
32019
+ try {
32020
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
32021
+ } catch (error) {
32022
+ e = {
32023
+ error: error
32024
+ };
32025
+ } finally {
32026
+ try {
32027
+ if (r && !r.done && (m = i["return"])) m.call(i);
32028
+ } finally {
32029
+ if (e) throw e.error;
32030
+ }
32031
+ }
32032
+ return ar;
32033
+ };
32034
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
32035
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
32036
+ if (ar || !(i in from)) {
32037
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32038
+ ar[i] = from[i];
32039
+ }
32040
+ }
32041
+ return to.concat(ar || Array.prototype.slice.call(from));
32042
+ };
31791
32043
  exports.__esModule = true;
31792
- exports.makeGitlabJob = void 0;
32044
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
31793
32045
  var lodash_1 = __nccwpck_require__(3255);
31794
32046
  var defaults_1 = __nccwpck_require__(7328);
32047
+ var getFullJobName = function (name, componentName, env) {
32048
+ if (env) {
32049
+ return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
32050
+ }
32051
+ return "".concat(componentName, " ").concat(name);
32052
+ };
32053
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
32054
+ var _a, _b;
32055
+ var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
32056
+ return j.name === referencedJobName;
32057
+ });
32058
+ if (!referencedJob) {
32059
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
32060
+ }
32061
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
32062
+ return getFullJobName(referencedJobName, componentName, envToSet);
32063
+ };
31795
32064
  var getJobName = function (need) {
31796
32065
  return (0, lodash_1.isObject)(need) ? need.job : need;
31797
32066
  };
31798
- var makeGitlabJob = function (_a) {
32067
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
32068
+ var _b;
31799
32069
  var envMode = _a.envMode,
31800
32070
  needsStages = _a.needsStages,
31801
32071
  needsOtherComponent = _a.needsOtherComponent,
31802
32072
  name = _a.name,
31803
32073
  needs = _a.needs,
31804
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
31805
- return __assign(__assign({}, rest), {
32074
+ job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
32075
+ var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
32076
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
32077
+ var _a, _b, _c, _d;
32078
+ var referencedComponentName = componentName;
32079
+ 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) {
32080
+ return j.stage === n.stage;
32081
+ })) === null || _c === void 0 ? void 0 : _c.map(function (j) {
32082
+ return j.name;
32083
+ })) !== null && _d !== void 0 ? _d : [];
32084
+ return allJobNamesFromThatStage.map(function (job) {
32085
+ var _a;
32086
+ return {
32087
+ job: job,
32088
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
32089
+ componentName: referencedComponentName
32090
+ };
32091
+ });
32092
+ });
32093
+ 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);
32094
+ var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
32095
+ var _a;
32096
+ return (0, lodash_1.isObject)(n) ? {
32097
+ job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
32098
+ artifacts: n.artifacts
32099
+ } : getFullReferencedJobName(n, componentName, env, allJobs);
32100
+ }).sort(function (a, b) {
32101
+ return getJobName(a).localeCompare(getJobName(b));
32102
+ });
32103
+ var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
32104
+ var gitlabJob = __assign(__assign({}, job), {
32105
+ stage: stage,
32106
+ environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
32107
+ on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
32108
+ }) : job.environment,
31806
32109
  // sort in a predictable manner for snapshot tests
31807
- needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
31808
- return getJobName(a).localeCompare(getJobName(b));
31809
- }),
32110
+ needs: gitlabNeeds,
31810
32111
  retry: defaults_1.BASE_RETRY,
31811
32112
  interruptible: true
31812
32113
  });
32114
+ return [fullJobName, gitlabJob];
31813
32115
  };
31814
32116
  exports.makeGitlabJob = makeGitlabJob;
32117
+ var createGitlabJobs = function (allJobs) {
32118
+ return __awaiter(void 0, void 0, void 0, function () {
32119
+ return __generator(this, function (_a) {
32120
+ return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
32121
+ var componentJobs = allJobs[componentName];
32122
+ return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
32123
+ var jobs = componentJobs[env];
32124
+ return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
32125
+ var _a;
32126
+ var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
32127
+ fullJobName = _b[0],
32128
+ gitlabJob = _b[1];
32129
+ return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
32130
+ }, {}));
32131
+ }, {}));
32132
+ }, {})];
32133
+ });
32134
+ });
32135
+ };
32136
+ exports.createGitlabJobs = createGitlabJobs;
31815
32137
 
31816
32138
  /***/ }),
31817
32139
 
@@ -31838,7 +32160,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
31838
32160
  };
31839
32161
  exports.__esModule = true;
31840
32162
  __exportStar(__nccwpck_require__(4244), exports);
31841
- __exportStar(__nccwpck_require__(1820), exports);
32163
+ __exportStar(__nccwpck_require__(5327), exports);
31842
32164
 
31843
32165
  /***/ }),
31844
32166