@catladder/cli 0.0.0-main-085e963c → 0.0.0-main-45f6e733

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 (103) hide show
  1. package/dist/bundles/catenv/index.js +233 -193
  2. package/dist/bundles/cli/index.js +351 -298
  3. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +22 -19
  4. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  5. package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js +10 -9
  6. package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
  7. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +18 -16
  8. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +1 -1
  9. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +10 -9
  10. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  11. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +9 -8
  12. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  13. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +23 -22
  14. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  15. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +10 -9
  16. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
  17. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js +6 -5
  18. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
  19. package/dist/cli/src/kubernetes/openKubernetesDashboards.js +10 -8
  20. package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
  21. package/dist/pipeline/src/build/base/createAppBuildJob.js +8 -6
  22. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  23. package/dist/pipeline/src/build/base/writeBuildInfo.js +1 -1
  24. package/dist/pipeline/src/build/base/writeBuildInfo.js.map +1 -1
  25. package/dist/pipeline/src/build/base/writeDotEnv.js +1 -1
  26. package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
  27. package/dist/pipeline/src/build/custom/buildJob.js +6 -6
  28. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  29. package/dist/pipeline/src/build/custom/testJob.js +5 -5
  30. package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
  31. package/dist/pipeline/src/build/docker.d.ts +26 -5
  32. package/dist/pipeline/src/build/docker.js +50 -17
  33. package/dist/pipeline/src/build/docker.js.map +1 -1
  34. package/dist/pipeline/src/build/node/buildJob.js +11 -11
  35. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  36. package/dist/pipeline/src/build/node/cache.js +1 -1
  37. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  38. package/dist/pipeline/src/build/node/meteor.js +10 -10
  39. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  40. package/dist/pipeline/src/build/node/testJob.js +12 -12
  41. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  42. package/dist/pipeline/src/build/rails/build.js +3 -3
  43. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  44. package/dist/pipeline/src/build/rails/test.js +4 -4
  45. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  46. package/dist/pipeline/src/build/sbom.js +3 -3
  47. package/dist/pipeline/src/build/sbom.js.map +1 -1
  48. package/dist/pipeline/src/build/types.d.ts +33 -25
  49. package/dist/pipeline/src/build/types.js.map +1 -1
  50. package/dist/pipeline/src/context/getLabels.js +1 -1
  51. package/dist/pipeline/src/context/getLabels.js.map +1 -1
  52. package/dist/pipeline/src/context/index.js +37 -15
  53. package/dist/pipeline/src/context/index.js.map +1 -1
  54. package/dist/pipeline/src/deploy/base/deploy.js +10 -17
  55. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  56. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.d.ts +1 -1
  57. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +8 -9
  58. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
  59. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js +4 -5
  60. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js.map +1 -1
  61. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +1 -1
  62. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
  63. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +4 -4
  64. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js +2 -1
  65. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
  66. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js +2 -4
  67. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js.map +1 -1
  68. package/dist/pipeline/src/deploy/custom/deployJob.js +7 -10
  69. package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
  70. package/dist/pipeline/src/deploy/dockerTag/deployJob.js +3 -5
  71. package/dist/pipeline/src/deploy/dockerTag/deployJob.js.map +1 -1
  72. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +11 -9
  73. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  74. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +3 -6
  75. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  76. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js +2 -1
  77. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js.map +1 -1
  78. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +6 -6
  79. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
  80. package/dist/pipeline/src/deploy/kubernetes/mongodb.js +11 -11
  81. package/dist/pipeline/src/deploy/kubernetes/mongodb.js.map +1 -1
  82. package/dist/pipeline/src/deploy/sbom.js +1 -2
  83. package/dist/pipeline/src/deploy/sbom.js.map +1 -1
  84. package/dist/pipeline/src/deploy/types/index.d.ts +1 -1
  85. package/dist/pipeline/src/deploy/types/index.js +1 -1
  86. package/dist/pipeline/src/deploy/types/index.js.map +1 -1
  87. package/dist/pipeline/src/deploy/utils.js +2 -1
  88. package/dist/pipeline/src/deploy/utils.js.map +1 -1
  89. package/dist/pipeline/src/pipeline/createJobsForComponent.js +6 -8
  90. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  91. package/dist/pipeline/src/types/config.d.ts +1 -1
  92. package/dist/pipeline/src/types/context.d.ts +13 -1
  93. package/dist/tsconfig.tsbuildinfo +1 -1
  94. package/package.json +1 -1
  95. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +6 -9
  96. package/src/apps/cli/commands/project/commandOpenDashboard.ts +2 -2
  97. package/src/apps/cli/commands/project/commandPortForward.ts +4 -4
  98. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
  99. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -2
  100. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +1 -1
  101. package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -4
  102. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
  103. package/src/kubernetes/openKubernetesDashboards.ts +2 -2
@@ -2267,17 +2267,19 @@ var createAppBuildJob = function (context, _a) {
2267
2267
  image: (0, __1.getRunnerImage)("jobs-default"),
2268
2268
  needs: [],
2269
2269
  cache: [],
2270
- variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {})),
2271
- runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.componentConfig.build.runnerVariables) !== null && _c !== void 0 ? _c : {})),
2270
+ variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {})),
2271
+ runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {})),
2272
2272
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.componentConfig.dotEnv === true // don't build when set to `local`
2273
2273
  ? (0, writeDotEnv_1.writeDotEnv)(context)
2274
- : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.buildContext)), false), [
2275
- "cd ".concat(context.componentConfig.dir)
2274
+ : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
2275
+ "cd ".concat(context.build.dir)
2276
2276
  ], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
2277
2277
  artifacts: {
2278
- paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
2278
+ paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
2279
2279
  reports: {
2280
- junit: (_f = (_e = context.componentConfig.build.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) { return (0, path_1.join)(context.componentConfig.dir, p); }),
2280
+ junit: (_f = (_e = context.build.config.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) {
2281
+ return (0, path_1.join)(context.build.dir, p);
2282
+ }),
2281
2283
  },
2282
2284
  },
2283
2285
  }, def);
@@ -2425,7 +2427,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
2425
2427
  exports.writeBuildInfo = void 0;
2426
2428
  var writeBuildInfo = function (context) {
2427
2429
  return [
2428
- "echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.componentConfig.dir, "/__build_info.json"),
2430
+ "echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.build.dir, "/__build_info.json"),
2429
2431
  ];
2430
2432
  };
2431
2433
  exports.writeBuildInfo = writeBuildInfo;
@@ -2477,7 +2479,7 @@ var writeDotEnv = function (context) {
2477
2479
  })
2478
2480
  .join("\n");
