@catladder/pipeline 0.0.0-fix-command-710f75f1 → 0.0.0-fix-error-sql-db-delete-a719775a

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 (98) 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 +543 -218
  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/custom/deployJob.js +6 -3
  18. package/dist/deploy/index.d.ts +2 -1
  19. package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  20. package/dist/deploy/kubernetes/additionalSecretKeys.js +5 -1
  21. package/dist/deploy/kubernetes/deployJob.js +4 -4
  22. package/dist/deploy/kubernetes/kubeValues.d.ts +1 -0
  23. package/dist/deploy/kubernetes/kubeValues.js +9 -6
  24. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +1 -0
  25. package/dist/deploy/types/custom.d.ts +2 -1
  26. package/dist/deploy/types/googleCloudRun.d.ts +5 -1
  27. package/dist/deploy/types/kubernetes.d.ts +9 -0
  28. package/dist/pipeline/createAllJobs.d.ts +8 -0
  29. package/dist/pipeline/createAllJobs.js +164 -0
  30. package/dist/pipeline/createChildPipeline.js +24 -48
  31. package/dist/pipeline/createJobsForComponent.d.ts +3 -0
  32. package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +8 -105
  33. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
  34. package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
  35. package/dist/pipeline/index.d.ts +1 -1
  36. package/dist/pipeline/index.js +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/dist/types/config.d.ts +3 -3
  39. package/dist/types/context.d.ts +3 -1
  40. package/dist/types/environmentContext.d.ts +7 -0
  41. package/dist/types/gitlab-types.d.ts +5 -1
  42. package/dist/types/jobs.d.ts +9 -2
  43. package/dist/utils/gitlab.js +1 -1
  44. package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +32 -32
  45. package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +32 -32
  46. package/examples/__snapshots__/cloud-run-non-public.ts.snap +32 -32
  47. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3116 -0
  48. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +64 -64
  49. package/examples/__snapshots__/custom-build-job.ts.snap +32 -32
  50. package/examples/__snapshots__/custom-deploy.ts.snap +1384 -0
  51. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
  52. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +2204 -0
  53. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
  54. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
  55. package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
  56. package/examples/custom-deploy.ts +25 -0
  57. package/examples/kubernetes-application-customization.ts +57 -0
  58. package/examples/kubernetes-with-cloud-sql-legacy.ts +33 -0
  59. package/examples/rails-k8s-with-worker.ts +95 -0
  60. package/package.json +1 -1
  61. package/src/build/custom/buildJob.ts +1 -0
  62. package/src/build/docker.ts +13 -6
  63. package/src/build/index.ts +7 -1
  64. package/src/build/node/cache.ts +2 -2
  65. package/src/build/rails/build.ts +20 -10
  66. package/src/build/rails/index.ts +2 -2
  67. package/src/build/rails/test.ts +43 -39
  68. package/src/build/types.ts +40 -5
  69. package/src/config/configruedEnvs.ts +2 -8
  70. package/src/context/getEnvironment.ts +1 -0
  71. package/src/context/getEnvironmentContext.ts +6 -6
  72. package/src/context/getEnvironmentVariables.ts +9 -4
  73. package/src/deploy/base.ts +1 -1
  74. package/src/deploy/cloudRun/deployJob.ts +1 -1
  75. package/src/deploy/cloudRun/index.ts +12 -4
  76. package/src/deploy/custom/deployJob.ts +9 -1
  77. package/src/deploy/index.ts +4 -1
  78. package/src/deploy/kubernetes/additionalSecretKeys.ts +1 -1
  79. package/src/deploy/kubernetes/deployJob.ts +2 -1
  80. package/src/deploy/kubernetes/kubeValues.ts +7 -5
  81. package/src/deploy/types/custom.ts +2 -1
  82. package/src/deploy/types/googleCloudRun.ts +6 -1
  83. package/src/deploy/types/kubernetes.ts +11 -1
  84. package/src/pipeline/createAllJobs.ts +38 -0
  85. package/src/pipeline/createChildPipeline.ts +6 -22
  86. package/src/pipeline/createJobsForComponent.ts +64 -0
  87. package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
  88. package/src/pipeline/index.ts +1 -1
  89. package/src/types/context.ts +3 -1
  90. package/src/types/environmentContext.ts +7 -0
  91. package/src/types/gitlab-types.ts +10 -3
  92. package/src/types/jobs.ts +11 -2
  93. package/src/utils/gitlab.ts +1 -1
  94. package/dist/pipeline/createJobs.d.ts +0 -3
  95. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -10
  96. package/dist/pipeline/gitlab/makeGitlabJob.js +0 -44
  97. package/src/pipeline/createJobs.ts +0 -199
  98. 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 = "fix-error-sql-db-delete-a719775a" || 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;
