@catladder/pipeline 0.0.0-fix-cloud-run-instance-number-619b31f2 → 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 (99) 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 +545 -219
  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/deployJob.js +2 -1
  17. package/dist/deploy/cloudRun/index.js +14 -6
  18. package/dist/deploy/custom/deployJob.js +6 -3
  19. package/dist/deploy/index.d.ts +2 -1
  20. package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  21. package/dist/deploy/kubernetes/additionalSecretKeys.js +5 -1
  22. package/dist/deploy/kubernetes/deployJob.js +4 -4
  23. package/dist/deploy/kubernetes/kubeValues.d.ts +1 -0
  24. package/dist/deploy/kubernetes/kubeValues.js +9 -6
  25. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +1 -0
  26. package/dist/deploy/types/custom.d.ts +2 -1
  27. package/dist/deploy/types/googleCloudRun.d.ts +5 -1
  28. package/dist/deploy/types/kubernetes.d.ts +9 -0
  29. package/dist/pipeline/createAllJobs.d.ts +8 -0
  30. package/dist/pipeline/createAllJobs.js +164 -0
  31. package/dist/pipeline/createChildPipeline.js +24 -48
  32. package/dist/pipeline/createJobsForComponent.d.ts +3 -0
  33. package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +8 -105
  34. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
  35. package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
  36. package/dist/pipeline/index.d.ts +1 -1
  37. package/dist/pipeline/index.js +1 -1
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/dist/types/config.d.ts +3 -3
  40. package/dist/types/context.d.ts +3 -1
  41. package/dist/types/environmentContext.d.ts +7 -0
  42. package/dist/types/gitlab-types.d.ts +5 -1
  43. package/dist/types/jobs.d.ts +9 -2
  44. package/dist/utils/gitlab.js +1 -1
  45. package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +32 -32
  46. package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +32 -32
  47. package/examples/__snapshots__/cloud-run-non-public.ts.snap +32 -32
  48. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3116 -0
  49. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +64 -64
  50. package/examples/__snapshots__/custom-build-job.ts.snap +36 -36
  51. package/examples/__snapshots__/custom-deploy.ts.snap +1384 -0
  52. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
  53. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +2204 -0
  54. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
  55. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
  56. package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
  57. package/examples/custom-deploy.ts +25 -0
  58. package/examples/kubernetes-application-customization.ts +57 -0
  59. package/examples/kubernetes-with-cloud-sql-legacy.ts +33 -0
  60. package/examples/rails-k8s-with-worker.ts +95 -0
  61. package/package.json +1 -1
  62. package/src/build/custom/buildJob.ts +1 -0
  63. package/src/build/docker.ts +13 -6
  64. package/src/build/index.ts +7 -1
  65. package/src/build/node/cache.ts +2 -2
  66. package/src/build/rails/build.ts +20 -10
  67. package/src/build/rails/index.ts +2 -2
  68. package/src/build/rails/test.ts +43 -39
  69. package/src/build/types.ts +40 -5
  70. package/src/config/configruedEnvs.ts +2 -8
  71. package/src/context/getEnvironment.ts +1 -0
  72. package/src/context/getEnvironmentContext.ts +6 -6
  73. package/src/context/getEnvironmentVariables.ts +9 -4
  74. package/src/deploy/base.ts +1 -1
  75. package/src/deploy/cloudRun/deployJob.ts +3 -2
  76. package/src/deploy/cloudRun/index.ts +12 -4
  77. package/src/deploy/custom/deployJob.ts +9 -1
  78. package/src/deploy/index.ts +4 -1
  79. package/src/deploy/kubernetes/additionalSecretKeys.ts +1 -1
  80. package/src/deploy/kubernetes/deployJob.ts +2 -1
  81. package/src/deploy/kubernetes/kubeValues.ts +7 -5
  82. package/src/deploy/types/custom.ts +2 -1
  83. package/src/deploy/types/googleCloudRun.ts +6 -1
  84. package/src/deploy/types/kubernetes.ts +11 -1
  85. package/src/pipeline/createAllJobs.ts +38 -0
  86. package/src/pipeline/createChildPipeline.ts +6 -22
  87. package/src/pipeline/createJobsForComponent.ts +64 -0
  88. package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
  89. package/src/pipeline/index.ts +1 -1
  90. package/src/types/context.ts +3 -1
  91. package/src/types/environmentContext.ts +7 -0
  92. package/src/types/gitlab-types.ts +10 -3
  93. package/src/types/jobs.ts +11 -2
  94. package/src/utils/gitlab.ts +1 -1
  95. package/dist/pipeline/createJobs.d.ts +0 -3
  96. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -10
  97. package/dist/pipeline/gitlab/makeGitlabJob.js +0 -44
  98. package/src/pipeline/createJobs.ts +0 -199
  99. 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-cloud-run-instance-number-619b31f2" || 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,