2479
2481
  return [
2480
- "cat <<EOF > ".concat(context.componentConfig.dir, "/.env\n").concat(keyValueString, "\nEOF"),
2482
+ "cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
2481
2483
  ];
2482
2484
  };
2483
2485
  exports.writeDotEnv = writeDotEnv;
@@ -2528,8 +2530,8 @@ var RUNNER_BUILD_VARIABLES = {
2528
2530
  KUBERNETES_MEMORY_LIMIT: "4Gi",
2529
2531
  };
2530
2532
  var createCustomBuildJobs = function (context) {
2531
- var _a, _b, _c, _d;
2532
- var buildConfig = context.componentConfig.build;
2533
+ var _a, _b, _c;
2534
+ var buildConfig = context.build.config;
2533
2535
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
2534
2536
  throw new Error("deploy config is not custom");
2535
2537
  }
@@ -2543,17 +2545,17 @@ var createCustomBuildJobs = function (context) {
2543
2545
  script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
2544
2546
  artifacts: {
2545
2547
  paths: __spreadArray([
2546
- (0, path_1.join)(context.componentConfig.dir, "__build_info.json"),
2547
- (0, path_1.join)(context.componentConfig.dir, "dist")
2548
+ (0, path_1.join)(context.build.dir, "__build_info.json"),
2549
+ (0, path_1.join)(context.build.dir, "dist")
2548
2550
  ], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
2549
- return (0, path_1.join)(context.componentConfig.dir, path);
2551
+ return (0, path_1.join)(context.build.dir, path);
2550
2552
  })) !== null && _c !== void 0 ? _c : [])), false),
2551
2553
  expire_in: "1 day",
2552
2554
  },
2553
2555
  }
2554
2556
  : undefined,
2555
2557
  dockerBuild: {
2556
- script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
2558
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
2557
2559
  variables: {},
2558
2560
  },
2559
2561
  });
@@ -2663,12 +2665,12 @@ var createCustomTestJobs = function (context) {
2663
2665
  if (context.trigger === "taggedRelease") {
2664
2666
  return [];
2665
2667
  }
2666
- var buildConfig = context.componentConfig.build;
2668
+ var buildConfig = context.build.config;
2667
2669
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
2668
2670
  throw new Error("deploy config is not custom");
2669
2671
  }