@@ -30026,7 +30075,7 @@ var runner_1 = __nccwpck_require__(7666);
30026
30075
  var base_1 = __nccwpck_require__(1188);
30027
30076
  var types_1 = __nccwpck_require__(4436);
30028
30077
  var createCustomDeployJobs = function (context) {
30029
- var _a, _b;
30078
+ var _a, _b, _c;
30030
30079
  var deployConfig = context.componentConfig.deploy;
30031
30080
  if (deployConfig === false) {
30032
30081
  return [];
@@ -30037,11 +30086,14 @@ var createCustomDeployJobs = function (context) {
30037
30086
  }
30038
30087
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
30039
30088
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
30040
- return [(0, lodash_1.merge)({}, baseDeploymentJob, {
30089
+ return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
30041
30090
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
30042
30091
  cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
30043
30092
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
30044
- })];
30093
+ })], __read(deployConfig.stopScript ? [(0, lodash_1.merge)({}, (0, base_1.getBaseDeploymentStopJob)(context), {
30094
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
30095
+ script: deployConfig.stopScript
30096
+ })] : []), false);
30045
30097
  };
30046
30098
  exports.createCustomDeployJobs = createCustomDeployJobs;
30047
30099
 
@@ -30191,7 +30243,11 @@ var additionalKubernetesSecretKeys = function (_a) {
30191
30243
  keys.push("POSTGRESQL_PASSWORD");
30192
30244
  keys.push("cloudsqlProxyCredentials");
30193
30245
  }
30194
- return keys;
30246
+ return keys.map(function (key) {
30247
+ return {
30248
+ key: key
30249
+ };
30250
+ });
30195
30251
  };
30196
30252
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
30197
30253
 
@@ -30291,7 +30347,7 @@ var base_1 = __nccwpck_require__(1188);
30291
30347
  var types_1 = __nccwpck_require__(4436);
30292
30348
  var kubeValues_1 = __nccwpck_require__(2830);
30293
30349
  var createKubernetesDeployJobs = function (context) {
30294
- var _a, _b;
30350
+ var _a, _b, _c;
30295
30351
  var deployConfig = context.componentConfig.deploy;
30296
30352
  if (deployConfig === false) {
30297
30353
  return [];
@@ -30315,10 +30371,10 @@ var createKubernetesDeployJobs = function (context) {
30315
30371
  quotingType: "'",
30316
30372
  forceQuotes: true
30317
30373
  }),
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(" "),
30374
+ HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
30375
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
30320
30376
  COMPONENT_NAME: context.componentName,
30321
- BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
30377
+ BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
30322
30378
  })
30323
30379
  };
30324
30380
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -30549,33 +30605,36 @@ var kubeEnv_1 = __nccwpck_require__(5296);
30549
30605
  var mongodb_1 = __nccwpck_require__(221);
30550
30606
  var processSecretsAsFiles_1 = __nccwpck_require__(5088);