@@ -29582,7 +29623,8 @@ var createGoogleCloudRunDeployJobs = function (context) {
29582
29623
  var customConfig = service !== true ? service : undefined;
29583
29624
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
29584
29625
  var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
29585
- command: command ? '"' + command.split(" ").join(",") + '"' : undefined
29626
+ // command as empty string resets it to default (uses the image's entrypoint)
29627
+ command: command ? '"' + command.split(" ").join(",") + '"' : '""'
29586
29628
  }, commonDeployArgs), {
29587
29629
  "env-vars-file": "____envvars.yaml",
29588
29630
  "min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
@@ -29752,15 +29794,15 @@ var jobName_1 = __nccwpck_require__(9357);
29752
29794
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
29753
29795
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
29754
29796
  var getCloudSqlVariables = function (_a) {
29755
- var _b, _c, _d;
29797
+ var _b, _c, _d, _e;
29756
29798
  var deployConfigRaw = _a.deployConfigRaw,
29757
- environmentSlug = _a.environmentSlug,
29799
+ environmentSlugPrefix = _a.environmentSlugPrefix,
29758
29800
  env = _a.env,
29759
29801
  componentName = _a.componentName,
29760
29802
  fullConfig = _a.fullConfig;
29761
29803
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
29762
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
29763
- 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) {
29764
29806
  var _b = __read(_a, 2),
29765
29807
  key = _b[0],
29766
29808
  value = _b[1];
@@ -29769,7 +29811,7 @@ var getCloudSqlVariables = function (_a) {
29769
29811
  return {
29770
29812
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
29771
29813
  DB_NAME: DB_NAME,
29772
- 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",
29773
29815
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
29774
29816
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
29775
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)
@@ -29792,7 +29834,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
29792
29834
  return {};
29793
29835
  },
29794
29836
  additionalSecretKeys: function (ctx) {
29795
- 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);
29796
29846
  },
29797
29847
  getAdditionalEnvVars: function (ctx) {
29798
29848
  var _a;
@@ -30025,7 +30075,7 @@ var runner_1 = __nccwpck_require__(7666);
30025
30075
  var base_1 = __nccwpck_require__(1188);
30026
30076
  var types_1 = __nccwpck_require__(4436);
30027
30077
  var createCustomDeployJobs = function (context) {
30028
- var _a, _b;
30078
+ var _a, _b, _c;
30029
30079
  var deployConfig = context.componentConfig.deploy;
30030
30080
  if (deployConfig === false) {
30031
30081
  return [];
@@ -30036,11 +30086,14 @@ var createCustomDeployJobs = function (context) {
30036
30086
  }
30037
30087
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
30038
30088
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
30039
- return [(0, lodash_1.merge)({}, baseDeploymentJob, {
30089
+ return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
30040
30090
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
30041
30091
  cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
30042
30092
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
30043
- })];
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);
30044
30097
  };
30045
30098
  exports.createCustomDeployJobs = createCustomDeployJobs;
30046
30099
 
@@ -30190,7 +30243,11 @@ var additionalKubernetesSecretKeys = function (_a) {
30190
30243
  keys.push("POSTGRESQL_PASSWORD");
30191
30244
  keys.push("cloudsqlProxyCredentials");
30192
30245
  }
30193
- return keys;
30246
+ return keys.map(function (key) {
30247
+ return {
30248
+ key: key
30249
+ };
30250
+ });
30194
30251
  };
30195
30252
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
30196
30253
 
@@ -30290,7 +30347,7 @@ var base_1 = __nccwpck_require__(1188);
30290
30347
  var types_1 = __nccwpck_require__(4436);
30291
30348
  var kubeValues_1 = __nccwpck_require__(2830);
30292
30349
  var createKubernetesDeployJobs = function (context) {
30293
- var _a, _b;
30350
+ var _a, _b, _c;
30294
30351
  var deployConfig = context.componentConfig.deploy;
30295
30352
  if (deployConfig === false) {
30296
30353
  return [];
@@ -30314,10 +30371,10 @@ var createKubernetesDeployJobs = function (context) {
30314
30371
  quotingType: "'",
30315
30372
  forceQuotes: true
30316
30373
  }),
30317
- HELM_GITLAB_CHART_NAME: "the-panter-chart",
30318
- 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(" "),
30319
30376
  COMPONENT_NAME: context.componentName,
30320
- 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
30321
30378
  })