2670
2672
  var base = {
2671
- variables: __assign(__assign({ APP_PATH: context.componentConfig.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
2673
+ variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
2672
2674
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
2673
2675
  services: buildConfig.jobServices,
2674
2676
  cache: buildConfig.jobCache,
@@ -2677,11 +2679,11 @@ var createCustomTestJobs = function (context) {
2677
2679
  envMode: "none",
2678
2680
  };
2679
2681
  var auditJob = buildConfig.audit
2680
- ? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage, cache: undefined, script: __spreadArray([], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
2682
+ ? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage, cache: undefined, script: __spreadArray([], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
2681
2683
  var lintJob = buildConfig.lint
2682
- ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage, script: __spreadArray([], __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
2684
+ ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage, script: __spreadArray([], __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
2683
2685
  var testJob = buildConfig.test
2684
- ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage, script: __spreadArray([], __read(((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
2686
+ ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage, script: __spreadArray([], __read(((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
2685
2687
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
2686
2688
  };
2687
2689
  exports.createCustomTestJobs = createCustomTestJobs;
@@ -2745,22 +2747,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2745
2747
  return (mod && mod.__esModule) ? mod : { "default": mod };
2746
2748
  };
2747
2749
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2748
- exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
2749
- var lodash_1 = __nccwpck_require__(3255);
2750
- var deploy_1 = __nccwpck_require__(8483);
2751
- var runner_1 = __nccwpck_require__(4058);
2750
+ exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
2752
2751
  var fs_1 = __nccwpck_require__(7147);
2752
+ var lodash_1 = __nccwpck_require__(3255);
2753
2753
  var path_1 = __importDefault(__nccwpck_require__(1017));
2754
- var gitlab_1 = __nccwpck_require__(8490);
2754
+ var deploy_1 = __nccwpck_require__(8483);
2755
2755
  var artifactsRegistry_1 = __nccwpck_require__(4963);
2756
2756
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(6320);
2757
+ var runner_1 = __nccwpck_require__(4058);
2758
+ var gitlab_1 = __nccwpck_require__(8490);
2757
2759
  var DOCKER_BUILD_RUNNER_REQUESTS = {
2758
2760
  KUBERNETES_CPU_REQUEST: "0.5",
2759
2761
  KUBERNETES_MEMORY_REQUEST: "1Gi",
2760
2762
  KUBERNETES_MEMORY_LIMIT: "2Gi",
2761
2763
  };
2762
2764
  var getDockerImageVariables = function (context) {
2763
- return __assign(__assign({}, ((0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")
2765
+ var _a;
2766
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
2767
+ return __assign(__assign({}, ((0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun")
2764
2768
  ? {
2765
2769
  DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
2766
2770
  DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
@@ -2779,10 +2783,11 @@ exports.getDockerImageVariables = getDockerImageVariables;
2779
2783
  /**
2780
2784
  * Weather the context requires a docker build
2781
2785
  */
2782
- var requiresDockerBuild = function (_a) {
2783
- var deploy = _a.componentConfig.deploy;
2784
- return (0, deploy_1.isOfDeployType)(deploy, "kubernetes", "google-cloudrun", "dockerTag") ||
2785
- ((0, deploy_1.isOfDeployType)(deploy, "custom") && deploy.requiresDocker);
2786
+ var requiresDockerBuild = function (context) {
2787
+ var _a;
2788
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
2789
+ return ((0, deploy_1.isOfDeployType)(deployConfig, "kubernetes", "google-cloudrun", "dockerTag") ||
2790
+ ((0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker));
2786
2791
  };
2787
2792
  exports.requiresDockerBuild = requiresDockerBuild;
2788
2793
  // those need to be runner variables
@@ -2792,13 +2797,27 @@ var getDockerBuildRunnerVariables = function () { return ({
2792
2797
  DOCKER_DRIVER: "overlay2",
2793
2798
  DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
2794
2799
  }); };
2800
+ var getDockerAdditions = function (build) {
2801
+ var _a, _b;
2802
+ if (!("docker" in build))
2803
+ return {};
2804
+ if (!build.docker)
2805
+ return {};
2806
+ return {
2807
+ DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker
2808
+ ? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n")
2809
+ : undefined,
2810
+ DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker
2811
+ ? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n")
2812
+ : undefined,
2813
+ };
2814
+ };
2795
2815
  var getDockerBuildVariables = function (context) {
2796
- var _a, _b, _c, _d;
2797
- return __assign({ 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"), 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"), APP_DIR: context.componentConfig.dir, DOCKER_DIR: "." }, (0, exports.getDockerImageVariables)(context));
2816
+ return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
2798
2817
  };
2799
2818
  exports.getDockerBuildVariables = getDockerBuildVariables;
2800
2819
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
2801
- var getDockerJobBaseProps = function (context) {
2820
+ var getDockerJobBaseProps = function () {
2802
2821
  return {
2803
2822
  image: (0, runner_1.getRunnerImage)("docker-build"),
2804
2823
  services: [
@@ -2814,14 +2833,14 @@ var getDockerJobBaseProps = function (context) {
2814
2833
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
2815
2834
  var createDockerBuildJobBase = function (context, _a) {
2816
2835
  var script = _a.script, def = __rest(_a, ["script"]);
2817
- return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)(context)), { script: script || [] }), {
2836
+ return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)()), { script: script || [] }), {
2818
2837
  variables: (0, exports.getDockerBuildVariables)(context),
2819
2838
  runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
2820
2839
  }, def);
2821
2840
  };
2822
2841
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
2823
2842
  var gitlabDockerLogin = function (context) {
2824
- return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")
2843
+ return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
2825
2844
  ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
2826
2845
  "gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
2827
2846
  ], false) : [
@@ -2829,9 +2848,25 @@ var gitlabDockerLogin = function (context) {
2829
2848
  ];
2830
2849
  };
2831
2850
  exports.gitlabDockerLogin = gitlabDockerLogin;
2851
+ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
2852
+ meteor: "ensureMeteorDockerfile",
2853
+ node: "ensureNodeDockerfile",
2854
+ nginx: "ensureNginxDockerfile",
2855
+ custom: null,
2856
+ };
2857
+ var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
2858
+ var _a;
2859
+ var type = "docker" in context.componentConfig.build &&
2860
+ context.componentConfig.build.docker &&
2861
+ "type" in context.componentConfig.build.docker
2862
+ ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
2863
+ : defaultType;
2864
+ return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
2865
+ };
2866
+ exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
2832
2867
  var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
2833
2868
  return __spreadArray(__spreadArray(__spreadArray([
2834
- ensureDockerFileScript
2869
+ ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined
2835
2870
  ], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")([
2836
2871
  "docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
2837
2872
  ])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")([
@@ -2842,7 +2877,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
2842
2877
  };
2843
2878
  exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
2844
2879
  var hasDockerfile = function (context) {
2845
- return (0, fs_1.existsSync)(path_1.default.join(context.componentConfig.dir, "Dockerfile"));
2880
+ return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
2846
2881
  };
2847
2882
  exports.hasDockerfile = hasDockerfile;
2848
2883
  //# sourceMappingURL=docker.js.map
@@ -2963,23 +2998,23 @@ var constants_1 = __nccwpck_require__(1765);
2963
2998
  var yarn_1 = __nccwpck_require__(5043);
2964
2999
  var createNodeBuildJobs = function (context) {
2965
3000
  var _a, _b, _c, _d, _e, _f, _g;
2966
- var buildConfig = context.componentConfig.build;
3001
+ var buildConfig = context.build.config;
2967
3002
  if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
2968
3003
  throw new Error("deploy config is not node, node-static or storybook");
2969
3004
  }
2970
3005
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
2971
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext);
3006
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
2972
3007
  return (0, base_1.createBuildJobs)(context, {
2973
3008
  appBuild: buildConfig.buildCommand !== null
2974
3009
  ? {
2975
3010
  image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
2976
3011
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
2977
- cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.buildContext)), false), __read((0, cache_1.getNextCache)(context)), false),
3012
+ cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.build)), false), __read((0, cache_1.getNextCache)(context)), false),
2978
3013
  script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
2979
3014
  artifacts: {
2980
3015
  paths: __spreadArray([
2981
- context.componentConfig.dir
2982
- ], __read(((_e = (_d = context.buildContext.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
3016
+ context.build.dir
3017
+ ], __read(((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
2983
3018
  var _a, _b;
2984
3019
  return __spreadArray([
2985
3020
  (0, path_1.join)(dir, "__build_info.json"),
@@ -2996,14 +3031,14 @@ var createNodeBuildJobs = function (context) {
2996
3031
  }
2997
3032
  : undefined,
2998
3033
  dockerBuild: {
2999
- script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
3000
- ? "ensureNginxDockerfile"
3001
- : "ensureNodeDockerfile"),
3002
- cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.buildContext, "pull")), false),
3034
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
3035
+ ? "nginx"
3036
+ : "node"),
3037
+ cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
3003
3038
  variables: {
3004
3039
  // only required for non static
3005
- DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.buildContext),
3006
- DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.buildContext.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _g === void 0 ? void 0 : _g.join("\n"),
3040
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
3041
+ DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _g === void 0 ? void 0 : _g.join("\n"),
3007
3042
  },
3008
3043
  },
3009
3044
  });
@@ -3103,7 +3138,7 @@ var getNextCache = function (context) { return [
3103
3138
  {
3104
3139
  key: context.componentName + "-next-cache",
3105
3140
  policy: "pull-push",
3106
- paths: [context.componentConfig.dir + "/.next/cache/"],
3141
+ paths: [context.build.dir + "/.next/cache/"],
3107
3142
  },
3108
3143
  ]; };
3109
3144
  exports.getNextCache = getNextCache;
@@ -3222,23 +3257,23 @@ var getMeteorCache = function (context) { return [
3222
3257
  key: context.componentName + "meteor-build-cache",
3223
3258
  policy: "pull-push",
3224
3259
  paths: [
3225
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/resolver-result-cache.json"),
3226
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/plugin-cache"),
3227
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/isopacks"),
3228
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/bundler-cache/scanner"),
3260
+ (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
3261
+ (0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
3262
+ (0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
3263
+ (0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
3229
3264
  ],
3230
3265
  },
3231
3266
  ]; };
3232
3267
  var createMeteorBuildJobs = function (context) {
3233
- var buildConfig = context.componentConfig.build;
3268
+ var buildConfig = context.build.config;
3234
3269
  if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
3235
3270
  throw new Error("deploy config is not meteor");
3236
3271
  }
3237
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext);
3272
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
3238
3273
  return (0, base_1.createBuildJobs)(context, {
3239
3274
  appBuild: buildConfig.buildCommand !== null
3240
3275
  ? {
3241
- cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.buildContext)), false), __read(getMeteorCache(context)), false),
3276
+ cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
3242
3277
  image: (0, runner_1.getRunnerImage)("jobs-meteor"),
3243
3278
  variables: {
3244
3279
  METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
@@ -3252,14 +3287,14 @@ var createMeteorBuildJobs = function (context) {
3252
3287
  ], false),
3253
3288
  artifacts: {
3254
3289
  paths: [
3255
- context.componentConfig.dir + "/__build_info.json",
3256
- context.componentConfig.dir + "/dist",
3290
+ context.build.dir + "/__build_info.json",
3291
+ context.build.dir + "/dist",
3257
3292
  ],
3258
3293
  },
3259
3294
  }
3260
3295
  : undefined,
3261
3296
  dockerBuild: {
3262
- script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
3297
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
3263
3298
  variables: {
3264
3299
  METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : "",
3265
3300
  },
@@ -3327,32 +3362,32 @@ var createNodeTestJobs = function (context) {
3327
3362
  if (context.trigger === "taggedRelease") {
3328
3363
  return [];
3329
3364
  }
3330
- var buildConfig = context.componentConfig.build;
3365
+ var buildConfig = context.build.config;
3331
3366
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
3332
3367
  var base = {
3333
- variables: __assign(__assign({ APP_PATH: context.componentConfig.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
3368
+ variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
3334
3369
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
3335
3370
  stage: "test",
3336
3371
  needs: [],
3337
3372
  envMode: "none",
3338
3373
  };
3339
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext);
3374
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
3340
3375
  var auditJob = buildConfig.audit !== false
3341
3376
  ? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage, cache: undefined, script: __spreadArray([
3342
- "cd ".concat(context.componentConfig.dir)
3377
+ "cd ".concat(context.build.dir)
3343
3378
  ], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
3344
- ((_f = context.buildContext.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
3379
+ ((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
3345
3380
  ? "yarn audit"
3346
3381
  : "yarn npm audit --environment production", // yarn 2
3347
- ])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
3382
+ ])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
3348
3383
  var lintJob = buildConfig.lint !== false
3349
- ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage, cache: (0, cache_1.getNodeCache)(context.buildContext), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.buildContext)), false), [
3350
- "cd ".concat(context.componentConfig.dir)
3351
- ], false), __read(yarnInstall), false), __read(((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
3384
+ ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage, cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
3385
+ "cd ".concat(context.build.dir)
3386
+ ], false), __read(yarnInstall), false), __read(((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
3352
3387
  var testJob = buildConfig.test !== false
3353
- ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"), cache: (0, cache_1.getNodeCache)(context.buildContext), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.buildContext)), false), [
3354
- "cd ".concat(context.componentConfig.dir)
3355
- ], false), __read(yarnInstall), false), __read(((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
3388
+ ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"), cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
3389
+ "cd ".concat(context.build.dir)
3390
+ ], false), __read(yarnInstall), false), __read(((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
3356
3391
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
3357
3392
  };
3358
3393
  exports.createNodeTestJobs = createNodeTestJobs;
@@ -3489,7 +3524,7 @@ var docker_1 = __nccwpck_require__(9641);
3489
3524
  var types_1 = __nccwpck_require__(4466);
3490
3525
  var createRailsBuildJobs = function (context) {
3491
3526
  var _a, _b, _c;
3492
- var buildConfig = context.componentConfig.build;
3527
+ var buildConfig = context.build.config;
3493
3528
  if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
3494
3529
  // should not happen
3495
3530
  throw new Error("build type is not rails");
@@ -3513,10 +3548,10 @@ var createRailsBuildJobs = function (context) {
3513
3548
  return (0, base_1.createBuildJobs)(context, {
3514
3549
  appBuild: undefined,
3515
3550
  dockerBuild: {
3516
- variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
3551
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
3517
3552
  // custom script
3518
3553
  script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
3519
- "cd ".concat(context.componentConfig.dir),
3554
+ "cd ".concat(context.build.dir),
3520
3555
  "docker pull $DOCKER_CACHE_IMAGE || true",
3521
3556
  "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"),
3522
3557
  "chmod +x /usr/local/bin/pack",
@@ -3625,7 +3660,7 @@ var createRailsTestJobs = function (context) {
3625
3660
  if (context.trigger === "taggedRelease") {
3626
3661
  return [];
3627
3662
  }
3628
- var buildConfig = context.componentConfig.build;
3663
+ var buildConfig = context.build.config;
3629
3664
  var base = {
3630
3665
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
3631
3666
  stage: "test",
@@ -3647,20 +3682,20 @@ var createRailsTestJobs = function (context) {
3647
3682
  };
3648
3683
  var auditJob = buildConfig.audit !== false
3649
3684
  ? __assign(__assign({ name: "🛡 audit" }, base), { cache: undefined, image: (_d = (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage) !== null && _d !== void 0 ? _d : defaultImage, script: __spreadArray([
3650
- "cd ".concat(context.componentConfig.dir)
3685
+ "cd ".concat(context.build.dir)
3651
3686
  ], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
3652
3687
  "gem install bundler-audit",
3653
3688
  "bundle audit check",
3654
3689
  ])), false), allow_failure: true }) : null;
3655
3690
  var lintJob = buildConfig.lint !== false
3656
3691
  ? __assign(__assign({ name: "👮 lint" }, base), { cache: bundlerCache, image: (_j = (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage) !== null && _j !== void 0 ? _j : defaultImage, script: __spreadArray(__spreadArray([
3657
- "cd ".concat(context.componentConfig.dir)
3692
+ "cd ".concat(context.build.dir)
3658
3693
  ], __read(bundlerInstall), false), __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [
3659
3694
  "bundle exec rubocop",
3660
3695
  ])), false) }) : null;
3661
3696
  var testJob = buildConfig.test !== false
3662
3697
  ? __assign(__assign({ name: "🧪 test" }, base), { cache: bundlerCache, image: (_p = (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage) !== null && _p !== void 0 ? _p : defaultImage, script: __spreadArray(__spreadArray([
3663
- "cd ".concat(context.componentConfig.dir)
3698
+ "cd ".concat(context.build.dir)
3664
3699
  ], __read(bundlerInstall), false), __read(((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
3665
3700
  "bundle exec rspec",
3666
3701
  ])), false) }) : null;
@@ -3683,12 +3718,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
3683
3718
  exports.SBOM_FILE = "__sbom.json";
3684
3719
  var createSbomBuildJob = function (context) {
3685
3720
  var _a, _b, _c, _d, _e;
3686
- var buildConfig = context.componentConfig.build;
3721
+ var buildConfig = context.build.config;
3687
3722
  var defaultImage = "aquasec/trivy:0.38.3";
3688
3723
  var defaultScript = [
3689
- "trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.buildContext.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
3724
+ "trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
3690
3725
  ? "."
3691
- : context.buildContext.dir),
3726
+ : context.build.dir),
3692
3727
  ];
3693
3728
  var image = buildConfig.type === "custom" && buildConfig.sbom !== false
3694
3729
  ? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
@@ -4314,7 +4349,7 @@ var sanitize = function (value) {
4314
4349
  };
4315
4350
  var getLabels = function (context) {
4316
4351
  var _a, _b, _c;
4317
- var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.componentName), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.environment.shortName), "build-type": sanitize((_a = context.componentConfig.build) === null || _a === void 0 ? void 0 : _a.type) }, ((_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {}));
4352
+ var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.componentName), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.environment.shortName), "build-type": sanitize((_a = context.build.config) === null || _a === void 0 ? void 0 : _a.type) }, ((_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {}));
4318
4353
  return labels;
4319
4354
  };
4320
4355
  exports.getLabels = getLabels;
@@ -4353,6 +4388,17 @@ exports.getReviewSlug = getReviewSlug;
4353
4388
 
4354
4389
  "use strict";
4355
4390
 
4391
+ var __assign = (this && this.__assign) || function () {
4392
+ __assign = Object.assign || function(t) {
4393
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4394
+ s = arguments[i];
4395
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
4396
+ t[p] = s[p];
4397
+ }
4398
+ return t;
4399
+ };
4400
+ return __assign.apply(this, arguments);
4401
+ };
4356
4402
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4357
4403
  if (k2 === undefined) k2 = k;
4358
4404
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -4405,6 +4451,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
4405
4451
  };
4406
4452
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4407
4453
  exports.createContext = exports.createComponentContext = void 0;
4454
+ var lodash_1 = __nccwpck_require__(3255);
4408
4455
  var build_1 = __nccwpck_require__(7862);
4409
4456
  var deploy_1 = __nccwpck_require__(8483);
4410
4457
  var utils_1 = __nccwpck_require__(2497);
@@ -4413,10 +4460,9 @@ var getEnvironmentContext_1 = __nccwpck_require__(3663);
4413
4460
  __exportStar(__nccwpck_require__(5699), exports);
4414
4461
  __exportStar(__nccwpck_require__(5133), exports);
4415
4462
  var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
4416
- var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
4417
- var _a;
4418
- return __generator(this, function (_b) {
4419
- switch (_b.label) {
4463
+ var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
4464
+ return __generator(this, function (_a) {
4465
+ switch (_a.label) {
4420
4466
  case 0:
4421
4467
  if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
4422
4468
  throw new Error("componentName may only contain lower case letters, numbers and -");
@@ -4433,22 +4479,33 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
4433
4479
  deploy: {},
4434
4480
  };
4435
4481
  componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
4436
- _a = {
4482
+ return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
4483
+ case 1:
4484
+ environment = _a.sent();
4485
+ deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
4486
+ context = {
4437
4487
  fullConfig: ctx.config,
4438
4488
  componentConfig: componentConfig,
4439
- buildContext: {
4440
- dir: componentConfig.dir,
4489
+ build: {
4490
+ dir: dir,
4441
4491
  packageManagerInfo: ctx.packageManagerInfo,
4442
- config: componentConfig.build,
4492
+ config: build,
4443
4493
  },
4444
- componentName: ctx.componentName
4494
+ deploy: deploy
4495
+ ? {
4496
+ config: deploy,
4497
+ }
4498
+ : null,
4499
+ componentName: ctx.componentName,
4500
+ environment: environment,
4501
+ packageManagerInfo: ctx.packageManagerInfo,
4502
+ pipelineType: ctx.pipelineType,
4503
+ trigger: ctx.trigger,
4445
4504
  };
4446
- return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
4447
- case 1: return [2 /*return*/, (_a.environment = _b.sent(),
4448
- _a.packageManagerInfo = ctx.packageManagerInfo,
4449
- _a.pipelineType = ctx.pipelineType,
4450
- _a.trigger = ctx.trigger,
4451
- _a)];
4505
+ resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
4506
+ ? customJobs(context)
4507
+ : customJobs;
4508
+ return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
4452
4509
  }
4453
4510
  });
4454
4511
  }); };
@@ -4863,7 +4920,7 @@ var stop_1 = __nccwpck_require__(2846);
4863
4920
  var variables_1 = __nccwpck_require__(2422);
4864
4921
  exports.DEPLOY_JOB_NAME = "🚀 Deploy";
4865
4922
  var createDeployJob = function (context, jobDefinition) {
4866
- var _a, _b, _c, _d, _e, _f;
4923
+ var _a, _b, _c, _d, _e, _f, _g;
4867
4924
  var hasDocker = (0, docker_1.requiresDockerBuild)(context);
4868
4925
  var isStoppable = (0, utils_1.contextIsStoppable)(context);
4869
4926
  var autoStop = context.environment.envType === "review"
@@ -4871,14 +4928,13 @@ var createDeployJob = function (context, jobDefinition) {
4871
4928
  : context.environment.envType === "dev"
4872
4929
  ? "4 weeks"
4873
4930
  : undefined;
4931
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
4874
4932
  // if auto or manual is configured explicitly, use that
4875
- var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when
4876
- ? context.componentConfig.deploy.when
4877
- : undefined;
4933
+ var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
4878
4934
  // otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
4879
4935
  var whenDeployDefault = context.environment.envType !== "prod"
4880
4936
  ? "auto" // is not stage, auto deploy
4881
- : ((_a = context.componentConfig.env) === null || _a === void 0 ? void 0 : _a.stage) === false
4937
+ : ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
4882
4938
  ? "auto" // is prod, but no staging, auto deploy
4883
4939
  : "manual"; // manually deploy
4884
4940
  var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
@@ -4892,12 +4948,12 @@ var createDeployJob = function (context, jobDefinition) {
4892
4948
  envMode: "stagePerEnv", // makes it easier to run manual tasks er env
4893
4949
  needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
4894
4950
  ? []
4895
- : [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((context.componentConfig.deploy
4896
- ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) { return ({
4951
+ : [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((deployConfig
4952
+ ? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) { return ({
4897
4953
  componentName: c,
4898
4954
  job: exports.DEPLOY_JOB_NAME,
4899
4955
  artifacts: false,
4900
- }); })) !== null && _c !== void 0 ? _c : []
4956
+ }); })) !== null && _d !== void 0 ? _d : []
4901
4957
  : [])), false),
4902
4958
  // we don't want to deploy when there is a broken test
4903
4959
  needsStages: [
@@ -4913,21 +4969,15 @@ var createDeployJob = function (context, jobDefinition) {
4913
4969
  when: whenDeploy === "auto" ? "on_success" : "manual",
4914
4970
  allow_failure: whenDeploy === "manual" ? true : false,
4915
4971
  stage: "deploy",
4916
- variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (context.componentConfig.deploy
4917
- ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {}
4918
- : {})), jobDefinition.variables),
4919
- runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
4920
- ? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
4921
- : {})),
4972
+ variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (deployConfig ? (_e = deployConfig.extraVars) !== null && _e !== void 0 ? _e : {} : {})), jobDefinition.variables),
4973
+ runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_f = jobDefinition.runnerVariables) !== null && _f !== void 0 ? _f : {})), (deployConfig ? (_g = deployConfig.runnerVariables) !== null && _g !== void 0 ? _g : {} : {})),
4922
4974
  environment: isStoppable
4923
4975
  ? {
4924
4976
  on_stop: stop_1.STOP_JOB_NAME,
4925
4977
  auto_stop_in: autoStop,
4926
4978
  }
4927
4979
  : undefined,
4928
- jobTags: context.componentConfig.deploy
4929
- ? context.componentConfig.deploy.jobTags
4930
- : undefined,
4980
+ jobTags: deployConfig ? deployConfig.jobTags : undefined,
4931
4981
  };
4932
4982
  };
4933
4983
  exports.createDeployJob = createDeployJob;
@@ -5125,17 +5175,18 @@ var BashExpression_1 = __nccwpck_require__(2376);
5125
5175
  var gitlab_1 = __nccwpck_require__(8490);
5126
5176
  var types_1 = __nccwpck_require__(5781);
5127
5177
  var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
5128
- var getArtifactsRegistryHost = function (_a) {
5129
- var deploy = _a.componentConfig.deploy;
5130
- if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
5178
+ var getArtifactsRegistryHost = function (context) {
5179
+ var _a;
5180
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
5131
5181
  // should not happen
5132
5182
  throw new Error("deploy config is wrong");
5133
5183
  }
5134
- return "".concat(deploy.region, "-docker.pkg.dev");
5184
+ return "".concat(context.deploy.config.region, "-docker.pkg.dev");
5135
5185
  };
5136
5186
  exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
5137
5187
  var getArtifactsRegistryDockerUrl = function (context) {
5138
- var deployConfig = context.componentConfig.deploy;
5188
+ var _a;
5189
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5139
5190
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
5140
5191
  // should not happen
5141
5192
  throw new Error("deploy config is wrong");
@@ -5198,11 +5249,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
5198
5249
  * @returns
5199
5250
  */
5200
5251
  var getDeleteUnusedImagesCommands = function (context, keep) {
5252
+ var _a;
5201
5253
  if (keep === void 0) { keep = 0; }
5202
- var deployConfig = context.componentConfig.deploy;
5203
- if (deployConfig === false) {
5204
- return [];
5205
- }
5254
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5206
5255
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
5207
5256
  // should not happen
5208
5257
  throw new Error("deploy config is wrong");
@@ -5293,8 +5342,9 @@ var createArgsString_1 = __nccwpck_require__(9598);
5293
5342
  var getServiceName_1 = __nccwpck_require__(8128);
5294
5343
  var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
5295
5344
  var getListRevisionsCommand = function (context, args) {
5345
+ var _a;
5296
5346
  var serviceName = (0, getServiceName_1.getServiceName)(context);
5297
- var deployConfig = context.componentConfig.deploy;
5347
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5298
5348
  if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
5299
5349
  // should not happen
5300
5350
  throw new Error("deploy config is wrong");
@@ -5306,10 +5356,8 @@ var getListRevisionsCommand = function (context, args) {
5306
5356
  return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
5307
5357
  };
5308
5358
  var getDeleteUnusedRevisionsCommands = function (context, keep) {
5309
- var deployConfig = context.componentConfig.deploy;
5310
- if (deployConfig === false) {
5311
- return [];
5312
- }
5359
+ var _a;
5360
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5313
5361
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
5314
5362
  // should not happen
5315
5363
  throw new Error("deploy config is wrong");
@@ -5578,7 +5626,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
5578
5626
  var serviceName = (0, getServiceName_1.getServiceName)(context);
5579
5627
  var customConfig = service !== true ? service : undefined;
5580
5628
  var command = service !== true
5581
- ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand
5629
+ ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand
5582
5630
  : undefined;
5583
5631
  var commandArray = command
5584
5632
  ? Array.isArray(command)
@@ -5673,7 +5721,8 @@ var makeLabelString = function (obj) {
5673
5721
  };
5674
5722
  exports.makeLabelString = makeLabelString;
5675
5723
  var getCloudRunDeployConfig = function (context) {
5676
- var deployConfig = context.componentConfig.deploy;
5724
+ var _a;
5725
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5677
5726
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
5678
5727
  // should not happen
5679
5728
  throw new Error("deploy config is wrong");
@@ -5855,10 +5904,8 @@ var constants_1 = __nccwpck_require__(8865);
5855
5904
  var getCloudRunDeployScripts_1 = __nccwpck_require__(3695);
5856
5905
  var getCloudRunStopScripts_1 = __nccwpck_require__(3747);
5857
5906
  var createGoogleCloudRunDeployJobs = function (context) {
5858
- var deployConfig = context.componentConfig.deploy;
5859
- if (deployConfig === false) {
5860
- return [];
5861
- }
5907
+ var _a;
5908
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5862
5909
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
5863
5910
  // should not happen
5864
5911
  throw new Error("deploy config is wrong");
@@ -6338,31 +6385,28 @@ var base_1 = __nccwpck_require__(2024);
6338
6385
  var sbom_1 = __nccwpck_require__(4986);
6339
6386
  var types_1 = __nccwpck_require__(5781);
6340
6387
  var createCustomDeployJobs = function (context) {
6341
- var _a, _b, _c;
6342
- var deployConfig = context.componentConfig.deploy;
6343
- if (deployConfig === false) {
6344
- return [];
6345
- }
6388
+ var _a, _b, _c, _d;
6389
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
6346
6390
  if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
6347
6391
  // should not happen
6348
6392
  throw new Error("deploy config is not custom");
6349
6393
  }
6350
6394
  // FIXME: custom deploy currently assumes yarn-based project
6351
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext, {
6395
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
6352
6396
  noCustomPostInstall: true,
6353
6397
  });
6354
6398
  return (0, base_1.createDeployementJobs)(context, {
6355
6399
  deploy: {
6356
- image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
6357
- cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
6400
+ image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
6401
+ cache: (_c = deployConfig.jobCache) !== null && _c !== void 0 ? _c : [],
6358
6402
  script: __spreadArray(__spreadArray(__spreadArray([
6359
- "cd ".concat(context.componentConfig.dir)
6403
+ "cd ".concat(context.build.dir)
6360
6404
  ], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
6361
6405
  variables: {},
6362
6406
  },
6363
6407
  stop: deployConfig.stopScript
6364
6408
  ? {
6365
- image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
6409
+ image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
6366
6410
  script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
6367
6411
  variables: {},
6368
6412
  }
@@ -6439,17 +6483,15 @@ var docker_1 = __nccwpck_require__(9641);
6439
6483
  var base_1 = __nccwpck_require__(2024);
6440
6484
  var types_1 = __nccwpck_require__(5781);
6441
6485
  var createDockerTagDeployJobs = function (context) {
6442
- var deployConfig = context.componentConfig.deploy;
6443
- if (deployConfig === false) {
6444
- return [];
6445
- }
6486
+ var _a;
6487
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
6446
6488
  if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
6447
6489
  // should not happen
6448
6490
  throw new Error("deploy config is not dockerTag");
6449
6491
  }
6450
6492
  var tag = deployConfig.tag;
6451
6493
  return (0, base_1.createDeployementJobs)(context, {
6452
- deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(context)), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
6494
+ deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)()), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
6453
6495
  "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
6454
6496
  "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
6455
6497
  "docker push $DOCKER_IMAGE:".concat(tag),
@@ -6561,32 +6603,34 @@ var context_1 = __nccwpck_require__(5875);
6561
6603
  var utils_1 = __nccwpck_require__(2089);
6562
6604
  var types_1 = __nccwpck_require__(5781);
6563
6605
  var hasKubernetesCloudSQL = function (context) {
6564
- var _a, _b;
6565
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
6566
- return (_b = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql) === null || _b === void 0 ? void 0 : _b.enabled;
6606
+ var _a, _b, _c;
6607
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
6608
+ if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
6609
+ return (_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql) === null || _c === void 0 ? void 0 : _c.enabled;
6567
6610
  }
6568
6611
  return false;
6569
6612
  };
6570
6613
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
6571
6614
  var createKubernetesCloudsqlBaseValues = function (context) {
6572
- var _a, _b, _c, _d, _e, _f;
6573
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
6615
+ var _a, _b, _c, _d, _e, _f, _g;
6616
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
6617
+ if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
6574
6618
  throw new Error("cannot get cloud sql config");
6575
6619
  }
6576
- var config = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
6620
+ var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
6577
6621
  if (!config) {
6578
6622
  throw new Error("cannot get cloud sql config");
6579
6623
  }
6580
6624
  var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
6581
6625
  if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
6582
- var instanceConnectionName = "".concat((_b = config.projectId) !== null && _b !== void 0 ? _b : "skynet-164509", ":").concat((_c = config.region) !== null && _c !== void 0 ? _c : "europe-west6", ":").concat((_d = config.instanceId) !== null && _d !== void 0 ? _d : context.environment.envVars.KUBE_NAMESPACE);
6626
+ var instanceConnectionName = "".concat((_c = config.projectId) !== null && _c !== void 0 ? _c : "skynet-164509", ":").concat((_d = config.region) !== null && _d !== void 0 ? _d : "europe-west6", ":").concat((_e = config.instanceId) !== null && _e !== void 0 ? _e : context.environment.envVars.KUBE_NAMESPACE);
6583
6627
  return {
6584
6628
  cloudsql: {
6585
6629
  enabled: config.enabled,
6586
6630
  dbUser: "postgres",
6587
6631
  instanceConnectionName: instanceConnectionName,
6588
6632
  proxyCredentials: proxyCredentials,
6589
- fullDbName: (_e = context.environment.envVars.KUBE_APP_NAME) !== null && _e !== void 0 ? _e : "",
6633
+ fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
6590
6634
  },
6591
6635
  };
6592
6636
  }
@@ -6594,7 +6638,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
6594
6638
  return {
6595
6639
  cloudsql: {
6596
6640
  enabled: config.enabled,
6597
- dbUser: (_f = config.dbUser) !== null && _f !== void 0 ? _f : "postgres",
6641
+ dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
6598
6642
  instanceConnectionName: config.instanceConnectionName,
6599
6643
  proxyCredentials: proxyCredentials,
6600
6644
  fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
@@ -6663,11 +6707,8 @@ var bashYaml_1 = __nccwpck_require__(4660);
6663
6707
  var gitlab_1 = __nccwpck_require__(8490);
6664
6708
  var ALL_VALUES_FILE = "__all_values.yml";
6665
6709
  var createKubernetesDeployJobs = function (context) {
6666
- var _a, _b;
6667
- var deployConfig = context.componentConfig.deploy;
6668
- if (deployConfig === false) {
6669
- return [];
6670
- }
6710
+ var _a, _b, _c;
6711
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
6671
6712
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
6672
6713
  // should not happen
6673
6714
  throw new Error("deploy config is not kubernetes");
@@ -6681,7 +6722,7 @@ var createKubernetesDeployJobs = function (context) {
6681
6722
  when: "always",
6682
6723
  },
6683
6724
  }
6684
- : {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName), HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart", HELM_ARGS: __spreadArray(__spreadArray([], __read((deployConfig.debug ? ["--debug"] : [])), false), __read(((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : [])), false).join(" "), COMPONENT_NAME: context.componentName,
6725
+ : {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName), HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart", HELM_ARGS: __spreadArray(__spreadArray([], __read((deployConfig.debug ? ["--debug"] : [])), false), __read(((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : [])), false).join(" "), COMPONENT_NAME: context.componentName,
6685
6726
  /** @deprecated */
6686
6727
  BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
6687
6728
  var clusterName = "kube-".concat(context.environment.fullName);
@@ -6847,7 +6888,8 @@ var shouldGoIntoSecrets = function (key, value) {
6847
6888
  * we evalulate the actual values later, but want to store the secrets in kubernetes secrets
6848
6889
  */
6849
6890
  var createKubeEnv = function (context) {
6850
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
6891
+ var _a;
6892
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
6851
6893
  // should not happen
6852
6894
  throw new Error("deploy config is not kubernetes");
6853
6895
  }
@@ -6933,7 +6975,7 @@ var createAppConfig = function (context, application) {
6933
6975
  var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
6934
6976
  return (0, utils_1.mergeWithMergingArrays)({
6935
6977
  host: context.environment.host,
6936
- command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
6978
+ command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
6937
6979
  livenessProbe: {
6938
6980
  httpGet: {
6939
6981
  path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
@@ -6961,9 +7003,9 @@ var removeFalsy = function (record) {
6961
7003
  }));
6962
7004
  };
6963
7005
  var createKubeValues = function (context) {
6964
- var _a, _b;
6965
- var deployConfig = context.componentConfig.deploy;
6966
- if (deployConfig === false) {
7006
+ var _a, _b, _c;
7007
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
7008
+ if (!deployConfig) {
6967
7009
  return [];
6968
7010
  }
6969
7011
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
@@ -6973,14 +7015,14 @@ var createKubeValues = function (context) {
6973
7015
  var values = deployConfig.values;
6974
7016
  // we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
6975
7017
  // we only merge the rest of the values in
6976
- var _c = values !== null && values !== void 0 ? values : {}, application = _c.application, jobs = _c.jobs, cronjobs = _c.cronjobs, rest = __rest(_c, ["application", "jobs", "cronjobs"]);
7018
+ var _d = values !== null && values !== void 0 ? values : {}, application = _d.application, jobs = _d.jobs, cronjobs = _d.cronjobs, rest = __rest(_d, ["application", "jobs", "cronjobs"]);
6977
7019
  var env = (0, kubeEnv_1.createKubeEnv)(context);
6978
7020
  var defaultKubeValues = (0, lodash_1.merge)({
6979
7021
  env: env,
6980
7022
  application: createAppConfig(context, application),
6981
7023
  }, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
6982
7024
  ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
6983
- : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled)
7025
+ : {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
6984
7026
  ? (0, mongodb_1.createMongodbBaseConfig)(context)
6985
7027
  : {});
6986
7028
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
@@ -7028,15 +7070,15 @@ var getMongodbReplicasetHost = function (context, index) {
7028
7070
  return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
7029
7071
  };
7030
7072
  var createMongodbUrl = function (context, dbName) {
7031
- var _a, _b;
7032
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
7073
+ var _a, _b, _c, _d;
7074
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
7033
7075
  throw new Error("can only createMongodbUrl on supported deploys");
7034
7076
  }
7035
- var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
7077
+ var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
7036
7078
  var queryParams = undefined;
7037
7079
  var hosts = "";
7038
7080
  if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
7039
- hosts = (0, lodash_1.range)(0, (_b = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _b !== void 0 ? _b : 2)
7081
+ hosts = (0, lodash_1.range)(0, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _d !== void 0 ? _d : 2)
7040
7082
  .map(function (i) { return getMongodbReplicasetHost(context, i); })
7041
7083
  .join(",");
7042
7084
  queryParams = "replicaSet=rs0&authSource=admin";
@@ -7048,11 +7090,11 @@ var createMongodbUrl = function (context, dbName) {
7048
7090
  return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
7049
7091
  };
7050
7092
  var createMongoBackupDefaultConfig = function (context) {
7051
- var _a;
7052
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
7093
+ var _a, _b, _c;
7094
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
7053
7095
  throw new Error("can only create mongodb base config on supported deploys");
7054
7096
  }
7055
- var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
7097
+ var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
7056
7098
  var fullAppName = context.environment.envVars.KUBE_APP_NAME;
7057
7099
  var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
7058
7100
  var hostToBackup;
@@ -7082,11 +7124,11 @@ var createMongoBackupDefaultConfig = function (context) {
7082
7124
  };
7083
7125
  };
7084
7126
  var createMongodbBaseConfig = function (context) {
7085
- var _a, _b;
7086
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
7127
+ var _a, _b, _c, _d;
7128
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
7087
7129
  throw new Error("can only create mongodb base config on supported deploys");
7088
7130
  }
7089
- var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
7131
+ var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
7090
7132
  return {
7091
7133
  mongodb: {
7092
7134
  enabled: true,
@@ -7101,7 +7143,7 @@ var createMongodbBaseConfig = function (context) {
7101
7143
  backup: createMongoBackupDefaultConfig(context),
7102
7144
  },
7103
7145
  env: {
7104
- secret: __assign({ MONGO_URL: createMongodbUrl(context, (_b = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.dbName) !== null && _b !== void 0 ? _b : "app") }, ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset"
7146
+ secret: __assign({ MONGO_URL: createMongodbUrl(context, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.dbName) !== null && _d !== void 0 ? _d : "app") }, ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset"
7105
7147
  ? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
7106
7148
  : {})),
7107
7149
  },
@@ -7157,8 +7199,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
7157
7199
  exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
7158
7200
  var sbom_1 = __nccwpck_require__(7038);
7159
7201
  var sbomDeactivated = function (context) {
7160
- return context.componentConfig.build.type === "custom" &&
7161
- context.componentConfig.build.sbom === false;
7202
+ return context.build.config.type === "custom" && context.build.config.sbom === false;
7162
7203
  };
7163
7204
  exports.sbomDeactivated = sbomDeactivated;
7164
7205
  var getDependencyTrackUploadScript = function (context) {
@@ -7243,7 +7284,7 @@ var isOfDeployType = function (t) {
7243
7284
  for (var _i = 1; _i < arguments.length; _i++) {
7244
7285
  types[_i - 1] = arguments[_i];
7245
7286
  }
7246
- return t && types.includes(t.type);
7287
+ return t && types.includes(t.type) ? true : false;
7247
7288
  };
7248
7289
  exports.isOfDeployType = isOfDeployType;
7249
7290
  //# sourceMappingURL=index.js.map
@@ -7279,7 +7320,8 @@ var getKubernetesNamespace = function (config, env) {
7279
7320
  };
7280
7321
  exports.getKubernetesNamespace = getKubernetesNamespace;
7281
7322
  var contextIsStoppable = function (context) {
7282
- var deployConfig = context.componentConfig.deploy;
7323
+ var _a;
7324
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
7283
7325
  if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
7284
7326
  return true;
7285
7327
  }
@@ -7615,7 +7657,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7615
7657
  };
7616
7658
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7617
7659
  exports.createJobsForComponent = void 0;
7618
- var lodash_1 = __nccwpck_require__(3255);
7619
7660
  var build_1 = __nccwpck_require__(7862);
7620
7661
  var context_1 = __nccwpck_require__(5875);
7621
7662
  var deploy_1 = __nccwpck_require__(8483);
@@ -7628,18 +7669,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
7628
7669
  });
7629
7670
  };
7630
7671
  var getCustomJobs = function (context) {
7631
- if (!context.componentConfig.customJobs) {
7672
+ if (!context.customJobs) {
7632
7673
  return [];
7633
7674
  }
7634
- var rawJobs = (0, lodash_1.isFunction)(context.componentConfig.customJobs)
7635
- ? context.componentConfig.customJobs(context)
7636
- : context.componentConfig.customJobs;
7675
+ var rawJobs = context.customJobs;
7637
7676
  return injectDefaultVarsInCustomJobs(context, rawJobs);
7638
7677
  };
7639
7678
  var createRawJobs = function (context) {
7640
- var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
7641
- var deployJobs = context.componentConfig.deploy !== false
7642
- ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
7679
+ var _a, _b;
7680
+ var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
7681
+ var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
7682
+ ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
7643
7683
  : [];
7644
7684
  var customJobs = getCustomJobs(context);
7645
7685
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);