30551
30607
  var createAppConfig = function (context, application) {
30552
- var _a, _b, _c;
30553
30608
  if (application === false) {
30554
30609
  return {
30555
30610
  enabled: false
30556
30611
  };
30557
30612
  }
30613
+ var _a = application !== null && application !== void 0 ? application : {},
30614
+ healthRoute = _a.healthRoute,
30615
+ command = _a.command,
30616
+ rest = __rest(_a, ["healthRoute", "command"]);
30558
30617
  return (0, utils_1.mergeWithMergingArrays)({
30559
30618
  host: context.environment.host,
30560
- command: context.componentConfig.build.startCommand,
30619
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
30561
30620
  livenessProbe: {
30562
30621
  httpGet: {
30563
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
30622
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
30564
30623
  }
30565
30624
  },
30566
30625
  readinessProbe: {
30567
30626
  httpGet: {
30568
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
30627
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
30569
30628
  }
30570
30629
  },
30571
30630
  startupProbe: {
30572
30631
  httpGet: {
30573
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
30632
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
30574
30633
  }
30575
30634
  }
30576
30635
  },
30577
30636
  // default
30578
- application // merge rest in
30637
+ rest // merge rest in
30579
30638
  );
30580
30639
  };
30581
30640
 
@@ -31211,22 +31270,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
31211
31270
 
31212
31271
  /***/ }),
31213
31272
 
31214
- /***/ 4244:
31273
+ /***/ 6579:
31215
31274
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31216
31275
 
31217
31276
  "use strict";
31218
31277
 
31219
31278
 
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];
31279
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31280
+ function adopt(value) {
31281
+ return value instanceof P ? value : new P(function (resolve) {
31282
+ resolve(value);
31283
+ });
31284
+ }
31285
+ return new (P || (P = Promise))(function (resolve, reject) {
31286
+ function fulfilled(value) {
31287
+ try {
31288
+ step(generator.next(value));
31289
+ } catch (e) {
31290
+ reject(e);
31291
+ }
31225
31292
  }
31226
- return t;
31227
- };
31228
- return __assign.apply(this, arguments);
31293
+ function rejected(value) {
31294
+ try {
31295
+ step(generator["throw"](value));
31296
+ } catch (e) {
31297
+ reject(e);
31298
+ }
31299
+ }
31300
+ function step(result) {
31301
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
31302
+ }
31303
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
31304
+ });
31229
31305
  };