30322
30379
  };
30323
30380
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -30548,33 +30605,36 @@ var kubeEnv_1 = __nccwpck_require__(5296);
30548
30605
  var mongodb_1 = __nccwpck_require__(221);
30549
30606
  var processSecretsAsFiles_1 = __nccwpck_require__(5088);
30550
30607
  var createAppConfig = function (context, application) {
30551
- var _a, _b, _c;
30552
30608
  if (application === false) {
30553
30609
  return {
30554
30610
  enabled: false
30555
30611
  };
30556
30612
  }
30613
+ var _a = application !== null && application !== void 0 ? application : {},
30614
+ healthRoute = _a.healthRoute,
30615
+ command = _a.command,
30616
+ rest = __rest(_a, ["healthRoute", "command"]);
30557
30617
  return (0, utils_1.mergeWithMergingArrays)({
30558
30618
  host: context.environment.host,
30559
- command: context.componentConfig.build.startCommand,
30619
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
30560
30620
  livenessProbe: {
30561
30621
  httpGet: {
30562
- 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"
30563
30623
  }
30564
30624
  },
30565
30625
  readinessProbe: {
30566
30626
  httpGet: {
30567
- 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"
30568
30628
  }
30569
30629
  },
30570
30630
  startupProbe: {
30571
30631
  httpGet: {
30572
- 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"
30573
30633
  }
30574
30634
  }
30575
30635
  },
30576
30636
  // default
30577
- application // merge rest in
30637
+ rest // merge rest in
30578
30638
  );
30579
30639
  };
30580
30640
 
@@ -31210,22 +31270,183 @@ exports.getBaseCommitInfo = getBaseCommitInfo;
31210
31270
 
31211
31271
  /***/ }),
31212
31272
 
31213
- /***/ 4244:
31273
+ /***/ 6579:
31214
31274
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31215
31275
 
31216
31276
  "use strict";
31217
31277
 
31218
31278
 
31219
- var __assign = this && this.__assign || function () {
31220
- __assign = Object.assign || function (t) {
31221
- for (var s, i = 1, n = arguments.length; i < n; i++) {
31222
- s = arguments[i];
31223
- 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
+ }
31224
31292
  }
31225
- return t;
31226
- };
31227
- 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
+ });
31228
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
+
31229
31450
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
31230
31451
  function adopt(value) {
31231
31452
  return value instanceof P ? value : new P(function (resolve) {
@@ -31378,54 +31599,40 @@ var config_1 = __nccwpck_require__(8906);
31378
31599
  var rules_1 = __nccwpck_require__(1410);
31379
31600
  var runner_1 = __nccwpck_require__(7666);
31380
31601
  var jobs_1 = __nccwpck_require__(9072);
31381
- var createJobs_1 = __nccwpck_require__(1820);
31602
+ var createAllJobs_1 = __nccwpck_require__(6579);
31603
+ var createGitlabJobs_1 = __nccwpck_require__(5569);
31382
31604
  var createChildPipeline = function (type, trigger, config) {
31383
31605
  return __awaiter(void 0, void 0, void 0, function () {
31384
- var components, jobs, allEnvs, stages, pipeline;
31385
- return __generator(this, function (_a) {
31386
- switch (_a.label) {
31606
+ var jobs, allEnvs, stages, pipeline;
31607
+ var _a;
31608
+ return __generator(this, function (_b) {
31609
+ switch (_b.label) {
31387
31610
  case 0:
31388
- components = Object.keys(config.components);
31389
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
31390
- return __awaiter(void 0, void 0, void 0, function () {
31391
- var envs, _a, _b;
31392
- return __generator(this, function (_c) {
31393
- switch (_c.label) {
31394
- case 0:
31395
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
31396
- _a = [{}];
31397
- return [4 /*yield*/, acc];
31398
- case 1:
31399
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
31400
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
31401
- case 2:
31402
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
31403
- }
31404
- });
31405
- });
31406
- }, Promise.resolve({}))];
31611
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
31407
31612
  case 1:
31408
- jobs = _a.sent();
31613
+ jobs = _b.sent();
31409
31614
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
31410
31615
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
31411
31616
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
31412
31617
  return "".concat(baseStage, " ").concat(e);
31413
31618
  })), false);
31414
31619
  }, []);
31415
- if (type === "gitlab") {
31416
- pipeline = {
31417
- image: (0, runner_1.getRunnerImage)("jobs-default"),
31418
- variables: {
31419
- FF_USE_FASTZIP: "true"
31420
- },
31421
- workflow: {
31422
- rules: rules_1.RULES_ALWAYS
31423
- },
31424
- stages: stages,
31425
- jobs: jobs
31426
- };
31427
- return [2 /*return*/, pipeline];
31428
- }
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:
31429
31636
  throw new Error("".concat(type, " is not supported"));
31430
31637
  }
31431
31638
  });