31306
+ var __generator = this && this.__generator || function (thisArg, body) {
31307
+ var _ = {
31308
+ label: 0,
31309
+ sent: function () {
31310
+ if (t[0] & 1) throw t[1];
31311
+ return t[1];
31312
+ },
31313
+ trys: [],
31314
+ ops: []
31315
+ },
31316
+ f,
31317
+ y,
31318
+ t,
31319
+ g;
31320
+ return g = {
31321
+ next: verb(0),
31322
+ "throw": verb(1),
31323
+ "return": verb(2)
31324
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
31325
+ return this;
31326
+ }), g;
31327
+ function verb(n) {
31328
+ return function (v) {
31329
+ return step([n, v]);
31330
+ };
31331
+ }
31332
+ function step(op) {
31333
+ if (f) throw new TypeError("Generator is already executing.");
31334
+ while (_) try {
31335
+ 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;
31336
+ if (y = 0, t) op = [op[0] & 2, t.value];
31337
+ switch (op[0]) {
31338
+ case 0:
31339
+ case 1:
31340
+ t = op;
31341
+ break;
31342
+ case 4:
31343
+ _.label++;
31344
+ return {
31345
+ value: op[1],
31346
+ done: false
31347
+ };
31348
+ case 5:
31349
+ _.label++;
31350
+ y = op[1];
31351
+ op = [0];
31352
+ continue;
31353
+ case 7:
31354
+ op = _.ops.pop();
31355
+ _.trys.pop();
31356
+ continue;
31357
+ default:
31358
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
31359
+ _ = 0;
31360
+ continue;
31361
+ }
31362
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
31363
+ _.label = op[1];
31364
+ break;
31365
+ }
31366
+ if (op[0] === 6 && _.label < t[1]) {
31367
+ _.label = t[1];
31368
+ t = op;
31369
+ break;
31370
+ }
31371
+ if (t && _.label < t[2]) {
31372
+ _.label = t[2];
31373
+ _.ops.push(op);
31374
+ break;
31375
+ }
31376
+ if (t[2]) _.ops.pop();
31377
+ _.trys.pop();
31378
+ continue;
31379
+ }
31380
+ op = body.call(thisArg, _);
31381
+ } catch (e) {
31382
+ op = [6, e];
31383
+ y = 0;
31384
+ } finally {
31385
+ f = t = 0;
31386
+ }
31387
+ if (op[0] & 5) throw op[1];
31388
+ return {
31389
+ value: op[0] ? op[1] : void 0,
31390
+ done: true
31391
+ };
31392
+ }
31393
+ };
31394
+ exports.__esModule = true;
31395
+ exports.createAllJobs = void 0;
31396
+ var config_1 = __nccwpck_require__(8906);
31397
+ var createJobsForComponent_1 = __nccwpck_require__(5327);
31398
+ var createAllJobs = function (config, trigger) {
31399
+ return __awaiter(void 0, void 0, void 0, function () {
31400
+ var _a, _b;
31401
+ return __generator(this, function (_c) {
31402
+ switch (_c.label) {
31403
+ case 0:
31404
+ _b = (_a = Object).fromEntries;
31405
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
31406
+ return __awaiter(void 0, void 0, void 0, function () {
31407
+ var envs, _a, _b, _c;
31408
+ return __generator(this, function (_d) {
31409
+ switch (_d.label) {
31410
+ case 0:
31411
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
31412
+ _a = [componentName];
31413
+ _c = (_b = Object).fromEntries;
31414
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
31415
+ return __awaiter(void 0, void 0, void 0, function () {
31416
+ var _a;
31417
+ return __generator(this, function (_b) {
31418
+ switch (_b.label) {
31419
+ case 0:
31420
+ _a = [env];
31421
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
31422
+ case 1:
31423
+ return [2 /*return*/, _a.concat([_b.sent()])];
31424
+ }
31425
+ });
31426
+ });
31427
+ }))];
31428
+ case 1:
31429
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
31430
+ }
31431
+ });
31432
+ });
31433
+ }))];
31434
+ case 1:
31435
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
31436
+ }
31437
+ });
31438
+ });
31439
+ };
31440
+ exports.createAllJobs = createAllJobs;
31441
+
31442
+ /***/ }),
31443
+
31444
+ /***/ 4244:
31445
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31446
+
31447
+ "use strict";
31448
+
31449
+
31230
31450
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31231
31451
  function adopt(value) {
31232
31452
  return value instanceof P ? value : new P(function (resolve) {
@@ -31379,54 +31599,40 @@ var config_1 = __nccwpck_require__(8906);
31379
31599
  var rules_1 = __nccwpck_require__(1410);
31380
31600
  var runner_1 = __nccwpck_require__(7666);
31381
31601
  var jobs_1 = __nccwpck_require__(9072);
31382
- var createJobs_1 = __nccwpck_require__(1820);
31602
+ var createAllJobs_1 = __nccwpck_require__(6579);
31603
+ var createGitlabJobs_1 = __nccwpck_require__(5569);
31383
31604
  var createChildPipeline = function (type, trigger, config) {
31384
31605
  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) {
31606
+ var jobs, allEnvs, stages, pipeline;
31607
+ var _a;
31608
+ return __generator(this, function (_b) {
31609
+ switch (_b.label) {
31388
31610
  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({}))];
31611
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
31408
31612
  case 1:
31409
- jobs = _a.sent();
31613
+ jobs = _b.sent();
31410
31614
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
31411
31615
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
31412
31616
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
31413
31617
  return "".concat(baseStage, " ").concat(e);
31414
31618
  })), false);
31415
31619
  }, []);
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
- }
31620
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
31621
+ _a = {
31622
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
31623
+ variables: {
31624
+ FF_USE_FASTZIP: "true"
31625
+ },
31626
+ workflow: {
31627
+ rules: rules_1.RULES_ALWAYS
31628
+ },
31629
+ stages: stages
31630
+ };
31631
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
31632
+ case 2:
31633
+ pipeline = (_a.jobs = _b.sent(), _a);
31634
+ return [2 /*return*/, pipeline];
31635
+ case 3:
31430
31636
  throw new Error("".concat(type, " is not supported"));