@@ -31435,7 +31642,7 @@ exports.createChildPipeline = createChildPipeline;
31435
31642
 
31436
31643
  /***/ }),
31437
31644
 
31438
- /***/ 1820:
31645
+ /***/ 5327:
31439
31646
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31440
31647
 
31441
31648
  "use strict";
@@ -31606,14 +31813,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
31606
31813
  return to.concat(ar || Array.prototype.slice.call(from));
31607
31814
  };
31608
31815
  exports.__esModule = true;
31609
- exports.createJobs = void 0;
31816
+ exports.createJobsForComponent = void 0;
31610
31817
  var lodash_1 = __nccwpck_require__(3255);
31611
31818
  var build_1 = __nccwpck_require__(2004);
31612
31819
  var context_1 = __nccwpck_require__(7123);
31613
31820
  var deploy_1 = __nccwpck_require__(1264);
31614
- var utils_1 = __nccwpck_require__(1815);
31615
31821
  var getCommitInfo_1 = __nccwpck_require__(802);
31616
- var makeGitlabJob_1 = __nccwpck_require__(726);
31617
31822
  var packageManager_1 = __nccwpck_require__(3214);
31618
31823
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
31619
31824
  return jobs.map(function (_a) {
@@ -31641,76 +31846,9 @@ var createRawJobs = function (context) {
31641
31846
  var customJobs = getCustomJobs(context);
31642
31847
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
31643
31848
  };
31644
- var getFullJobName = function (name, componentName, env) {
31645
- if (env) {
31646
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
31647
- }
31648
- return "".concat(componentName, " ").concat(name);
31649
- };
31650
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
31651
- var referencedJob = allRawJobs.find(function (j) {
31652
- return j.name === referencedJobName;
31653
- });
31654
- if (!referencedJob) {
31655
- throw new Error("unknown job referenced: " + referencedJobName);
31656
- }
31657
- var envToSet = referencedJob.envMode !== "none" ? env : null;
31658
- return getFullJobName(referencedJobName, componentName, envToSet);
31659
- };
31660
- // replaces references to other jobs with the full name
31661
- // the full name contains the componentname and the env name (if any)
31662
- var replaceReferences = function (job, componentName, env, allRawJobs) {
31663
- var _a, _b, _c;
31664
- var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
31665
- var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
31666
- return (0, lodash_1.isObject)(n) ? {
31667
- job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
31668
- artifacts: n.artifacts
31669
- } : getFullReferencedJobName(n, componentName, env, allRawJobs);
31670
- });
31671
- var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
31672
- return {
31673
- artifacts: other.artifacts,
31674
- job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
31675
- };
31676
- });
31677
- var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
31678
- return __assign(__assign({}, job), {
31679
- stage: stage,
31680
- needs: needs,
31681
- environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
31682
- on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
31683
- }) : job.environment
31684
- });
31685
- };
31686
- // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
31687
- var addStageNeeds = function (jobs) {
31688
- // when a job defines needsStages, we add these as needs
31689
- return jobs.map(function (job) {
31690
- var _a;
31691
- if (!job.needsStages || job.needsStages.length === 0) {
31692
- return job;
31693
- }
31694
- var neededJobs = jobs.map(function (j) {
31695
- var _a, _b;
31696
- var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
31697
- return j.stage === s.stage;
31698
- });
31699
- if (neededStage) {
31700
- return {
31701
- job: j.name,
31702
- artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
31703
- };
31704
- }
31705
- }).filter(utils_1.notNil);
31706
- return __assign(__assign({}, job), {
31707
- needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
31708
- });
31709
- });
31710
- };
31711
- var createJobs = function (type, envs, config, componentName, trigger) {
31849
+ var createJobsForComponent = function (config, componentName, env, trigger) {
31712
31850
  return __awaiter(void 0, void 0, void 0, function () {
31713
- var commitInfo, _a, packageManagerInfo;
31851
+ var commitInfo, _a, packageManagerInfo, context;
31714
31852
  return __generator(this, function (_b) {
31715
31853
  switch (_b.label) {
31716
31854
  case 0:
@@ -31723,47 +31861,19 @@ var createJobs = function (type, envs, config, componentName, trigger) {
31723
31861
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
31724
31862
  case 2:
31725
31863
  packageManagerInfo = _b.sent();
31726
- return [2 /*return*/, envs.reduce(function (acc, env) {
31727
- return __awaiter(void 0, void 0, void 0, function () {
31728
- var context, jobs, result, _a, _b, _c, _d, _e;
31729
- return __generator(this, function (_f) {
31730
- switch (_f.label) {
31731
- case 0:
31732
- return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
31733
- case 1:
31734
- context = _f.sent();
31735
- jobs = addStageNeeds(createRawJobs(context));
31736
- _a = [{}];
31737
- return [4 /*yield*/, acc];
31738
- case 2:
31739
- _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
31740
- _d = (_c = jobs).reduce;
31741
- _e = [function (acc, job) {
31742
- var _a;
31743
- var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
31744
- var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
31745
- if (type === "gitlab") {
31746
- return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
31747
- }
31748
- throw new Error("not supported");
31749
- }];
31750
- return [4 /*yield*/, Promise.resolve({})];
31751
- case 3:
31752
- result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
31753
- return [2 /*return*/, result];
31754
- }
31755
- });
31756
- });
31757
- }, {})];
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)];
31758
31868
  }
31759
31869
  });
31760
31870
  });
31761
31871
  };
31762
- exports.createJobs = createJobs;
31872
+ exports.createJobsForComponent = createJobsForComponent;
31763
31873
 
31764
31874
  /***/ }),
31765
31875
 
31766
- /***/ 726:
31876
+ /***/ 5569:
31767
31877
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31768
31878
 
31769
31879
  "use strict";
@@ -31779,6 +31889,121 @@ var __assign = this && this.__assign || function () {
31779
31889
  };
31780
31890
  return __assign.apply(this, arguments);
31781
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
+ };
31782
32007
  var __rest = this && this.__rest || function (s, e) {
31783
32008
  var t = {};
31784
32009
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -31787,30 +32012,131 @@ var __rest = this && this.__rest || function (s, e) {
31787
32012
  }
31788
32013
  return t;
31789
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
+ };
31790
32046
  exports.__esModule = true;
31791
- exports.makeGitlabJob = void 0;
32047
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
31792
32048
  var lodash_1 = __nccwpck_require__(3255);
31793
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
+ };
31794
32067
  var getJobName = function (need) {
31795
32068
  return (0, lodash_1.isObject)(need) ? need.job : need;
31796
32069
  };
31797
- var makeGitlabJob = function (_a) {
32070
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
32071
+ var _b;
31798
32072
  var envMode = _a.envMode,
31799
32073
  needsStages = _a.needsStages,
31800
32074
  needsOtherComponent = _a.needsOtherComponent,
31801
32075
  name = _a.name,
31802
32076
  needs = _a.needs,
31803
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
31804
- 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,
31805
32112
  // sort in a predictable manner for snapshot tests
31806
- needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
31807
- return getJobName(a).localeCompare(getJobName(b));
31808
- }),
32113
+ needs: gitlabNeeds,
31809
32114
  retry: defaults_1.BASE_RETRY,
31810
32115
  interruptible: true
31811
32116
  });
32117
+ return [fullJobName, gitlabJob];
31812
32118
  };
31813
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;
31814
32140
 
31815
32141
  /***/ }),
31816
32142
 
@@ -31837,7 +32163,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
31837
32163
  };
31838
32164
  exports.__esModule = true;
31839
32165
  __exportStar(__nccwpck_require__(4244), exports);
31840
- __exportStar(__nccwpck_require__(1820), exports);
32166
+ __exportStar(__nccwpck_require__(5327), exports);
31841
32167
 
31842
32168
  /***/ }),
31843
32169
 
@@ -32500,7 +32826,7 @@ var sanitizeForBashVariable = function (name) {
32500
32826
  };
32501
32827
  exports.sanitizeForBashVariable = sanitizeForBashVariable;
32502
32828
  var repeatOnFailure = function (command, options) {
32503
- 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 ");
32504
32830
  };
32505
32831
  exports.repeatOnFailure = repeatOnFailure;
32506
32832