31431
31637
  }
31432
31638
  });
@@ -31436,7 +31642,7 @@ exports.createChildPipeline = createChildPipeline;
31436
31642
 
31437
31643
  /***/ }),
31438
31644
 
31439
- /***/ 1820:
31645
+ /***/ 5327:
31440
31646
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31441
31647
 
31442
31648
  "use strict";
@@ -31607,14 +31813,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
31607
31813
  return to.concat(ar || Array.prototype.slice.call(from));
31608
31814
  };
31609
31815
  exports.__esModule = true;
31610
- exports.createJobs = void 0;
31816
+ exports.createJobsForComponent = void 0;
31611
31817
  var lodash_1 = __nccwpck_require__(3255);
31612
31818
  var build_1 = __nccwpck_require__(2004);
31613
31819
  var context_1 = __nccwpck_require__(7123);
31614
31820
  var deploy_1 = __nccwpck_require__(1264);
31615
- var utils_1 = __nccwpck_require__(1815);
31616
31821
  var getCommitInfo_1 = __nccwpck_require__(802);
31617
- var makeGitlabJob_1 = __nccwpck_require__(726);
31618
31822
  var packageManager_1 = __nccwpck_require__(3214);
31619
31823
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
31620
31824
  return jobs.map(function (_a) {
@@ -31642,76 +31846,9 @@ var createRawJobs = function (context) {
31642
31846
  var customJobs = getCustomJobs(context);
31643
31847
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
31644
31848
  };
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) {
31849
+ var createJobsForComponent = function (config, componentName, env, trigger) {
31713
31850
  return __awaiter(void 0, void 0, void 0, function () {
31714
- var commitInfo, _a, packageManagerInfo;
31851
+ var commitInfo, _a, packageManagerInfo, context;
31715
31852
  return __generator(this, function (_b) {
31716
31853
  switch (_b.label) {
31717
31854
  case 0:
@@ -31724,47 +31861,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
31724
31861
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
31725
31862
  case 2:
31726
31863
  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
- }, {})];
31864
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
31865
+ case 3:
31866
+ context = _b.sent();
31867
+ return [2 /*return*/, createRawJobs(context)];
31759
31868
  }
31760
31869
  });
31761
31870
  });
31762
31871
  };
31763
- exports.createJobs = createJobs;
31872
+ exports.createJobsForComponent = createJobsForComponent;
31764
31873
 
31765
31874
  /***/ }),
31766
31875
 
31767
- /***/ 726:
31876
+ /***/ 5569:
31768
31877
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31769
31878
 
31770
31879
  "use strict";
@@ -31780,6 +31889,121 @@ var __assign = this && this.__assign || function () {
31780
31889
  };
31781
31890
  return __assign.apply(this, arguments);
31782
31891
  };
31892
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31893
+ function adopt(value) {
31894
+ return value instanceof P ? value : new P(function (resolve) {
31895
+ resolve(value);
31896
+ });
31897
+ }
31898
+ return new (P || (P = Promise))(function (resolve, reject) {
31899
+ function fulfilled(value) {
31900
+ try {
31901
+ step(generator.next(value));
31902
+ } catch (e) {
31903
+ reject(e);
31904
+ }
31905
+ }
31906
+ function rejected(value) {
31907
+ try {
31908
+ step(generator["throw"](value));
31909
+ } catch (e) {
31910
+ reject(e);
31911
+ }
31912
+ }
31913
+ function step(result) {
31914
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
31915
+ }
31916
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
31917
+ });
31918
+ };
31919
+ var __generator = this && this.__generator || function (thisArg, body) {
31920
+ var _ = {
31921
+ label: 0,
31922
+ sent: function () {
31923
+ if (t[0] & 1) throw t[1];
31924
+ return t[1];
31925
+ },
31926
+ trys: [],
31927
+ ops: []
31928
+ },
31929
+ f,
31930
+ y,
31931
+ t,
31932
+ g;
31933
+ return g = {
31934
+ next: verb(0),
31935
+ "throw": verb(1),
31936
+ "return": verb(2)
31937
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
31938
+ return this;
31939
+ }), g;
31940
+ function verb(n) {
31941
+ return function (v) {
31942
+ return step([n, v]);
31943
+ };
31944
+ }
31945
+ function step(op) {
31946
+ if (f) throw new TypeError("Generator is already executing.");
31947
+ while (_) try {
31948
+ 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;
31949
+ if (y = 0, t) op = [op[0] & 2, t.value];
31950
+ switch (op[0]) {
31951
+ case 0:
31952
+ case 1:
31953
+ t = op;
31954
+ break;
31955
+ case 4:
31956
+ _.label++;
31957
+ return {
31958
+ value: op[1],
31959
+ done: false
31960
+ };
31961
+ case 5:
31962
+ _.label++;
31963
+ y = op[1];
31964
+ op = [0];
31965
+ continue;
31966
+ case 7:
31967
+ op = _.ops.pop();
31968
+ _.trys.pop();
31969
+ continue;
31970
+ default:
31971
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
31972
+ _ = 0;
31973
+ continue;
31974
+ }
31975
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
31976
+ _.label = op[1];
31977
+ break;
31978
+ }
31979
+ if (op[0] === 6 && _.label < t[1]) {
31980
+ _.label = t[1];
31981
+ t = op;
31982
+ break;
31983
+ }
31984
+ if (t && _.label < t[2]) {
31985
+ _.label = t[2];
31986
+ _.ops.push(op);
31987
+ break;
31988
+ }
31989
+ if (t[2]) _.ops.pop();
31990
+ _.trys.pop();
31991
+ continue;
31992
+ }
31993
+ op = body.call(thisArg, _);
31994
+ } catch (e) {
31995
+ op = [6, e];
31996
+ y = 0;
31997
+ } finally {
31998
+ f = t = 0;
31999
+ }
32000
+ if (op[0] & 5) throw op[1];
32001
+ return {
32002
+ value: op[0] ? op[1] : void 0,
32003
+ done: true
32004
+ };
32005
+ }
32006
+ };
31783
32007
  var __rest = this && this.__rest || function (s, e) {
31784
32008
  var t = {};
31785
32009
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -31788,30 +32012,131 @@ var __rest = this && this.__rest || function (s, e) {
31788
32012
  }
31789
32013
  return t;
31790
32014
  };
32015
+ var __read = this && this.__read || function (o, n) {
32016
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
32017
+ if (!m) return o;
32018
+ var i = m.call(o),
32019
+ r,
32020
+ ar = [],
32021
+ e;
32022
+ try {
32023
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
32024
+ } catch (error) {
32025
+ e = {
32026
+ error: error
32027
+ };
32028
+ } finally {
32029
+ try {
32030
+ if (r && !r.done && (m = i["return"])) m.call(i);
32031
+ } finally {
32032
+ if (e) throw e.error;
32033
+ }
32034
+ }
32035
+ return ar;
32036
+ };
32037
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
32038
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
32039
+ if (ar || !(i in from)) {
32040
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32041
+ ar[i] = from[i];
32042
+ }
32043
+ }
32044
+ return to.concat(ar || Array.prototype.slice.call(from));
32045
+ };
31791
32046
  exports.__esModule = true;
31792
- exports.makeGitlabJob = void 0;
32047
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
31793
32048
  var lodash_1 = __nccwpck_require__(3255);
31794
32049
  var defaults_1 = __nccwpck_require__(7328);
32050
+ var getFullJobName = function (name, componentName, env) {
32051
+ if (env) {
32052
+ return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
32053
+ }
32054
+ return "".concat(componentName, " ").concat(name);
32055
+ };
32056
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
32057
+ var _a, _b;
32058
+ var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
32059
+ return j.name === referencedJobName;
32060
+ });
32061
+ if (!referencedJob) {
32062
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
32063
+ }
32064
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
32065
+ return getFullJobName(referencedJobName, componentName, envToSet);
32066
+ };
31795
32067
  var getJobName = function (need) {
31796
32068
  return (0, lodash_1.isObject)(need) ? need.job : need;
31797
32069
  };
31798
- var makeGitlabJob = function (_a) {
32070
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
32071
+ var _b;
31799
32072
  var envMode = _a.envMode,
31800
32073
  needsStages = _a.needsStages,
31801
32074
  needsOtherComponent = _a.needsOtherComponent,
31802
32075
  name = _a.name,
31803
32076
  needs = _a.needs,
31804
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
31805
- return __assign(__assign({}, rest), {
32077
+ job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
32078
+ var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
32079
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
32080
+ var _a, _b, _c, _d;
32081
+ var referencedComponentName = componentName;
32082
+ 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) {
32083
+ return j.stage === n.stage;
32084
+ })) === null || _c === void 0 ? void 0 : _c.map(function (j) {
32085
+ return j.name;
32086
+ })) !== null && _d !== void 0 ? _d : [];
32087
+ return allJobNamesFromThatStage.map(function (job) {
32088
+ var _a;
32089
+ return {
32090
+ job: job,
32091
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
32092
+ componentName: referencedComponentName
32093
+ };
32094
+ });
32095
+ });
32096
+ 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);
32097
+ var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
32098
+ var _a;
32099
+ return (0, lodash_1.isObject)(n) ? {
32100
+ job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
32101
+ artifacts: n.artifacts
32102
+ } : getFullReferencedJobName(n, componentName, env, allJobs);
32103
+ }).sort(function (a, b) {
32104
+ return getJobName(a).localeCompare(getJobName(b));
32105
+ });
32106
+ var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
32107
+ var gitlabJob = __assign(__assign({}, job), {
32108
+ stage: stage,
32109
+ environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
32110
+ on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
32111
+ }) : job.environment,
31806
32112
  // 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
- }),
32113
+ needs: gitlabNeeds,
31810
32114
  retry: defaults_1.BASE_RETRY,
31811
32115
  interruptible: true
31812
32116
  });
32117
+ return [fullJobName, gitlabJob];
31813
32118
  };
31814
32119
  exports.makeGitlabJob = makeGitlabJob;
32120
+ var createGitlabJobs = function (allJobs) {
32121
+ return __awaiter(void 0, void 0, void 0, function () {
32122
+ return __generator(this, function (_a) {
32123
+ return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
32124
+ var componentJobs = allJobs[componentName];
32125
+ return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
32126
+ var jobs = componentJobs[env];
32127
+ return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
32128
+ var _a;
32129
+ var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
32130
+ fullJobName = _b[0],
32131
+ gitlabJob = _b[1];
32132
+ return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
32133
+ }, {}));
32134
+ }, {}));
32135
+ }, {})];
32136
+ });
32137
+ });
32138
+ };
32139
+ exports.createGitlabJobs = createGitlabJobs;
31815
32140
 
31816
32141
  /***/ }),
31817
32142
 
@@ -31838,7 +32163,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
31838
32163
  };
31839
32164
  exports.__esModule = true;
31840
32165
  __exportStar(__nccwpck_require__(4244), exports);
31841
- __exportStar(__nccwpck_require__(1820), exports);
32166
+ __exportStar(__nccwpck_require__(5327), exports);
31842
32167
 
31843
32168
  /***/ }),
31844
32169
 
@@ -32501,7 +32826,7 @@ var sanitizeForBashVariable = function (name) {
32501
32826
  };
32502
32827
  exports.sanitizeForBashVariable = sanitizeForBashVariable;
32503
32828
  var repeatOnFailure = function (command, options) {
32504
- return "\n until ".concat(command, " &> /dev/null\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
32829
+ return "\n until ".concat(command, "\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
32505
32830
  };
32506
32831
  exports.repeatOnFailure = repeatOnFailure;
32507
32832