@catladder/cli 0.0.0-main-7be9a47d → 0.0.0-main-d50a9a7c

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 (135) hide show
  1. package/dist/bundles/catenv/index.js +886 -269
  2. package/dist/bundles/cli/index.js +899 -306
  3. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +2 -2
  4. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
  5. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +2 -2
  6. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  7. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +1 -1
  8. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  9. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +2 -2
  10. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  11. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +2 -2
  12. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  13. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js +1 -25
  14. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  15. package/dist/cli/src/gcloud/serviceAccounts.js +3 -3
  16. package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
  17. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.d.ts +3 -0
  18. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js +81 -0
  19. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js.map +1 -0
  20. package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +3 -3
  21. package/dist/pipeline/src/build/base/createAppBuildJob.js +14 -13
  22. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  23. package/dist/pipeline/src/build/base/index.d.ts +6 -2
  24. package/dist/pipeline/src/build/base/index.js +23 -5
  25. package/dist/pipeline/src/build/base/index.js.map +1 -1
  26. package/dist/pipeline/src/build/base/writeDotEnv.js +3 -2
  27. package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
  28. package/dist/pipeline/src/build/custom/buildJob.js +2 -12
  29. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  30. package/dist/pipeline/src/build/docker.js +6 -6
  31. package/dist/pipeline/src/build/docker.js.map +1 -1
  32. package/dist/pipeline/src/build/index.d.ts +14 -5
  33. package/dist/pipeline/src/build/index.js +23 -3
  34. package/dist/pipeline/src/build/index.js.map +1 -1
  35. package/dist/pipeline/src/build/node/buildJob.d.ts +7 -2
  36. package/dist/pipeline/src/build/node/buildJob.js +44 -42
  37. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  38. package/dist/pipeline/src/build/node/cache.d.ts +2 -2
  39. package/dist/pipeline/src/build/node/cache.js +17 -9
  40. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  41. package/dist/pipeline/src/build/node/index.d.ts +2 -2
  42. package/dist/pipeline/src/build/node/index.js.map +1 -1
  43. package/dist/pipeline/src/build/node/meteor.js +2 -8
  44. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  45. package/dist/pipeline/src/build/node/testJob.d.ts +3 -2
  46. package/dist/pipeline/src/build/node/testJob.js +10 -3
  47. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  48. package/dist/pipeline/src/build/node/yarn.js +1 -1
  49. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  50. package/dist/pipeline/src/build/rails/build.d.ts +1 -1
  51. package/dist/pipeline/src/build/rails/build.js +7 -2
  52. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  53. package/dist/pipeline/src/build/rails/test.d.ts +1 -1
  54. package/dist/pipeline/src/build/rails/test.js +5 -0
  55. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  56. package/dist/pipeline/src/build/sbom.js +7 -2
  57. package/dist/pipeline/src/build/sbom.js.map +1 -1
  58. package/dist/pipeline/src/build/types.d.ts +49 -5
  59. package/dist/pipeline/src/build/types.js +9 -1
  60. package/dist/pipeline/src/build/types.js.map +1 -1
  61. package/dist/pipeline/src/context/createAllComponentsContext.d.ts +8 -0
  62. package/dist/pipeline/src/context/createAllComponentsContext.js +68 -0
  63. package/dist/pipeline/src/context/createAllComponentsContext.js.map +1 -0
  64. package/dist/pipeline/src/context/createComponentContext.d.ts +0 -4
  65. package/dist/pipeline/src/context/createComponentContext.js +81 -19
  66. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  67. package/dist/pipeline/src/context/createWorkspaceContext.d.ts +9 -0
  68. package/dist/pipeline/src/context/createWorkspaceContext.js +86 -0
  69. package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -0
  70. package/dist/pipeline/src/context/getBuildInfoVariables.d.ts +1 -1
  71. package/dist/pipeline/src/context/getBuildInfoVariables.js.map +1 -1
  72. package/dist/pipeline/src/context/getEnvironmentContext.d.ts +1 -1
  73. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
  74. package/dist/pipeline/src/context/getEnvironmentVariables.js +10 -4
  75. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  76. package/dist/pipeline/src/context/getLabels.js +2 -2
  77. package/dist/pipeline/src/context/getLabels.js.map +1 -1
  78. package/dist/pipeline/src/deploy/base/deploy.d.ts +1 -1
  79. package/dist/pipeline/src/deploy/base/deploy.js +29 -6
  80. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  81. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +2 -2
  82. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
  83. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +4 -4
  84. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
  85. package/dist/pipeline/src/deploy/cloudRun/index.d.ts +2 -2
  86. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  87. package/dist/pipeline/src/deploy/custom/index.d.ts +2 -2
  88. package/dist/pipeline/src/deploy/custom/index.js.map +1 -1
  89. package/dist/pipeline/src/deploy/dockerTag/index.d.ts +2 -2
  90. package/dist/pipeline/src/deploy/dockerTag/index.js.map +1 -1
  91. package/dist/pipeline/src/deploy/index.d.ts +7 -7
  92. package/dist/pipeline/src/deploy/index.js.map +1 -1
  93. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  94. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.js.map +1 -1
  95. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +1 -1
  96. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  97. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +1 -1
  98. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  99. package/dist/pipeline/src/deploy/kubernetes/index.d.ts +2 -2
  100. package/dist/pipeline/src/deploy/kubernetes/index.js.map +1 -1
  101. package/dist/pipeline/src/deploy/sbom.d.ts +1 -1
  102. package/dist/pipeline/src/deploy/sbom.js +6 -3
  103. package/dist/pipeline/src/deploy/sbom.js.map +1 -1
  104. package/dist/pipeline/src/pipeline/createAllJobs.d.ts +12 -10
  105. package/dist/pipeline/src/pipeline/createAllJobs.js +84 -44
  106. package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
  107. package/dist/pipeline/src/pipeline/createChildPipeline.js.map +1 -1
  108. package/dist/pipeline/src/pipeline/createJobsForComponent.js +3 -4
  109. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  110. package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +3 -0
  111. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +10 -0
  112. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -0
  113. package/dist/pipeline/src/pipeline/createMainPipeline.js +18 -8
  114. package/dist/pipeline/src/pipeline/createMainPipeline.js.map +1 -1
  115. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.d.ts +3 -3
  116. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js +158 -51
  117. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  118. package/dist/pipeline/src/pipeline/packageManager.d.ts +2 -1
  119. package/dist/pipeline/src/pipeline/packageManager.js +36 -15
  120. package/dist/pipeline/src/pipeline/packageManager.js.map +1 -1
  121. package/dist/pipeline/src/types/config.d.ts +2 -1
  122. package/dist/pipeline/src/types/context.d.ts +77 -12
  123. package/dist/pipeline/src/types/context.js +9 -0
  124. package/dist/pipeline/src/types/context.js.map +1 -1
  125. package/dist/pipeline/src/types/environmentContext.d.ts +5 -6
  126. package/dist/pipeline/src/types/jobs.d.ts +5 -0
  127. package/dist/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +1 -1
  129. package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +2 -2
  130. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +2 -10
  131. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +1 -1
  132. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -4
  133. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +2 -2
  134. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +1 -11
  135. package/src/gcloud/serviceAccounts.ts +3 -3
@@ -1828,7 +1828,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1828
1828
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(sourceEnv, sourceComponent)];
1829
1829
  case 3:
1830
1830
  sourceContext = _g.sent();
1831
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, sourceContext.env, sourceContext.componentName)];
1831
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, sourceContext.env, sourceContext.name)];
1832
1832
  case 4:
1833
1833
  sourceEnvVars = _g.sent();
1834
1834
  closeAll = function () {
@@ -1870,7 +1870,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1870
1870
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(targetEnv, targetComponent)];
1871
1871
  case 9:
1872
1872
  targetContext = _g.sent();
1873
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, targetContext.env, targetContext.componentName)];
1873
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, targetContext.env, targetContext.name)];
1874
1874
  case 10:
1875
1875
  targetEnvVars = _g.sent();
1876
1876
  if (!(targetEnv === "local")) return [3 /*break*/, 11];
@@ -2081,7 +2081,7 @@ var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(vo
2081
2081
  if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
2082
2082
  throw new Error("unsupported");
2083
2083
  }
2084
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.componentName)];
2084
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.name)];
2085
2085
  case 1:
2086
2086
  envVars = _b.sent();
2087
2087
  cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
@@ -2107,7 +2107,7 @@ var getProxyInfoForCloudRun = function (vorpal, context) { return __awaiter(void
2107
2107
  !((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.cloudSql)) {
2108
2108
  throw new Error("unsupported");
2109
2109
  }
2110
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.componentName)];
2110
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.name)];
2111
2111
  case 1:
2112
2112
  envVars = _d.sent();
2113
2113
  DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
@@ -5414,7 +5414,7 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
5414
5414
  instance.log("domain suffix: " + suffix);
5415
5415
  return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
5416
5416
  _a[pipeline_1.GCLOUD_RUN_CANONICAL_HOST_SUFFIX] = suffix,
5417
- _a), context.env, context.componentName, false, // backup
5417
+ _a), context.env, context.name, false, // backup
5418
5418
  false)];
5419
5419
  case 5:
5420
5420
  _d.sent();
@@ -5481,7 +5481,7 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
5481
5481
  case 0:
5482
5482
  instance.log("");
5483
5483
  instance.log("==================================================================================");
5484
- instance.log("🐱 🔧 setting up " + context.env + ":" + context.componentName + "...");
5484
+ instance.log("🐱 🔧 setting up " + context.env + ":" + context.name + "...");
5485
5485
  instance.log("");
5486
5486
  if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) return [3 /*break*/, 2];
5487
5487
  return [4 /*yield*/, (0, setupCloudRun_1.setupCloudRun)(instance, context)];
@@ -5497,7 +5497,7 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
5497
5497
  _c.label = 4;
5498
5498
  case 4:
5499
5499
  instance.log("");
5500
- instance.log("✅ " + context.env + ":" + context.componentName + " done!");
5500
+ instance.log("✅ " + context.env + ":" + context.name + " done!");
5501
5501
  instance.log("");
5502
5502
  return [2 /*return*/];
5503
5503
  }
@@ -5602,7 +5602,7 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5602
5602
  // we name the service account and the role and the role binding with the same name
5603
5603
  // we currently create one per component to better separate them
5604
5604
  instance.log("ensuring service accounts...");
5605
- serviceAccountName = "cl-".concat(context.componentName, "-deploy");
5605
+ serviceAccountName = "cl-".concat(context.name, "-deploy");
5606
5606
  return [4 /*yield*/, (0, child_process_promise_1.exec)("TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'").then(function (s) { return s.stdout.trim(); })];
5607
5607
  case 7:
5608
5608
  KUBE_URL = _b.sent();
@@ -5658,7 +5658,7 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5658
5658
  instance.log("service accounts created / updated!");
5659
5659
  instance.log("");
5660
5660
  instance.log("pusing secrets to gitlab...");
5661
- return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.env, context.componentName, false)];
5661
+ return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.env, context.name, false)];
5662
5662
  case 19:
5663
5663
  _b.sent();
5664
5664
  instance.log("done!");
@@ -6026,22 +6026,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
6026
6026
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
6027
6027
  }
6028
6028
  };
6029
- var __read = (this && this.__read) || function (o, n) {
6030
- var m = typeof Symbol === "function" && o[Symbol.iterator];
6031
- if (!m) return o;
6032
- var i = m.call(o), r, ar = [], e;
6033
- try {
6034
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
6035
- }
6036
- catch (error) { e = { error: error }; }
6037
- finally {
6038
- try {
6039
- if (r && !r.done && (m = i["return"])) m.call(i);
6040
- }
6041
- finally { if (e) throw e.error; }
6042
- }
6043
- return ar;
6044
- };
6045
6029
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6046
6030
  var pipeline_1 = __nccwpck_require__(10603);
6047
6031
  var client_node_1 = __nccwpck_require__(15124);
@@ -6057,15 +6041,7 @@ function default_1(context) {
6057
6041
  namespaceBody = new client_node_1.V1Namespace();
6058
6042
  metadata = {
6059
6043
  name: namespace,
6060
- labels: __assign(__assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.env, components: Object.keys(context.fullConfig.components).join("_"), buildTypes: Object.values(context.fullConfig.components)
6061
- .map(function (config) { return config.build.type; })
6062
- .join("_") }, Object.fromEntries(Object.entries(context.fullConfig.components).map(function (_a) {
6063
- var _b = __read(_a, 2), componentName = _b[0], config = _b[1];
6064
- return [
6065
- "buildType_" + componentName,
6066
- config.build.type,
6067
- ];
6068
- }))), ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {})),
6044
+ labels: __assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.env, components: Object.keys(context.fullConfig.components).join("_") }, ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {})),
6069
6045
  };
6070
6046
  namespaceBody.metadata = metadata;
6071
6047
  k8sApi = (0, k8sApi_1.getk8sApi)();
@@ -7517,7 +7493,7 @@ var upsertGcloudServiceAccount = function (context, account) { return __awaiter(
7517
7493
  case 0:
7518
7494
  projectId = account.projectId, name = account.name, displayName = account.displayName, roles = account.roles, description = account.description;
7519
7495
  namePrefix = "".concat(name);
7520
- nameSuffixRaw = "".concat(context.env, "-").concat(context.componentName);
7496
+ nameSuffixRaw = "".concat(context.env, "-").concat(context.name);
7521
7497
  nameMiddleRaw = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
7522
7498
  MAX_LENGTH = 30;
7523
7499
  NUM_SEPARATORS = 2;
@@ -7531,7 +7507,7 @@ var upsertGcloudServiceAccount = function (context, account) { return __awaiter(
7531
7507
  nameSuffix = nameSuffixRaw;
7532
7508
  }
7533
7509
  fullName = "".concat(namePrefix, "-").concat(nameMiddle, "-").concat(nameSuffix);
7534
- fullDisplayName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, " ").concat(context.env, ":").concat(context.componentName, " | ").concat(displayName);
7510
+ fullDisplayName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, " ").concat(context.env, ":").concat(context.name, " | ").concat(displayName);
7535
7511
  fullIdentifier = "".concat(fullName, "@").concat(projectId, ".iam.gserviceaccount.com");
7536
7512
  return [4 /*yield*/, (0, exports.accountExists)(fullIdentifier)];
7537
7513
  case 1:
@@ -7617,7 +7593,7 @@ var upsertGcloudServiceAccountAndSaveSecret = function (instance, context, accou
7617
7593
  key = _b.sent();
7618
7594
  return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
7619
7595
  _a[secretName] = key,
7620
- _a), context.env, context.componentName)];
7596
+ _a), context.env, context.name)];
7621
7597
  case 2:
7622
7598
  _b.sent();
7623
7599
  instance.log("done!");
@@ -9700,6 +9676,94 @@ exports["default"] = replaceAsync;
9700
9676
 
9701
9677
  /***/ }),
9702
9678
 
9679
+ /***/ 43397:
9680
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
9681
+
9682
+ "use strict";
9683
+
9684
+ var __assign = (this && this.__assign) || function () {
9685
+ __assign = Object.assign || function(t) {
9686
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9687
+ s = arguments[i];
9688
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9689
+ t[p] = s[p];
9690
+ }
9691
+ return t;
9692
+ };
9693
+ return __assign.apply(this, arguments);
9694
+ };
9695
+ var __read = (this && this.__read) || function (o, n) {
9696
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
9697
+ if (!m) return o;
9698
+ var i = m.call(o), r, ar = [], e;
9699
+ try {
9700
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
9701
+ }
9702
+ catch (error) { e = { error: error }; }
9703
+ finally {
9704
+ try {
9705
+ if (r && !r.done && (m = i["return"])) m.call(i);
9706
+ }
9707
+ finally { if (e) throw e.error; }
9708
+ }
9709
+ return ar;
9710
+ };
9711
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9712
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
9713
+ if (ar || !(i in from)) {
9714
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
9715
+ ar[i] = from[i];
9716
+ }
9717
+ }
9718
+ return to.concat(ar || Array.prototype.slice.call(from));
9719
+ };
9720
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9721
+ exports.createBuildJobArtifacts = void 0;
9722
+ var path_1 = __nccwpck_require__(71017);
9723
+ var types_1 = __nccwpck_require__(11853);
9724
+ var lodash_1 = __nccwpck_require__(23255);
9725
+ var writeDotEnv_1 = __nccwpck_require__(48052);
9726
+ var createBuildJobArtifacts = function (context) {
9727
+ var _a, _b;
9728
+ var paths = context.type === "workspace"
9729
+ ? context.components.flatMap(function (c) { return getArtifactsPathForComponent(c); })
9730
+ : getArtifactsPathForComponent(context, ["__build_info.json"]);
9731
+ // esxclude .env files if generated
9732
+ var exclude = context.type === "workspace"
9733
+ ? context.components.flatMap(function (c) { return getDotEnvPathsForComponent(c); })
9734
+ : getDotEnvPathsForComponent(context);
9735
+ return __assign(__assign({ paths: (0, lodash_1.uniq)(paths).sort(function (a, b) { return a.localeCompare(b); }) }, (exclude.length > 0 ? { exclude: exclude } : {})), { expire_in: "1 day", when: "always", reports:
9736
+ // TODO: support for junit reports in other builds
9737
+ context.type === "component" && (0, types_1.componentContextIsStandaloneBuild)(context)
9738
+ ? {
9739
+ junit: (_b = (_a = context.build.config.artifactsReports) === null || _a === void 0 ? void 0 : _a.junit) === null || _b === void 0 ? void 0 : _b.map(function (p) {
9740
+ return (0, path_1.join)(context.build.dir, p);
9741
+ }),
9742
+ }
9743
+ : {} });
9744
+ };
9745
+ exports.createBuildJobArtifacts = createBuildJobArtifacts;
9746
+ var getArtifactsPathForComponent = function (c, additionalPaths) {
9747
+ var _a, _b;
9748
+ return (_b = __spreadArray(__spreadArray([], __read(((_a = c.build.config.artifactsPaths) !== null && _a !== void 0 ? _a : [])), false), __read((additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : [])), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
9749
+ return c.build
9750
+ // in theory, we only need "direct",
9751
+ // but in some cases project may have packages in the workspace that create build artifacts, which aren't components
9752
+ // this highly depends on the build tool. To be safe, we get all
9753
+ .getComponentDirs("all")
9754
+ .flatMap(function (cDir) { return (0, path_1.join)(cDir, artifact); });
9755
+ });
9756
+ };
9757
+ var getDotEnvPathsForComponent = function (c) {
9758
+ if ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c)) {
9759
+ return [(0, path_1.join)(c.build.dir, ".env")];
9760
+ }
9761
+ return [];
9762
+ };
9763
+ //# sourceMappingURL=createBuildJobArtifact.js.map
9764
+
9765
+ /***/ }),
9766
+
9703
9767
  /***/ 82786:
9704
9768
  /***/ ((__unused_webpack_module, exports) => {
9705
9769
 
@@ -9772,15 +9836,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9772
9836
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9773
9837
  exports.createAppBuildJob = void 0;
9774
9838
  var lodash_1 = __nccwpck_require__(23255);
9775
- var path_1 = __nccwpck_require__(71017);
9776
9839
  var __1 = __nccwpck_require__(10603);
9777
9840
  var utils_1 = __nccwpck_require__(32497);
9841
+ var createBuildJobArtifact_1 = __nccwpck_require__(43397);
9778
9842
  var yarn_1 = __nccwpck_require__(45043);
9779
9843
  var constants_1 = __nccwpck_require__(82786);
9780
9844
  var writeBuildInfo_1 = __nccwpck_require__(99578);
9781
9845
  var writeDotEnv_1 = __nccwpck_require__(48052);
9782
9846
  var createAppBuildJob = function (context, _a) {
9783
- var _b, _c, _d, _e, _f;
9847
+ var _b, _c, _d;
9784
9848
  var script = _a.script, variables = _a.variables, runnerVariables = _a.runnerVariables, def = __rest(_a, ["script", "variables", "runnerVariables"]);
9785
9849
  return (0, lodash_1.merge)({
9786
9850
  name: constants_1.APP_BUILD_JOB_NAME,
@@ -9789,20 +9853,21 @@ var createAppBuildJob = function (context, _a) {
9789
9853
  image: (0, __1.getRunnerImage)("jobs-default"),
9790
9854
  needs: [],
9791
9855
  cache: [],
9792
- 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 : {})),
9856
+ variables: __assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), (context.type === "component"
9857
+ ? __assign(__assign(__assign({}, context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {})) : {})),
9793
9858
  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 : {})),
9794
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
9795
- ? (0, writeDotEnv_1.writeDotEnv)(context)
9796
- : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
9859
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.type === "component"
9860
+ ? (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
9861
+ ? (0, writeDotEnv_1.writeDotEnv)(context)
9862
+ : []
9863
+ : context.type === "workspace"
9864
+ ? context.components
9865
+ .filter(function (c) { return (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c); })
9866
+ .flatMap(function (c) { return (0, writeDotEnv_1.writeDotEnv)(c); })
9867
+ : [])), false), __read((context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : [])), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
9797
9868
  "cd ".concat(context.build.dir)
9798
9869
  ], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
9799
- artifacts: __assign(__assign({ paths: [(0, path_1.join)(context.build.dir, "__build_info.json")] }, ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
9800
- ? { exclude: [(0, path_1.join)(context.build.dir, ".env")] }
9801
- : {})), { reports: {
9802
- 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) {
9803
- return (0, path_1.join)(context.build.dir, p);
9804
- }),
9805
- } }),
9870
+ artifacts: (0, createBuildJobArtifact_1.createBuildJobArtifacts)(context),
9806
9871
  }, def);
9807
9872
  };
9808
9873
  exports.createAppBuildJob = createAppBuildJob;
@@ -9918,23 +9983,41 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9918
9983
  return to.concat(ar || Array.prototype.slice.call(from));
9919
9984
  };
9920
9985
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9921
- exports.createBuildJobs = void 0;
9986
+ exports.createWorkspaceBuildJobs = exports.createComponentBuildJobs = void 0;
9922
9987
  var sbom_1 = __nccwpck_require__(44986);
9988
+ var context_1 = __nccwpck_require__(61724);
9923
9989
  var docker_1 = __nccwpck_require__(9641);
9924
9990
  var sbom_2 = __nccwpck_require__(37038);
9925
9991
  var constants_1 = __nccwpck_require__(82786);
9926
9992
  var createAppBuildJob_1 = __nccwpck_require__(7801);
9927
- var createBuildJobs = function (context, definitions) {
9993
+ var createComponentBuildJobs = function (context, definitions) {
9928
9994
  var _a;
9929
- return __spreadArray(__spreadArray(__spreadArray([], __read((definitions.appBuild
9995
+ return __spreadArray(__spreadArray(__spreadArray([], __read((definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context)
9930
9996
  ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)]
9931
9997
  : [])), false), __read(((0, docker_1.requiresDockerBuild)(context)
9932
9998
  ? [
9933
- (0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), { needs: __spreadArray(__spreadArray([], __read(((_a = definitions.dockerBuild.needs) !== null && _a !== void 0 ? _a : [])), false), __read((definitions.appBuild ? [constants_1.APP_BUILD_JOB_NAME] : [])), false) })),
9999
+ (0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), { needs: __spreadArray(__spreadArray([], __read(((_a = definitions.dockerBuild.needs) !== null && _a !== void 0 ? _a : [])), false), __read((definitions.appBuild &&
10000
+ (0, context_1.componentContextIsStandaloneBuild)(context)
10001
+ ? [constants_1.APP_BUILD_JOB_NAME]
10002
+ : (0, context_1.componentContextHasWorkspaceBuild)(context)
10003
+ ? [
10004
+ {
10005
+ job: constants_1.APP_BUILD_JOB_NAME,
10006
+ artifacts: true,
10007
+ workspaceName: context.build.workspaceName,
10008
+ },
10009
+ ]
10010
+ : [])), false) })),
9934
10011
  ]
9935
10012
  : [])), false), __read(((0, sbom_1.sbomDeactivated)(context) ? [] : [(0, sbom_2.createSbomBuildJob)(context)])), false);
9936
10013
  };
9937
- exports.createBuildJobs = createBuildJobs;
10014
+ exports.createComponentBuildJobs = createComponentBuildJobs;
10015
+ var createWorkspaceBuildJobs = function (context, definitions) {
10016
+ return definitions.appBuild
10017
+ ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)]
10018
+ : [];
10019
+ };
10020
+ exports.createWorkspaceBuildJobs = createWorkspaceBuildJobs;
9938
10021
  //# sourceMappingURL=index.js.map
9939
10022
 
9940
10023
  /***/ }),
@@ -9980,6 +10063,7 @@ var __read = (this && this.__read) || function (o, n) {
9980
10063
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9981
10064
  exports.componentContextNeedsBuildTimeDotEnv = exports.writeDotEnv = void 0;
9982
10065
  var lodash_1 = __nccwpck_require__(23255);
10066
+ var gitlab_1 = __nccwpck_require__(38490);
9983
10067
  /**
9984
10068
  * writes a .env file in the components folder
9985
10069
  * @param context
@@ -9999,9 +10083,9 @@ var writeDotEnv = function (context) {
9999
10083
  return "".concat(key, "=").concat(value === null || value === void 0 ? void 0 : value.toString().replaceAll("\n", "\\n"));
10000
10084
  })
10001
10085
  .join("\n");
10002
- return [
10086
+ return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")([
10003
10087
  "cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
10004
- ];
10088
+ ]);
10005
10089
  };
10006
10090
  exports.writeDotEnv = writeDotEnv;
10007
10091
  var componentContextNeedsBuildTimeDotEnv = function (context) {
@@ -10044,7 +10128,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10044
10128
  };
10045
10129
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10046
10130
  exports.createCustomBuildJobs = void 0;
10047
- var path_1 = __nccwpck_require__(71017);
10048
10131
  var utils_1 = __nccwpck_require__(32497);
10049
10132
  var docker_1 = __nccwpck_require__(9641);
10050
10133
  var types_1 = __nccwpck_require__(84466);
@@ -10055,12 +10138,12 @@ var RUNNER_BUILD_VARIABLES = {
10055
10138
  KUBERNETES_MEMORY_LIMIT: "4Gi",
10056
10139
  };
10057
10140
  var createCustomBuildJobs = function (context) {
10058
- var _a, _b, _c;
10141
+ var _a;
10059
10142
  var buildConfig = context.build.config;
10060
10143
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
10061
10144
  throw new Error("deploy config is not custom");
10062
10145
  }
10063
- return (0, base_1.createBuildJobs)(context, {
10146
+ return (0, base_1.createComponentBuildJobs)(context, {
10064
10147
  appBuild: buildConfig.buildCommand !== null
10065
10148
  ? {
10066
10149
  image: buildConfig.jobImage,
@@ -10068,15 +10151,6 @@ var createCustomBuildJobs = function (context) {
10068
10151
  cache: buildConfig.jobCache,
10069
10152
  services: buildConfig.jobServices,
10070
10153
  script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
10071
- artifacts: {
10072
- paths: __spreadArray([
10073
- (0, path_1.join)(context.build.dir, "__build_info.json"),
10074
- (0, path_1.join)(context.build.dir, "dist")
10075
- ], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
10076
- return (0, path_1.join)(context.build.dir, path);
10077
- })) !== null && _c !== void 0 ? _c : [])), false),
10078
- expire_in: "1 day",
10079
- },
10080
10154
  }
10081
10155
  : undefined,
10082
10156
  dockerBuild: {
@@ -10298,9 +10372,9 @@ var getDockerImageVariables = function (context) {
10298
10372
  : // gitlab registry:
10299
10373
  {
10300
10374
  DOCKER_REGISTRY: "$CI_REGISTRY",
10301
- DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
10375
+ DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.name,
10302
10376
  // ONLY USED IN KUBERNETES
10303
- DOCKER_IMAGE_NAME: context.env + "/" + context.componentName,
10377
+ DOCKER_IMAGE_NAME: context.env + "/" + context.name,
10304
10378
  DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME",
10305
10379
  })), { DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA" });
10306
10380
  };
@@ -10381,10 +10455,10 @@ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
10381
10455
  };
10382
10456
  var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
10383
10457
  var _a;
10384
- var type = "docker" in context.componentConfig.build &&
10385
- context.componentConfig.build.docker &&
10386
- "type" in context.componentConfig.build.docker
10387
- ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
10458
+ var type = "docker" in context.build.config &&
10459
+ context.build.config.docker &&
10460
+ "type" in context.build.config.docker
10461
+ ? (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.type
10388
10462
  : defaultType;
10389
10463
  return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
10390
10464
  };
@@ -10429,41 +10503,47 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10429
10503
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
10430
10504
  };
10431
10505
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10432
- exports.BUILD_TYPES = void 0;
10506
+ exports.WORKSPACE_BUILD_TYPES = exports.BUILD_TYPES = void 0;
10433
10507
  var custom_1 = __nccwpck_require__(41183);
10434
10508
  var node_1 = __nccwpck_require__(95734);
10435
10509
  var rails_1 = __nccwpck_require__(18513);
10436
- __exportStar(__nccwpck_require__(84466), exports);
10437
10510
  __exportStar(__nccwpck_require__(95734), exports);
10511
+ __exportStar(__nccwpck_require__(84466), exports);
10438
10512
  exports.BUILD_TYPES = {
10439
10513
  node: {
10440
10514
  jobs: node_1.createNodeJobs,
10441
10515
  defaults: function () { return ({
10442
10516
  buildCommand: "yarn build",
10443
10517
  startCommand: "yarn start",
10518
+ artifactsPaths: ["dist", ".next"],
10444
10519
  }); },
10445
10520
  },
10446
10521
  "node-static": {
10447
10522
  jobs: node_1.createNodeJobs,
10448
10523
  defaults: function () { return ({
10449
10524
  buildCommand: "yarn build",
10525
+ artifactsPaths: ["dist"],
10450
10526
  }); },
10451
10527
  },
10452
10528
  storybook: {
10453
10529
  jobs: node_1.createStorybookJobs,
10454
10530
  defaults: function () { return ({
10455
10531
  buildCommand: ["yarn build-storybook --quiet -o ./dist"],
10532
+ artifactsPaths: ["dist"],
10456
10533
  }); },
10457
10534
  },
10458
10535
  meteor: {
10459
10536
  jobs: node_1.createMeteorJobs,
10460
10537
  defaults: function () { return ({
10461
10538
  startCommand: "node main.js",
10539
+ artifactsPaths: ["dist"],
10462
10540
  }); },
10463
10541
  },
10464
10542
  custom: {
10465
10543
  jobs: custom_1.createCustomJobs,
10466
- defaults: function () { return ({}); },
10544
+ defaults: function () { return ({
10545
+ artifactsPaths: ["dist"],
10546
+ }); },
10467
10547
  },
10468
10548
  rails: {
10469
10549
  jobs: rails_1.createRailsJobs,
@@ -10476,6 +10556,20 @@ exports.BUILD_TYPES = {
10476
10556
  }); },
10477
10557
  },
10478
10558
  };
10559
+ exports.WORKSPACE_BUILD_TYPES = {
10560
+ node: {
10561
+ jobs: node_1.createNodeJobs,
10562
+ defaults: function () { return ({
10563
+ buildCommand: "yarn build",
10564
+ lint: {
10565
+ command: "yarn lint",
10566
+ },
10567
+ test: {
10568
+ command: "yarn test",
10569
+ },
10570
+ }); },
10571
+ },
10572
+ };
10479
10573
  //# sourceMappingURL=index.js.map
10480
10574
 
10481
10575
  /***/ }),
@@ -10511,9 +10605,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10511
10605
  return to.concat(ar || Array.prototype.slice.call(from));
10512
10606
  };
10513
10607
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10514
- exports.createNodeBuildJobs = void 0;
10515
- var path_1 = __nccwpck_require__(71017);
10608
+ exports.createNodeDockerJobDefinition = exports.createNodeBuildJobDefinition = exports.createNodeBuildJobs = void 0;
10516
10609
  var runner_1 = __nccwpck_require__(4058);
10610
+ var context_1 = __nccwpck_require__(61724);
10517
10611
  var utils_1 = __nccwpck_require__(32497);
10518
10612
  var base_1 = __nccwpck_require__(9366);
10519
10613
  var docker_1 = __nccwpck_require__(9641);
@@ -10522,54 +10616,56 @@ var cache_1 = __nccwpck_require__(72026);
10522
10616
  var constants_1 = __nccwpck_require__(31765);
10523
10617
  var yarn_1 = __nccwpck_require__(45043);
10524
10618
  var createNodeBuildJobs = function (context) {
10525
- var _a, _b, _c, _d, _e;
10619
+ if (context.type === "workspace") {
10620
+ return (0, base_1.createWorkspaceBuildJobs)(context, {
10621
+ appBuild: (0, exports.createNodeBuildJobDefinition)(context),
10622
+ });
10623
+ }
10624
+ return (0, base_1.createComponentBuildJobs)(context, {
10625
+ appBuild: (0, context_1.componentContextIsStandaloneBuild)(context)
10626
+ ? (0, exports.createNodeBuildJobDefinition)(context)
10627
+ : undefined,
10628
+ dockerBuild: (0, exports.createNodeDockerJobDefinition)(context),
10629
+ });
10630
+ };
10631
+ exports.createNodeBuildJobs = createNodeBuildJobs;
10632
+ var createNodeBuildJobDefinition = function (context) {
10633
+ var _a, _b, _c;
10526
10634
  var buildConfig = context.build.config;
10527
10635
  if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
10528
10636
  throw new Error("deploy config is not node, node-static or storybook");
10529
10637
  }
10638
+ if (buildConfig.buildCommand === null)
10639
+ return undefined;
10530
10640
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
10531
10641
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10532
- return (0, base_1.createBuildJobs)(context, {
10533
- appBuild: buildConfig.buildCommand !== null
10534
- ? {
10535
- image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
10536
- runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10537
- cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
10538
- script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
10539
- artifacts: {
10540
- paths: __spreadArray([
10541
- context.build.dir
10542
- ], __read(((_d = context.packageManagerInfo.currentWorkspaceDependencies) !== null && _d !== void 0 ? _d : [])), false).flatMap(function (dir) {
10543
- var _a, _b;
10544
- return __spreadArray([
10545
- (0, path_1.join)(dir, "__build_info.json"),
10546
- (0, path_1.join)(dir, "dist"),
10547
- (0, path_1.join)(dir, ".next")
10548
- ], __read(((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
10549
- return (0, path_1.join)(dir, path);
10550
- })) !== null && _b !== void 0 ? _b : [])), false);
10551
- }),
10552
- expire_in: "1 day",
10553
- when: "always",
10554
- },
10555
- jobTags: buildConfig.jobTags,
10556
- }
10557
- : undefined,
10558
- dockerBuild: {
10559
- script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
10560
- ? "nginx"
10561
- : "node"),
10562
- cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
10563
- variables: {
10564
- // only required for non static
10565
- DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
10566
- DOCKER_COPY_WORKSPACE_FILES: (_e = context.packageManagerInfo.pathsToCopyInDocker
10567
- .map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _e === void 0 ? void 0 : _e.join("\n"),
10568
- },
10642
+ return {
10643
+ image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
10644
+ runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10645
+ cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
10646
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
10647
+ jobTags: buildConfig.jobTags,
10648
+ };
10649
+ };
10650
+ exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
10651
+ var createNodeDockerJobDefinition = function (context) {
10652
+ var _a, _b;
10653
+ // get the default docker built-in type based on the build type
10654
+ var dockerDefaultBuiltIn = context.build.buildType === "node-static" ||
10655
+ context.build.buildType === "storybook"
10656
+ ? "nginx"
10657
+ : "node";
10658
+ return {
10659
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
10660
+ cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
10661
+ variables: {
10662
+ // only required for non static
10663
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
10664
+ DOCKER_COPY_WORKSPACE_FILES: (_b = (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _b === void 0 ? void 0 : _b.join("\n"),
10569
10665
  },
10570
- });
10666
+ };
10571
10667
  };
10572
- exports.createNodeBuildJobs = createNodeBuildJobs;
10668
+ exports.createNodeDockerJobDefinition = createNodeDockerJobDefinition;
10573
10669
  //# sourceMappingURL=buildJob.js.map
10574
10670
 
10575
10671
  /***/ }),
@@ -10614,7 +10710,8 @@ var path_1 = __nccwpck_require__(71017);
10614
10710
  var slugify_1 = __importDefault(__nccwpck_require__(44035));
10615
10711
  var getYarnCache = function (context, policy) {
10616
10712
  if (policy === void 0) { policy = "pull-push"; }
10617
- var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
10713
+ var componentIsInWorkspace = context.type === "component" &&
10714
+ context.packageManagerInfo.componentIsInWorkspace;
10618
10715
  return [
10619
10716
  componentIsInWorkspace
10620
10717
  ? {
@@ -10633,7 +10730,8 @@ exports.getYarnCache = getYarnCache;
10633
10730
  var getNodeModulesCache = function (context, policy) {
10634
10731
  var _a;
10635
10732
  if (policy === void 0) { policy = "pull-push"; }
10636
- var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
10733
+ var componentIsInWorkspace = context.type === "component" &&
10734
+ context.packageManagerInfo.componentIsInWorkspace;
10637
10735
  // We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
10638
10736
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
10639
10737
  return [
@@ -10659,13 +10757,19 @@ var getNodeCache = function (context, policy) {
10659
10757
  return __spreadArray(__spreadArray([], __read((0, exports.getYarnCache)(context, policy)), false), __read((0, exports.getNodeModulesCache)(context, policy)), false);
10660
10758
  };
10661
10759
  exports.getNodeCache = getNodeCache;
10662
- var getNextCache = function (context) { return [
10663
- {
10664
- key: context.componentName + "-next-cache",
10665
- policy: "pull-push",
10666
- paths: [context.build.dir + "/.next/cache/"],
10667
- },
10668
- ]; };
10760
+ var getNextCache = function (context) {
10761
+ var key = context.name + "-next-cache";
10762
+ var paths = context.build
10763
+ .getComponentDirs("direct")
10764
+ .map(function (c) { return (0, path_1.join)(c, ".next/cache"); });
10765
+ return [
10766
+ {
10767
+ key: key,
10768
+ policy: "pull-push",
10769
+ paths: paths,
10770
+ },
10771
+ ];
10772
+ };
10669
10773
  exports.getNextCache = getNextCache;
10670
10774
  //# sourceMappingURL=cache.js.map
10671
10775
 
@@ -10779,7 +10883,7 @@ var cache_1 = __nccwpck_require__(72026);
10779
10883
  var yarn_1 = __nccwpck_require__(45043);
10780
10884
  var getMeteorCache = function (context) { return [
10781
10885
  {
10782
- key: context.componentName + "meteor-build-cache",
10886
+ key: context.name + "meteor-build-cache",
10783
10887
  policy: "pull-push",
10784
10888
  paths: [
10785
10889
  (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
@@ -10795,7 +10899,7 @@ var createMeteorBuildJobs = function (context) {
10795
10899
  throw new Error("deploy config is not meteor");
10796
10900
  }
10797
10901
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10798
- return (0, base_1.createBuildJobs)(context, {
10902
+ return (0, base_1.createComponentBuildJobs)(context, {
10799
10903
  appBuild: buildConfig.buildCommand !== null
10800
10904
  ? {
10801
10905
  cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
@@ -10810,12 +10914,6 @@ var createMeteorBuildJobs = function (context) {
10810
10914
  'TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory',
10811
10915
  "cp ./__build_info.json ./dist/bundle/programs/server",
10812
10916
  ], false),
10813
- artifacts: {
10814
- paths: [
10815
- context.build.dir + "/__build_info.json",
10816
- context.build.dir + "/dist",
10817
- ],
10818
- },
10819
10917
  }
10820
10918
  : undefined,
10821
10919
  dockerBuild: {
@@ -10875,11 +10973,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10875
10973
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10876
10974
  exports.createNodeTestJobs = void 0;
10877
10975
  var runner_1 = __nccwpck_require__(4058);
10976
+ var context_1 = __nccwpck_require__(61724);
10878
10977
  var utils_1 = __nccwpck_require__(32497);
10978
+ var createArtifactsConfig_1 = __nccwpck_require__(12820);
10879
10979
  var cache_1 = __nccwpck_require__(72026);
10880
10980
  var constants_1 = __nccwpck_require__(31765);
10881
10981
  var yarn_1 = __nccwpck_require__(45043);
10882
- var createArtifactsConfig_1 = __nccwpck_require__(12820);
10883
10982
  var createNodeTestJobs = function (context) {
10884
10983
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
10885
10984
  // don't run tests after release
@@ -10887,15 +10986,21 @@ var createNodeTestJobs = function (context) {
10887
10986
  if (context.trigger === "taggedRelease") {
10888
10987
  return [];
10889
10988
  }
10890
- var buildConfig = context.build.config;
10989
+ // if its not a standalone build, we don't need to run tests
10990
+ if (context.type === "component" &&
10991
+ !(0, context_1.componentContextIsStandaloneBuild)(context)) {
10992
+ return [];
10993
+ }
10891
10994
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
10892
10995
  var base = {
10893
- variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
10996
+ variables: __assign({ APP_PATH: context.build.dir }, (context.type === "component"
10997
+ ? __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {})) : {})),
10894
10998
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10895
10999
  stage: "test",
10896
11000
  needs: [],
10897
11001
  envMode: "none",
10898
11002
  };
11003
+ var buildConfig = context.build.config;
10899
11004
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10900
11005
  var auditJob = buildConfig.audit !== false
10901
11006
  ? __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([
@@ -10973,7 +11078,7 @@ var ensureNodeVersion = function (context) {
10973
11078
  exports.ensureNodeVersion = ensureNodeVersion;
10974
11079
  var getYarnInstall = function (context, options) {
10975
11080
  var _a;
10976
- var postInstall = "postInstall" in context.build.config
11081
+ var postInstall = context.type !== "workspace" && "postInstall" in context.build.config
10977
11082
  ? context.build.config.postInstall
10978
11083
  : null;
10979
11084
  return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read((postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
@@ -11046,6 +11151,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11046
11151
  };
11047
11152
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11048
11153
  exports.createRailsBuildJobs = void 0;
11154
+ var __1 = __nccwpck_require__(10603);
11049
11155
  var base_1 = __nccwpck_require__(9366);
11050
11156
  var docker_1 = __nccwpck_require__(9641);
11051
11157
  var types_1 = __nccwpck_require__(84466);
@@ -11056,8 +11162,12 @@ var createRailsBuildJobs = function (context) {
11056
11162
  // should not happen
11057
11163
  throw new Error("build type is not rails");
11058
11164
  }
11165
+ // if its not a standalone build, we don't need to run tests
11166
+ if (!(0, __1.componentContextIsStandaloneBuild)(context)) {
11167
+ throw new Error("workspace builds are not supported for rails apps");
11168
+ }
11059
11169
  if ((0, docker_1.hasDockerfile)(context)) {
11060
- return (0, base_1.createBuildJobs)(context, {
11170
+ return (0, base_1.createComponentBuildJobs)(context, {
11061
11171
  appBuild: undefined,
11062
11172
  dockerBuild: {
11063
11173
  script: (0, docker_1.getDockerBuildDefaultScript)(context),
@@ -11072,7 +11182,7 @@ var createRailsBuildJobs = function (context) {
11072
11182
  return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
11073
11183
  })
11074
11184
  .join(" ");
11075
- return (0, base_1.createBuildJobs)(context, {
11185
+ return (0, base_1.createComponentBuildJobs)(context, {
11076
11186
  appBuild: undefined,
11077
11187
  dockerBuild: {
11078
11188
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
@@ -11179,6 +11289,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11179
11289
  };
11180
11290
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11181
11291
  exports.createRailsTestJobs = void 0;
11292
+ var __1 = __nccwpck_require__(10603);
11182
11293
  var utils_1 = __nccwpck_require__(32497);
11183
11294
  var createRailsTestJobs = function (context) {
11184
11295
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
@@ -11187,6 +11298,10 @@ var createRailsTestJobs = function (context) {
11187
11298
  if (context.trigger === "taggedRelease") {
11188
11299
  return [];
11189
11300
  }
11301
+ // if its not a standalone build, we don't need to run tests
11302
+ if (!(0, __1.componentContextIsStandaloneBuild)(context)) {
11303
+ return [];
11304
+ }
11190
11305
  var buildConfig = context.build.config;
11191
11306
  var base = {
11192
11307
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
@@ -11240,6 +11355,7 @@ exports.createRailsTestJobs = createRailsTestJobs;
11240
11355
 
11241
11356
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11242
11357
  exports.createSbomBuildJob = exports.SBOM_FILE = exports.SBOM_BUILD_JOB_NAME = void 0;
11358
+ var _1 = __nccwpck_require__(67862);
11243
11359
  var utils_1 = __nccwpck_require__(32497);
11244
11360
  exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
11245
11361
  exports.SBOM_FILE = "__sbom.json";
@@ -11252,10 +11368,14 @@ var createSbomBuildJob = function (context) {
11252
11368
  ? "."
11253
11369
  : context.build.dir),
11254
11370
  ];
11255
- var image = buildConfig.type === "custom" && buildConfig.sbom !== false
11371
+ var image = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
11372
+ buildConfig.type === "custom" &&
11373
+ buildConfig.sbom !== false
11256
11374
  ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage
11257
11375
  : defaultImage;
11258
- var script = buildConfig.type === "custom" && buildConfig.sbom !== false
11376
+ var script = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
11377
+ buildConfig.type === "custom" &&
11378
+ buildConfig.sbom !== false
11259
11379
  ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
11260
11380
  : defaultScript;
11261
11381
  return {
@@ -11283,12 +11403,20 @@ exports.createSbomBuildJob = createSbomBuildJob;
11283
11403
  "use strict";
11284
11404
 
11285
11405
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11286
- exports.isOfBuildType = void 0;
11406
+ exports.isOfBuildType = exports.isStandaloneBuildConfig = void 0;
11407
+ var isStandaloneBuildConfig = function (t) {
11408
+ if (!t)
11409
+ return false;
11410
+ return !("from" in t);
11411
+ };
11412
+ exports.isStandaloneBuildConfig = isStandaloneBuildConfig;
11287
11413
  var isOfBuildType = function (t) {
11288
11414
  var types = [];
11289
11415
  for (var _i = 1; _i < arguments.length; _i++) {
11290
11416
  types[_i - 1] = arguments[_i];
11291
11417
  }
11418
+ if (!(0, exports.isStandaloneBuildConfig)(t))
11419
+ return false;
11292
11420
  return types.includes(t.type);
11293
11421
  };
11294
11422
  exports.isOfBuildType = isOfBuildType;
@@ -11461,6 +11589,81 @@ exports.DOCKER_REGISTRY = process.env.INLINE_DOCKER_REGISTRY ||
11461
11589
 
11462
11590
  /***/ }),
11463
11591
 
11592
+ /***/ 28375:
11593
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
11594
+
11595
+ "use strict";
11596
+
11597
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11598
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11599
+ return new (P || (P = Promise))(function (resolve, reject) {
11600
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11601
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11602
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11603
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11604
+ });
11605
+ };
11606
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11607
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11608
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11609
+ function verb(n) { return function (v) { return step([n, v]); }; }
11610
+ function step(op) {
11611
+ if (f) throw new TypeError("Generator is already executing.");
11612
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
11613
+ 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;
11614
+ if (y = 0, t) op = [op[0] & 2, t.value];
11615
+ switch (op[0]) {
11616
+ case 0: case 1: t = op; break;
11617
+ case 4: _.label++; return { value: op[1], done: false };
11618
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11619
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11620
+ default:
11621
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11622
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11623
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11624
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11625
+ if (t[2]) _.ops.pop();
11626
+ _.trys.pop(); continue;
11627
+ }
11628
+ op = body.call(thisArg, _);
11629
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11630
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11631
+ }
11632
+ };
11633
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
11634
+ exports.createAllComponentsContext = void 0;
11635
+ var configruedEnvs_1 = __nccwpck_require__(45449);
11636
+ var createComponentContext_1 = __nccwpck_require__(92775);
11637
+ var createAllComponentsContext = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
11638
+ var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
11639
+ return __generator(this, function (_c) {
11640
+ switch (_c.label) {
11641
+ case 0: return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
11642
+ var envs = (0, configruedEnvs_1.getAllEnvsByTrigger)(config, componentName, trigger);
11643
+ return envs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
11644
+ return __generator(this, function (_a) {
11645
+ switch (_a.label) {
11646
+ case 0: return [4 /*yield*/, (0, createComponentContext_1.createComponentContext)({
11647
+ config: config,
11648
+ componentName: componentName,
11649
+ env: env,
11650
+ trigger: trigger,
11651
+ pipelineType: pipelineType,
11652
+ })];
11653
+ case 1: return [2 /*return*/, _a.sent()];
11654
+ }
11655
+ });
11656
+ }); });
11657
+ }))];
11658
+ case 1: return [2 /*return*/, _c.sent()];
11659
+ }
11660
+ });
11661
+ }); };
11662
+ exports.createAllComponentsContext = createAllComponentsContext;
11663
+ //# sourceMappingURL=createAllComponentsContext.js.map
11664
+
11665
+ /***/ }),
11666
+
11464
11667
  /***/ 92775:
11465
11668
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
11466
11669
 
@@ -11513,56 +11716,122 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
11513
11716
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11514
11717
  }
11515
11718
  };
11719
+ var __read = (this && this.__read) || function (o, n) {
11720
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
11721
+ if (!m) return o;
11722
+ var i = m.call(o), r, ar = [], e;
11723
+ try {
11724
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
11725
+ }
11726
+ catch (error) { e = { error: error }; }
11727
+ finally {
11728
+ try {
11729
+ if (r && !r.done && (m = i["return"])) m.call(i);
11730
+ }
11731
+ finally { if (e) throw e.error; }
11732
+ }
11733
+ return ar;
11734
+ };
11735
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11736
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
11737
+ if (ar || !(i in from)) {
11738
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
11739
+ ar[i] = from[i];
11740
+ }
11741
+ }
11742
+ return to.concat(ar || Array.prototype.slice.call(from));
11743
+ };
11516
11744
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11517
- exports.createContext = exports.createComponentContext = void 0;
11745
+ exports.createComponentContext = void 0;
11518
11746
  var lodash_1 = __nccwpck_require__(23255);
11519
11747
  var build_1 = __nccwpck_require__(67862);
11520
11748
  var deploy_1 = __nccwpck_require__(68483);
11749
+ var packageManager_1 = __nccwpck_require__(76451);
11521
11750
  var utils_1 = __nccwpck_require__(32497);
11522
11751
  var getEnvironment_1 = __nccwpck_require__(45699);
11523
11752
  var getEnvironmentContext_1 = __nccwpck_require__(13663);
11524
- var packageManager_1 = __nccwpck_require__(76451);
11525
11753
  var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
11526
- var packageManagerInfo, envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
11527
- return __generator(this, function (_a) {
11528
- switch (_a.label) {
11754
+ var packageManagerInfo, envContext, componentConfigWithoutDefaults, resolvedBuildType, defaults, componentConfig, environment, deploy, build, customJobs, dir, getComponentDirs, _getBuildContext, buildContext, context, resolvedCustomJobs;
11755
+ var _a;
11756
+ return __generator(this, function (_b) {
11757
+ switch (_b.label) {
11529
11758
  case 0:
11530
11759
  if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
11531
11760
  throw new Error("componentName may only contain lower case letters, numbers and -");
11532
11761
  }
11533
11762
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName)];
11534
11763
  case 1:
11535
- packageManagerInfo = _a.sent();
11764
+ packageManagerInfo = _b.sent();
11536
11765
  envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
11537
11766
  componentConfigWithoutDefaults = envContext.envConfigRaw;
11767
+ resolvedBuildType = (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build)
11768
+ ? componentConfigWithoutDefaults.build.type
11769
+ : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
11770
+ if (!resolvedBuildType) {
11771
+ throw new Error("build type not found, is the build config correct?");
11772
+ }
11538
11773
  defaults = componentConfigWithoutDefaults.deploy
11539
11774
  ? {
11540
- build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
11775
+ build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
11541
11776
  deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
11542
11777
  }
11543
11778
  : {
11544
- build: {},
11779
+ build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
11545
11780
  deploy: {},
11546
11781
  };
11547
11782
  componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
11548
11783
  return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
11549
11784
  case 2:
11550
- environment = _a.sent();
11785
+ environment = _b.sent();
11551
11786
  deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
11787
+ getComponentDirs = function (mode) {
11788
+ var _a;
11789
+ return __spreadArray([
11790
+ dir
11791
+ ], __read((mode === "all"
11792
+ ? (_a = packageManagerInfo.currentWorkspaceDependencies) !== null && _a !== void 0 ? _a : []
11793
+ : [])), false);
11794
+ };
11795
+ _getBuildContext = function () {
11796
+ var _a;
11797
+ if ((0, build_1.isStandaloneBuildConfig)(build)) {
11798
+ return {
11799
+ dir: dir,
11800
+ getComponentDirs: getComponentDirs,
11801
+ config: build,
11802
+ buildType: build.type,
11803
+ type: "standalone",
11804
+ };
11805
+ }
11806
+ // must be shared build
11807
+ var referencedBuild = (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[build.from];
11808
+ if (!referencedBuild) {
11809
+ throw new Error("build.from not found in config");
11810
+ }
11811
+ return {
11812
+ dir: dir,
11813
+ getComponentDirs: getComponentDirs,
11814
+ config: build,
11815
+ workspaceBuildConfig: referencedBuild,
11816
+ workspaceName: build.from,
11817
+ buildType: referencedBuild.type,
11818
+ type: "fromWorkspace",
11819
+ };
11820
+ };
11821
+ buildContext = _getBuildContext();
11552
11822
  context = {
11823
+ type: "component",
11824
+ name: ctx.componentName,
11825
+ componentName: ctx.componentName,
11826
+ env: ctx.env,
11553
11827
  fullConfig: ctx.config,
11554
11828
  componentConfig: componentConfig,
11555
- env: ctx.env,
11556
- build: {
11557
- dir: dir,
11558
- config: build,
11559
- },
11829
+ build: buildContext,
11560
11830
  deploy: deploy
11561
11831
  ? {
11562
11832
  config: deploy,
11563
11833
  }
11564
11834
  : null,
11565
- componentName: ctx.componentName,
11566
11835
  environment: environment,
11567
11836
  packageManagerInfo: packageManagerInfo,
11568
11837
  pipelineType: ctx.pipelineType,
@@ -11576,14 +11845,103 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
11576
11845
  });
11577
11846
  }); };
11578
11847
  exports.createComponentContext = createComponentContext;
11579
- /**
11580
- * @deprecated use createComponentContext instead
11581
- */
11582
- exports.createContext = exports.createComponentContext;
11583
11848
  //# sourceMappingURL=createComponentContext.js.map
11584
11849
 
11585
11850
  /***/ }),
11586
11851
 
11852
+ /***/ 76558:
11853
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
11854
+
11855
+ "use strict";
11856
+
11857
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11858
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11859
+ return new (P || (P = Promise))(function (resolve, reject) {
11860
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11861
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11862
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11863
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11864
+ });
11865
+ };
11866
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11867
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11868
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11869
+ function verb(n) { return function (v) { return step([n, v]); }; }
11870
+ function step(op) {
11871
+ if (f) throw new TypeError("Generator is already executing.");
11872
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
11873
+ 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;
11874
+ if (y = 0, t) op = [op[0] & 2, t.value];
11875
+ switch (op[0]) {
11876
+ case 0: case 1: t = op; break;
11877
+ case 4: _.label++; return { value: op[1], done: false };
11878
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11879
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11880
+ default:
11881
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11882
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11883
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11884
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11885
+ if (t[2]) _.ops.pop();
11886
+ _.trys.pop(); continue;
11887
+ }
11888
+ op = body.call(thisArg, _);
11889
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11890
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11891
+ }
11892
+ };
11893
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
11894
+ exports.createWorkspaceContext = void 0;
11895
+ var __1 = __nccwpck_require__(10603);
11896
+ var packageManager_1 = __nccwpck_require__(76451);
11897
+ var utils_1 = __nccwpck_require__(32497);
11898
+ var lodash_1 = __nccwpck_require__(23255);
11899
+ function createWorkspaceContext(_a) {
11900
+ return __awaiter(this, arguments, void 0, function (_b) {
11901
+ var workspaceConfigRaw, defaults, workspaceConfig;
11902
+ var _c;
11903
+ var _d, _e;
11904
+ var env = _b.env, components = _b.components, workspaceName = _b.workspaceName, config = _b.config, pipelineType = _b.pipelineType, trigger = _b.trigger;
11905
+ return __generator(this, function (_f) {
11906
+ switch (_f.label) {
11907
+ case 0:
11908
+ workspaceConfigRaw = (_d = config.builds) === null || _d === void 0 ? void 0 : _d[workspaceName];
11909
+ if (!workspaceConfigRaw) {
11910
+ throw new Error("Workspace ".concat(workspaceName, " not found in config"));
11911
+ }
11912
+ defaults = __1.WORKSPACE_BUILD_TYPES[workspaceConfigRaw.type].defaults();
11913
+ workspaceConfig = (0, utils_1.mergeWithMergingArrays)(defaults, workspaceConfigRaw);
11914
+ _c = {
11915
+ name: workspaceName,
11916
+ pipelineType: pipelineType,
11917
+ trigger: trigger,
11918
+ type: "workspace",
11919
+ workspaceConfig: workspaceConfig,
11920
+ env: env,
11921
+ components: components,
11922
+ fullConfig: config
11923
+ };
11924
+ return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoBase)()];
11925
+ case 1: return [2 /*return*/, (_c.packageManagerInfo = _f.sent(),
11926
+ _c.build = {
11927
+ type: "workspace",
11928
+ dir: (_e = workspaceConfig.dir) !== null && _e !== void 0 ? _e : ".",
11929
+ getComponentDirs: function (mode) {
11930
+ return (0, lodash_1.uniq)(components.flatMap(function (c) { return c.build.getComponentDirs(mode); }));
11931
+ },
11932
+ buildType: workspaceConfig.type,
11933
+ config: workspaceConfig,
11934
+ },
11935
+ _c)];
11936
+ }
11937
+ });
11938
+ });
11939
+ }
11940
+ exports.createWorkspaceContext = createWorkspaceContext;
11941
+ //# sourceMappingURL=createWorkspaceContext.js.map
11942
+
11943
+ /***/ }),
11944
+
11587
11945
  /***/ 17827:
11588
11946
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
11589
11947
 
@@ -11867,6 +12225,7 @@ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvir
11867
12225
  var lodash_1 = __nccwpck_require__(23255);
11868
12226
  var deploy_1 = __nccwpck_require__(68483);
11869
12227
  var BashExpression_1 = __nccwpck_require__(42376);
12228
+ var types_1 = __nccwpck_require__(84466);
11870
12229
  var getBuildInfoVariables_1 = __nccwpck_require__(17827);
11871
12230
  var getEnvironmentContext_1 = __nccwpck_require__(13663);
11872
12231
  var resolveReferences_1 = __nccwpck_require__(43115);
@@ -11897,7 +12256,8 @@ var getEnvironmentVariables = function (ctx_1) {
11897
12256
  port = (_c = devLocalConfig.port) !== null && _c !== void 0 ? _c : 3000;
11898
12257
  host = "localhost:" + port.toString();
11899
12258
  url = "http://" + host;
11900
- predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), { ENV_SHORT: "local", ROOT_URL: url }), (config.components[componentName].build.type === "rails"
12259
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), { ENV_SHORT: "local", ROOT_URL: url }), ((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
12260
+ buildConfigRaw.type === "rails"
11901
12261
  ? {}
11902
12262
  : { HOST: host })), { HOST_INTERNAL: host, ROOT_URL_INTERNAL: "http://" + host, PORT: port.toString() });
11903
12263
  }
@@ -11908,7 +12268,8 @@ var getEnvironmentVariables = function (ctx_1) {
11908
12268
  HOST_INTERNAL = (_d = additionalEnvVars.HOST_INTERNAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
11909
12269
  host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e : HOST_INTERNAL;
11910
12270
  url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
11911
- predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), (config.components[componentName].build.type === "rails"
12271
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), ((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
12272
+ buildConfigRaw.type === "rails"
11912
12273
  ? {}
11913
12274
  : { HOST: host })), { ROOT_URL: url, HOST_INTERNAL: HOST_INTERNAL,
11914
12275
  /**@deprecated */
@@ -11942,7 +12303,10 @@ var getEnvironmentVariables = function (ctx_1) {
11942
12303
  secretEnvVarKeys: secretEnvVarKeys
11943
12304
  };
11944
12305
  _b = {};
11945
- return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (buildConfigRaw && buildConfigRaw.jobVars) || null)];
12306
+ return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (buildConfigRaw &&
12307
+ (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
12308
+ buildConfigRaw.jobVars) ||
12309
+ null)];
11946
12310
  case 2:
11947
12311
  _b.build = _m.sent();
11948
12312
  return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (deployConfigRaw && deployConfigRaw.jobVars) || null)];
@@ -11960,7 +12324,7 @@ var sanitizeForEnVar = function (s) { return s.replace(/-/g, "_"); };
11960
12324
  var getSecretVarName = function (env, componentName, key) { return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key); }; // remove dash from component name
11961
12325
  exports.getSecretVarName = getSecretVarName;
11962
12326
  var addIndexVar = function (vars) { return (__assign(__assign({}, vars), { _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars)) })); };
11963
- var getSecretVarNameForContext = function (context, key) { return (0, exports.getSecretVarName)(context.env, context.componentName, key); };
12327
+ var getSecretVarNameForContext = function (context, key) { return (0, exports.getSecretVarName)(context.env, context.name, key); };
11964
12328
  exports.getSecretVarNameForContext = getSecretVarNameForContext;
11965
12329
  //# sourceMappingURL=getEnvironmentVariables.js.map
11966
12330
 
@@ -11996,8 +12360,8 @@ var sanitize = function (value) {
11996
12360
  return (0, slugify_1.default)(value).toLowerCase();
11997
12361
  };
11998
12362
  var getLabels = function (context) {
11999
- var _a, _b, _c;
12000
- 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.env), "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 : {}));
12363
+ var _a, _b;
12364
+ var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.name), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.env), "build-type": sanitize(context.build.buildType) }, ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {}));
12001
12365
  return labels;
12002
12366
  };
12003
12367
  exports.getLabels = getLabels;
@@ -12454,6 +12818,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
12454
12818
  exports.createDeployJob = exports.DEPLOY_JOB_NAME = void 0;
12455
12819
  var docker_1 = __nccwpck_require__(9641);
12456
12820
  var sbom_1 = __nccwpck_require__(37038);
12821
+ var context_1 = __nccwpck_require__(61724);
12457
12822
  var sbom_2 = __nccwpck_require__(44986);
12458
12823
  var utils_1 = __nccwpck_require__(6054);
12459
12824
  var stop_1 = __nccwpck_require__(82846);
@@ -12496,16 +12861,38 @@ var createDeployJob = function (context, jobDefinition) {
12496
12861
  }); })) !== null && _d !== void 0 ? _d : []
12497
12862
  : [])), false),
12498
12863
  // we don't want to deploy when there is a broken test
12499
- needsStages: [
12500
- {
12501
- stage: "build",
12502
- artifacts: hasDocker ? false : true, // we asume that no-docker deployments need build artifacts,
12503
- },
12864
+ needsStages: __spreadArray(__spreadArray([], __read(((0, context_1.componentContextHasWorkspaceBuild)(context)
12865
+ ? hasDocker // docker build is per component,
12866
+ ? [
12867
+ // we don't need artifacts, but have to wait for the component build
12868
+ {
12869
+ stage: "build",
12870
+ artifacts: false,
12871
+ },
12872
+ ]
12873
+ : [
12874
+ {
12875
+ // pick build artifacts from workspace build
12876
+ stage: "build",
12877
+ artifacts: true,
12878
+ workspaceName: context.build.workspaceName,
12879
+ },
12880
+ ]
12881
+ : [
12882
+ {
12883
+ stage: "build",
12884
+ artifacts: hasDocker ? false : true, // we asume that no-docker deployments need build artifacts,
12885
+ },
12886
+ ])), false), [
12504
12887
  {
12505
12888
  stage: "test",
12506
12889
  artifacts: false,
12890
+ // use test from workspace build
12891
+ workspaceName: (0, context_1.componentContextHasWorkspaceBuild)(context)
12892
+ ? context.build.workspaceName
12893
+ : undefined,
12507
12894
  },
12508
- ], // workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/220758
12895
+ ], false),
12509
12896
  when: whenDeploy === "auto" ? "on_success" : "manual",
12510
12897
  allow_failure: whenDeploy === "manual" ? true : false,
12511
12898
  stage: "deploy",
@@ -12748,7 +13135,7 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
12748
13135
  var gcloudImagePath = __spreadArray([
12749
13136
  dockerUrl,
12750
13137
  context.env,
12751
- context.componentName
13138
+ context.name
12752
13139
  ], __read((context.environment.reviewSlug && !lecacyReviewImageName
12753
13140
  ? [context.environment.reviewSlug]
12754
13141
  : [])), false);
@@ -12758,7 +13145,7 @@ exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
12758
13145
  var getArtifactsRegistryBuildCacheImage = function (context) {
12759
13146
  var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
12760
13147
  // does not include env, so that after merge, you might get more cache hits (review-->dev)
12761
- var gcloudImagePath = [dockerUrl, "caches", context.componentName];
13148
+ var gcloudImagePath = [dockerUrl, "caches", context.name];
12762
13149
  return gcloudImagePath.join("/");
12763
13150
  };
12764
13151
  exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
@@ -14181,7 +14568,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
14181
14568
  dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
14182
14569
  instanceConnectionName: config.instanceConnectionName,
14183
14570
  proxyCredentials: proxyCredentials,
14184
- fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
14571
+ fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name),
14185
14572
  },
14186
14573
  };
14187
14574
  }
@@ -14262,7 +14649,7 @@ var createKubernetesDeployJobs = function (context) {
14262
14649
  when: "always",
14263
14650
  },
14264
14651
  }
14265
- : {})), { 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,
14652
+ : {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.name), 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.name,
14266
14653
  /** @deprecated */
14267
14654
  BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
14268
14655
  var clusterName = "kube-".concat(context.environment.fullName);
@@ -14738,8 +15125,11 @@ exports.processSecretsAsFiles = processSecretsAsFiles;
14738
15125
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14739
15126
  exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
14740
15127
  var sbom_1 = __nccwpck_require__(37038);
15128
+ var context_1 = __nccwpck_require__(61724);
14741
15129
  var sbomDeactivated = function (context) {
14742
- return context.build.config.type === "custom" && context.build.config.sbom === false;
15130
+ return (0, context_1.componentContextIsStandaloneBuild)(context) &&
15131
+ context.build.config.type === "custom" &&
15132
+ context.build.config.sbom === false;
14743
15133
  };
14744
15134
  exports.sbomDeactivated = sbomDeactivated;
14745
15135
  var getDependencyTrackUploadScript = function (context) {
@@ -14747,7 +15137,7 @@ var getDependencyTrackUploadScript = function (context) {
14747
15137
  ? []
14748
15138
  : [
14749
15139
  "echo 'Uploading SBOM to Dependency Track'",
14750
- "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true"),
15140
+ "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.name, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true"),
14751
15141
  ];
14752
15142
  };
14753
15143
  exports.getDependencyTrackUploadScript = getDependencyTrackUploadScript;
@@ -14756,7 +15146,7 @@ var getDependencyTrackDeleteScript = function (context) {
14756
15146
  ? []
14757
15147
  : [
14758
15148
  "echo 'Disabling component in Dependency Track'",
14759
- "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" || true"),
15149
+ "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.name, "\" \"").concat(context.environment.url, "\" || true"),
14760
15150
  ];
14761
15151
  };
14762
15152
  exports.getDependencyTrackDeleteScript = getDependencyTrackDeleteScript;
@@ -14971,62 +15361,102 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14971
15361
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
14972
15362
  }
14973
15363
  };
15364
+ var __read = (this && this.__read) || function (o, n) {
15365
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15366
+ if (!m) return o;
15367
+ var i = m.call(o), r, ar = [], e;
15368
+ try {
15369
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
15370
+ }
15371
+ catch (error) { e = { error: error }; }
15372
+ finally {
15373
+ try {
15374
+ if (r && !r.done && (m = i["return"])) m.call(i);
15375
+ }
15376
+ finally { if (e) throw e.error; }
15377
+ }
15378
+ return ar;
15379
+ };
15380
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
15381
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15382
+ if (ar || !(i in from)) {
15383
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
15384
+ ar[i] = from[i];
15385
+ }
15386
+ }
15387
+ return to.concat(ar || Array.prototype.slice.call(from));
15388
+ };
14974
15389
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14975
15390
  exports.createAllJobs = void 0;
14976
- var config_1 = __nccwpck_require__(13352);
14977
- var context_1 = __nccwpck_require__(5875);
15391
+ var createAllComponentsContext_1 = __nccwpck_require__(28375);
15392
+ var createWorkspaceContext_1 = __nccwpck_require__(76558);
15393
+ var types_1 = __nccwpck_require__(11853);
14978
15394
  var createJobsForComponent_1 = __nccwpck_require__(92321);
14979
- var createAllComponentContext = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
14980
- var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
14981
- return __generator(this, function (_c) {
14982
- switch (_c.label) {
14983
- case 0: return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
14984
- var envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
14985
- return envs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
14986
- var context;
14987
- return __generator(this, function (_a) {
14988
- switch (_a.label) {
14989
- case 0: return [4 /*yield*/, (0, context_1.createComponentContext)({
14990
- config: config,
14991
- componentName: componentName,
14992
- env: env,
14993
- trigger: trigger,
14994
- pipelineType: pipelineType,
14995
- })];
14996
- case 1:
14997
- context = _a.sent();
14998
- return [2 /*return*/, {
14999
- env: env,
15000
- componentName: componentName,
15001
- context: context,
15002
- }];
15003
- }
15004
- });
15005
- }); });
15006
- }))];
15007
- case 1: return [2 /*return*/, _c.sent()];
15008
- }
15009
- });
15010
- }); };
15395
+ var createJobsForWorkspace_1 = __nccwpck_require__(70803);
15011
15396
  var createAllJobs = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
15012
- var allComponentContext;
15397
+ var allComponentsContext;
15398
+ var _c;
15399
+ var _d;
15013
15400
  var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
15014
- return __generator(this, function (_c) {
15015
- switch (_c.label) {
15016
- case 0: return [4 /*yield*/, createAllComponentContext({
15401
+ return __generator(this, function (_e) {
15402
+ switch (_e.label) {
15403
+ case 0: return [4 /*yield*/, (0, createAllComponentsContext_1.createAllComponentsContext)({
15017
15404
  config: config,
15018
15405
  trigger: trigger,
15019
15406
  pipelineType: pipelineType,
15020
15407
  })];
15021
15408
  case 1:
15022
- allComponentContext = _c.sent();
15023
- return [2 /*return*/, allComponentContext.map(function (_a) {
15024
- var context = _a.context;
15025
- return ({
15409
+ allComponentsContext = _e.sent();
15410
+ _c = {};
15411
+ return [4 /*yield*/, Promise.all(Object.keys((_d = config.builds) !== null && _d !== void 0 ? _d : {}).map(function (workspaceName) { return __awaiter(void 0, void 0, void 0, function () {
15412
+ var componentsInAllEnvs, allEnvs;
15413
+ return __generator(this, function (_a) {
15414
+ switch (_a.label) {
15415
+ case 0:
15416
+ componentsInAllEnvs = allComponentsContext.filter(function (context) {
15417
+ return (0, types_1.componentContextHasWorkspaceBuild)(context) &&
15418
+ context.build.workspaceName === workspaceName;
15419
+ });
15420
+ allEnvs = __spreadArray([], __read(new Set(componentsInAllEnvs.map(function (_a) {
15421
+ var env = _a.env;
15422
+ return env;
15423
+ }))), false);
15424
+ return [4 /*yield*/, Promise.all(allEnvs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
15425
+ var workspaceContext;
15426
+ return __generator(this, function (_a) {
15427
+ switch (_a.label) {
15428
+ case 0: return [4 /*yield*/, (0, createWorkspaceContext_1.createWorkspaceContext)({
15429
+ components: componentsInAllEnvs.filter(function (_a) {
15430
+ var componentEnv = _a.env;
15431
+ return componentEnv === env;
15432
+ }),
15433
+ workspaceName: workspaceName,
15434
+ config: config,
15435
+ trigger: trigger,
15436
+ pipelineType: pipelineType,
15437
+ env: env,
15438
+ })];
15439
+ case 1:
15440
+ workspaceContext = _a.sent();
15441
+ return [2 /*return*/, {
15442
+ context: workspaceContext,
15443
+ jobs: (0, createJobsForWorkspace_1.createJobsForWorkspace)(workspaceContext),
15444
+ }];
15445
+ }
15446
+ });
15447
+ }); }))];
15448
+ case 1: return [2 /*return*/, _a.sent()];
15449
+ }
15450
+ });
15451
+ }); })).then(function (f) { return f.flat(); })];
15452
+ case 2: return [2 /*return*/, (_c.workspaces = _e.sent(),
15453
+ _c.components = allComponentsContext.map(function (context) {
15454
+ return {
15026
15455
  context: context,
15027
15456
  jobs: (0, createJobsForComponent_1.createJobsForComponentContext)(context),
15028
- });
15029
- })];
15457
+ };
15458
+ }),
15459
+ _c)];
15030
15460
  }
15031
15461
  });
15032
15462
  }); };
@@ -15189,10 +15619,9 @@ var getCustomJobs = function (context) {
15189
15619
  return injectDefaultVarsInCustomJobs(context, rawJobs);
15190
15620
  };
15191
15621
  var createJobsForComponentContext = function (context) {
15192
- var _a, _b;
15193
- var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
15194
- var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
15195
- ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
15622
+ var buildJobs = build_1.BUILD_TYPES[context.build.buildType].jobs(context);
15623
+ var deployJobs = context.componentConfig.deploy !== false
15624
+ ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
15196
15625
  : [];
15197
15626
  var customJobs = getCustomJobs(context);
15198
15627
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
@@ -15202,6 +15631,23 @@ exports.createJobsForComponentContext = createJobsForComponentContext;
15202
15631
 
15203
15632
  /***/ }),
15204
15633
 
15634
+ /***/ 70803:
15635
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
15636
+
15637
+ "use strict";
15638
+
15639
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
15640
+ exports.createJobsForWorkspace = void 0;
15641
+ var build_1 = __nccwpck_require__(67862);
15642
+ var createJobsForWorkspace = function (context) {
15643
+ var buildJobs = build_1.WORKSPACE_BUILD_TYPES[context.build.buildType].jobs(context);
15644
+ return buildJobs;
15645
+ };
15646
+ exports.createJobsForWorkspace = createJobsForWorkspace;
15647
+ //# sourceMappingURL=createJobsForWorkspace.js.map
15648
+
15649
+ /***/ }),
15650
+
15205
15651
  /***/ 39192:
15206
15652
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
15207
15653
 
@@ -15289,7 +15735,7 @@ var createGitlabJobs_1 = __nccwpck_require__(58862);
15289
15735
  var createGitlabPipeline_1 = __nccwpck_require__(66551);
15290
15736
  var gitlabReleaseJobs_1 = __nccwpck_require__(16564);
15291
15737
  var createMainPipeline = function (pipelineType, config) { return __awaiter(void 0, void 0, void 0, function () {
15292
- var stages, allJobsPerTrigger, allJobs;
15738
+ var stages, allJobsPerTrigger, allWorkspaceJobs, allComponentJobs, allJobs;
15293
15739
  return __generator(this, function (_a) {
15294
15740
  switch (_a.label) {
15295
15741
  case 0:
@@ -15306,20 +15752,30 @@ var createMainPipeline = function (pipelineType, config) { return __awaiter(void
15306
15752
  case 2: return [2 /*return*/, _b.sent()];
15307
15753
  }
15308
15754
  });
15309
- }); }))];
15755
+ }); })).then(function (j) { return j.flat(); })];
15310
15756
  case 1:
15311
15757
  allJobsPerTrigger = _a.sent();
15312
- allJobs = allJobsPerTrigger
15313
- .flat()
15758
+ allWorkspaceJobs = allJobsPerTrigger
15759
+ .filter(function (j) { return j.context.type === "workspace"; }) // sort by componentName in the same order as they appear in the config
15760
+ // this is purely for better readability in git diffs when you add new components
15761
+ .sort(function (a, b) {
15762
+ var _a;
15763
+ var workspaceNames = Object.keys((_a = config.builds) !== null && _a !== void 0 ? _a : {});
15764
+ var aIndex = workspaceNames.findIndex(function (c) { return c === a.context.name; });
15765
+ var bIndex = workspaceNames.findIndex(function (c) { return c === b.context.name; });
15766
+ return aIndex - bIndex;
15767
+ });
15768
+ allComponentJobs = allJobsPerTrigger
15769
+ .filter(function (j) { return j.context.type === "component"; })
15314
15770
  // sort by componentName in the same order as they appear in the config
15315
15771
  // this is purely for better readability in git diffs when you add new components
15316
15772
  .sort(function (a, b) {
15317
15773
  var componentNames = Object.keys(config.components);
15318
- var aIndex = componentNames.findIndex(function (c) { return c === a.context.componentName; });
15319
- var bIndex = componentNames.findIndex(function (c) { return c === b.context.componentName; });
15774
+ var aIndex = componentNames.findIndex(function (c) { return c === a.context.name; });
15775
+ var bIndex = componentNames.findIndex(function (c) { return c === b.context.name; });
15320
15776
  return aIndex - bIndex;
15321
- })
15322
- .reduce(function (acc, _a) {
15777
+ });
15778
+ allJobs = __spreadArray(__spreadArray([], __read(allWorkspaceJobs), false), __read(allComponentJobs), false).reduce(function (acc, _a) {
15323
15779
  var _b, _c;
15324
15780
  var gitlabJob = _a.gitlabJob, name = _a.name;
15325
15781
  // merge jobs, if a job is already there, merge the rules
@@ -15638,59 +16094,63 @@ var utils_1 = __nccwpck_require__(32497);
15638
16094
  var gitlab_1 = __nccwpck_require__(38490);
15639
16095
  var removeUndefined_1 = __nccwpck_require__(61073);
15640
16096
  exports.GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
15641
- var getFullJobName = function (name, componentName, env) {
16097
+ var getFullJobName = function (_a) {
16098
+ var type = _a.type, name = _a.name, baseName = _a.baseName, allJobs = _a.allJobs, env = _a.env;
16099
+ var shouldAddIcon = allJobs.workspaces.length > 0;
16100
+ var icon = type === "component" ? "🔹" : "🔸";
16101
+ var prefix = shouldAddIcon ? icon + " " : "";
15642
16102
  if (env) {
15643
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
16103
+ return "".concat(prefix).concat(baseName, " ").concat(name, " | ").concat(env, " ");
15644
16104
  }
15645
- return "".concat(componentName, " ").concat(name);
16105
+ return "".concat(prefix).concat(baseName, " ").concat(name);
15646
16106
  };
15647
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
16107
+ var getFullReferencedJobNameFromComponent = function (referencedJobName, componentName, env, allJobs) {
15648
16108
  var _a, _b;
15649
- var referencedJob = (_b = (_a = allJobs
15650
- .find(function (j) { return j.context.componentName === componentName && j.context.env === env; })) === null || _a === void 0 ? void 0 : _a.jobs) === null || _b === void 0 ? void 0 : _b.find(function (j) { return j.name === referencedJobName; });
16109
+ var referencedJob = (_b = (_a = allJobs.components
16110
+ .find(function (j) { return j.context.name === componentName && j.context.env === env; })) === null || _a === void 0 ? void 0 : _a.jobs) === null || _b === void 0 ? void 0 : _b.find(function (j) { return j.name === referencedJobName; });
15651
16111
  if (!referencedJob) {
15652
16112
  throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
15653
16113
  }
15654
16114
  var envToSet = referencedJob.envMode !== "none" ? env : null;
15655
- return getFullJobName(referencedJobName, componentName, envToSet);
16115
+ return getFullJobName({
16116
+ type: "component",
16117
+ name: referencedJobName,
16118
+ baseName: componentName,
16119
+ env: envToSet,
16120
+ allJobs: allJobs,
16121
+ });
16122
+ };
16123
+ var getFullReferencedJobNameFromWorkspace = function (referencedJobName, workspaceName, env, allJobs) {
16124
+ var _a, _b;
16125
+ var referencedJob = (_b = (_a = allJobs.workspaces
16126
+ .find(function (w) { return w.context.name === workspaceName; })) === null || _a === void 0 ? void 0 : _a.jobs) === null || _b === void 0 ? void 0 : _b.find(function (j) { return j.name === referencedJobName; });
16127
+ if (!referencedJob) {
16128
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from workspace ").concat(env, ":").concat(workspaceName, "'"));
16129
+ }
16130
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
16131
+ return getFullJobName({
16132
+ type: "workspace",
16133
+ name: referencedJobName,
16134
+ baseName: workspaceName,
16135
+ env: envToSet,
16136
+ allJobs: allJobs,
16137
+ });
15656
16138
  };
15657
16139
  var getJobName = function (need) {
15658
16140
  return (0, lodash_1.isObject)(need) ? need.job : need;
15659
16141
  };
15660
- var makeGitlabJob = function (context, _a, allJobs, baseRules) {
15661
- var _b, _c;
15662
- var environment = _a.environment, envMode = _a.envMode, needsStages = _a.needsStages, needsOtherComponent = _a.needsOtherComponent, name = _a.name, needs = _a.needs, jobTags = _a.jobTags, script = _a.script, variables = _a.variables, runnerVariables = _a.runnerVariables, when = _a.when, job = __rest(_a, ["environment", "envMode", "needsStages", "needsOtherComponent", "name", "needs", "jobTags", "script", "variables", "runnerVariables", "when"]);
16142
+ var makeGitlabJob = function (context, job, allJobs, baseRules) {
16143
+ var _a, _b;
16144
+ var environment = job.environment, envMode = job.envMode, needsStages = job.needsStages, needsOtherComponent = job.needsOtherComponent, name = job.name, needs = job.needs, jobTags = job.jobTags, script = job.script, variables = job.variables, runnerVariables = job.runnerVariables, when = job.when, rest = __rest(job, ["environment", "envMode", "needsStages", "needsOtherComponent", "name", "needs", "jobTags", "script", "variables", "runnerVariables", "when"]);
15663
16145
  var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(context.env) : job.stage;
15664
- var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
15665
- var _a, _b, _c;
15666
- var referencedComponentName = context.componentName;
15667
- var allJobNamesFromThatStage = (_c = (_b = (_a = allJobs
15668
- .filter(function (j) {
15669
- return j.context.componentName === referencedComponentName &&
15670
- j.context.env === context.env;
15671
- })
15672
- .flatMap(function (j) { return j.jobs; })) === null || _a === void 0 ? void 0 : _a.filter(function (j) { return j.stage === n.stage; })) === null || _b === void 0 ? void 0 : _b.map(function (j) { return j.name; })) !== null && _c !== void 0 ? _c : [];
15673
- return allJobNamesFromThatStage.map(function (job) {
15674
- var _a;
15675
- return ({
15676
- job: job,
15677
- artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
15678
- componentName: referencedComponentName,
15679
- });
15680
- });
16146
+ var deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
16147
+ var fullJobName = getFullJobName({
16148
+ type: context.type,
16149
+ name: name,
16150
+ baseName: context.name,
16151
+ env: envMode !== "none" ? context.env : undefined,
16152
+ allJobs: allJobs,
15681
16153
  });
15682
- var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false), __read((needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : [])), false);
15683
- var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
15684
- var _a;
15685
- return (0, lodash_1.isObject)(n)
15686
- ? {
15687
- job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : context.componentName, context.env, allJobs),
15688
- artifacts: n.artifacts,
15689
- }
15690
- : getFullReferencedJobName(n, context.componentName, context.env, allJobs);
15691
- }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
15692
- var deduplicatedGitlabNeeds = __spreadArray([], __read(new Map(gitlabNeeds.map(function (n) { return [(0, lodash_1.isObject)(n) ? n.job : n, n]; })).values()), false);
15693
- var fullJobName = getFullJobName(name, context.componentName, envMode !== "none" ? context.env : undefined);
15694
16154
  // backwards compatibility, some may still use KUBERNETES_CPU_REQUEST, KUBERNETES_MEMORY_REQUEST, etc. in variables.
15695
16155
  // those should now be set in the runnerVariables as they don't work in the variables key of the catladder job, becuase those get injected
15696
16156
  var PIPELINE_RUNNER_VARIABLES = [
@@ -15713,25 +16173,30 @@ var makeGitlabJob = function (context, _a, allJobs, baseRules) {
15713
16173
  if (Object.keys(legacyRunnerVariables).length > 0) {
15714
16174
  console.warn("Legacy variables detected in ".concat(fullJobName, ": ").concat(Object.keys(legacyRunnerVariables).join(", "), ". Please move them to the runnerVariables key."));
15715
16175
  }
15716
- var rules = __spreadArray(__spreadArray([], __read(((_b = job.rules) !== null && _b !== void 0 ? _b : [])), false), __read((baseRules
16176
+ var rules = __spreadArray(__spreadArray([], __read(((_a = job.rules) !== null && _a !== void 0 ? _a : [])), false), __read((baseRules
15717
16177
  ? baseRules.map(function (rule) { return (__assign({ when: when }, rule)); })
15718
16178
  : when
15719
16179
  ? [{ when: when }]
15720
16180
  : [])), false);
15721
- var modified = addGitlabEnvironment(context, environment, __assign(__assign({}, job), { rules: rules.length > 0 ? rules : undefined, variables: __assign(__assign({}, legacyRunnerVariables), runnerVariables), script: __spreadArray(__spreadArray([], __read(varsInjectScripts), false), __read(((_c = script === null || script === void 0 ? void 0 : script.filter(utils_1.notNil)) !== null && _c !== void 0 ? _c : [])), false), tags: jobTags, stage: stage,
16181
+ var gitlabJob = __assign(__assign({}, rest), { rules: rules.length > 0 ? rules : undefined, variables: __assign(__assign({}, legacyRunnerVariables), runnerVariables), script: __spreadArray(__spreadArray([], __read(varsInjectScripts), false), __read(((_b = script === null || script === void 0 ? void 0 : script.filter(utils_1.notNil)) !== null && _b !== void 0 ? _b : [])), false), tags: jobTags, stage: stage,
15722
16182
  // sort in a predictable manner for snapshot tests
15723
- needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true }), context.componentName, context.env, allJobs);
16183
+ needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true });
16184
+ var modified = addGitlabEnvironment(context, environment, gitlabJob, allJobs);
15724
16185
  return [fullJobName, (0, removeUndefined_1.removeUndefined)(modified)];
15725
16186
  };
15726
16187
  exports.makeGitlabJob = makeGitlabJob;
15727
- var addGitlabEnvironment = function (context, environment, job, componentName, env, // TODO: we could actually pull this from contxt
15728
- allJobs) {
16188
+ var addGitlabEnvironment = function (context, catladderJobEnvironment, job, allJobs) {
15729
16189
  var _a, _b;
15730
- if (!environment) {
16190
+ if (!catladderJobEnvironment) {
15731
16191
  return job;
15732
16192
  }
15733
- var _c = context.environment, url = _c.url, envType = _c.envType;
15734
- var on_stop = environment.on_stop, restEnvironment = __rest(environment, ["on_stop"]);
16193
+ if (context.type !== "component") {
16194
+ // don't add enviornment for workspace jobs atm.
16195
+ return job;
16196
+ }
16197
+ var env = context.env, name = context.name, environment = context.environment;
16198
+ var url = environment.url, envType = environment.envType;
16199
+ var on_stop = catladderJobEnvironment.on_stop, restEnvironment = __rest(catladderJobEnvironment, ["on_stop"]);
15735
16200
  // those can be dynamic, so we therefore have to do this: https://docs.gitlab.com/ee/ci/environments/#set-a-dynamic-environment-url
15736
16201
  var dotEnvFile = "gitlab_environment.env";
15737
16202
  var scriptToAdd = [
@@ -15739,11 +16204,11 @@ allJobs) {
15739
16204
  ];
15740
16205
  // this is NOT a bashVariable since it NEEDS to be used as a string in gitlab
15741
16206
  var gitlabEnvironmentName = envType === "review"
15742
- ? "".concat(env, "/$CI_COMMIT_REF_NAME/").concat(componentName) // FIXME: should be replaced with mr name as well
15743
- : "".concat(env, "/").concat(componentName);
16207
+ ? "".concat(env, "/$CI_COMMIT_REF_NAME/").concat(name) // FIXME: should be replaced with mr name as well
16208
+ : "".concat(env, "/").concat(name);
15744
16209
  return __assign(__assign({}, job), { environment: __assign(__assign({ name: gitlabEnvironmentName, url: "$".concat(exports.GITLAB_ENVIRONMENT_URL_VARIABLE) }, (on_stop
15745
16210
  ? {
15746
- on_stop: getFullReferencedJobName(on_stop, componentName, env, allJobs),
16211
+ on_stop: getFullReferencedJobNameFromComponent(on_stop, name, env, allJobs),
15747
16212
  }
15748
16213
  : {})), restEnvironment), artifacts: (0, lodash_1.merge)((_a = job.artifacts) !== null && _a !== void 0 ? _a : {}, {
15749
16214
  reports: {
@@ -15753,7 +16218,8 @@ allJobs) {
15753
16218
  };
15754
16219
  var createGitlabJobs = function (allJobs, baseRules) { return __awaiter(void 0, void 0, void 0, function () {
15755
16220
  return __generator(this, function (_a) {
15756
- return [2 /*return*/, allJobs.flatMap(function (_a) {
16221
+ // TODO: add workspace jobs
16222
+ return [2 /*return*/, __spreadArray(__spreadArray([], __read(allJobs.workspaces), false), __read(allJobs.components), false).flatMap(function (_a) {
15757
16223
  var context = _a.context, jobs = _a.jobs;
15758
16224
  return jobs.map(function (job) {
15759
16225
  var _a = __read((0, exports.makeGitlabJob)(context, job, allJobs, baseRules), 2), fullJobName = _a[0], gitlabJob = _a[1];
@@ -15767,6 +16233,103 @@ var createGitlabJobs = function (allJobs, baseRules) { return __awaiter(void 0,
15767
16233
  });
15768
16234
  }); };
15769
16235
  exports.createGitlabJobs = createGitlabJobs;
16236
+ function getGitlabNeeds(context, job, allJobs) {
16237
+ var needs = context.type === "workspace"
16238
+ ? getGitlabNeedsForWorkspaceJob(context, job, allJobs)
16239
+ : getGitlabNeedsForComponentJob(context, job, allJobs);
16240
+ return deduplicateNeeds(needs);
16241
+ }
16242
+ function deduplicateNeeds(needs) {
16243
+ return needs
16244
+ ? __spreadArray([], __read(new Map(needs.map(function (n) { return [(0, lodash_1.isObject)(n) ? n.job : n, n]; })).values()), false) : undefined;
16245
+ }
16246
+ function getGitlabNeedsForComponentJob(context, _a, allJobs) {
16247
+ var needsStages = _a.needsStages, needs = _a.needs, needsOtherComponent = _a.needsOtherComponent;
16248
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
16249
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16250
+ var componentName = context.name;
16251
+ if (!n.workspaceName) {
16252
+ var allJobNamesFromThatStage = (_c = (_b = (_a = allJobs.components
16253
+ .filter(function (j) {
16254
+ return j.context.name === componentName && j.context.env === context.env;
16255
+ })
16256
+ .flatMap(function (j) { return j.jobs; })) === null || _a === void 0 ? void 0 : _a.filter(function (j) { return j.stage === n.stage; })) === null || _b === void 0 ? void 0 : _b.map(function (j) { return j.name; })) !== null && _c !== void 0 ? _c : [];
16257
+ return allJobNamesFromThatStage.map(function (job) {
16258
+ var _a;
16259
+ return ({
16260
+ job: job,
16261
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
16262
+ componentName: componentName,
16263
+ });
16264
+ });
16265
+ }
16266
+ else {
16267
+ var allJobNamesFromThatStage = (_h = (_g = (_f = (_e = (_d = allJobs.workspaces
16268
+ .find(function (w) {
16269
+ return w.context.name === n.workspaceName &&
16270
+ w.context.env === context.env;
16271
+ })) === null || _d === void 0 ? void 0 : _d.jobs) === null || _e === void 0 ? void 0 : _e.flatMap(function (j) { return j; })) === null || _f === void 0 ? void 0 : _f.filter(function (j) { return j.stage === n.stage; })) === null || _g === void 0 ? void 0 : _g.map(function (j) { return j.name; })) !== null && _h !== void 0 ? _h : [];
16272
+ return allJobNamesFromThatStage.map(function (job) {
16273
+ var _a;
16274
+ return ({
16275
+ job: job,
16276
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
16277
+ workspaceName: n.workspaceName,
16278
+ });
16279
+ });
16280
+ }
16281
+ });
16282
+ var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false), __read((needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : [])), false);
16283
+ return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
16284
+ var _a;
16285
+ return (0, lodash_1.isObject)(n)
16286
+ ? "workspaceName" in n
16287
+ ? {
16288
+ job: getFullReferencedJobNameFromWorkspace(n.job, n.workspaceName, context.env, allJobs),
16289
+ artifacts: n.artifacts,
16290
+ }
16291
+ : {
16292
+ job: getFullReferencedJobNameFromComponent(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : context.name, context.env, allJobs),
16293
+ artifacts: n.artifacts,
16294
+ }
16295
+ : getFullReferencedJobNameFromComponent(n, context.name, context.env, allJobs);
16296
+ }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
16297
+ }
16298
+ /**
16299
+ *
16300
+ *unclear whether we actually need this. So far jobs in a workspace don't have needs to other jobs from the same workspace
16301
+ */
16302
+ function getGitlabNeedsForWorkspaceJob(context, _a, allJobs) {
16303
+ var needsStages = _a.needsStages, needs = _a.needs;
16304
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
16305
+ var _a, _b, _c, _d;
16306
+ var workspaceName = (_a = n.workspaceName) !== null && _a !== void 0 ? _a : context.name;
16307
+ var allJobNamesFromThatStage = (_d = (_c = (_b = allJobs.workspaces
16308
+ .filter(function (j) {
16309
+ return j.context.name === workspaceName && j.context.env === context.env;
16310
+ })
16311
+ .flatMap(function (j) { return j.jobs; })) === null || _b === void 0 ? void 0 : _b.filter(function (j) { return j.stage === n.stage; })) === null || _c === void 0 ? void 0 : _c.map(function (j) { return j.name; })) !== null && _d !== void 0 ? _d : [];
16312
+ return allJobNamesFromThatStage.map(function (job) {
16313
+ var _a;
16314
+ return ({
16315
+ job: job,
16316
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
16317
+ workspaceName: workspaceName,
16318
+ });
16319
+ });
16320
+ });
16321
+ var cleanedNeeds = __spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false);
16322
+ return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
16323
+ return (0, lodash_1.isObject)(n)
16324
+ ? {
16325
+ job: getFullReferencedJobNameFromWorkspace(n.job, "workspaceName" in n && n.workspaceName
16326
+ ? n.workspaceName
16327
+ : context.name, context.env, allJobs),
16328
+ artifacts: n.artifacts,
16329
+ }
16330
+ : getFullReferencedJobNameFromWorkspace(n, context.name, context.env, allJobs);
16331
+ }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
16332
+ }
15770
16333
  //# sourceMappingURL=createGitlabJobs.js.map
15771
16334
 
15772
16335
  /***/ }),
@@ -15983,6 +16546,17 @@ __exportStar(__nccwpck_require__(16564), exports);
15983
16546
 
15984
16547
  "use strict";
15985
16548
 
16549
+ var __assign = (this && this.__assign) || function () {
16550
+ __assign = Object.assign || function(t) {
16551
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
16552
+ s = arguments[i];
16553
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
16554
+ t[p] = s[p];
16555
+ }
16556
+ return t;
16557
+ };
16558
+ return __assign.apply(this, arguments);
16559
+ };
15986
16560
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15987
16561
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15988
16562
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -16045,25 +16619,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
16045
16619
  return to.concat(ar || Array.prototype.slice.call(from));
16046
16620
  };
16047
16621
  Object.defineProperty(exports, "__esModule", ({ value: true }));
16048
- exports.getPackageManagerInfoForComponent = void 0;
16622
+ exports.getPackageManagerInfoBase = exports.getPackageManagerInfoForComponent = void 0;
16049
16623
  var fs_1 = __nccwpck_require__(57147);
16050
16624
  var path_1 = __nccwpck_require__(71017);
16051
16625
  var path_equal_1 = __nccwpck_require__(84843);
16052
16626
  var yarnUtils_1 = __nccwpck_require__(97843);
16053
16627
  var getPackageManagerInfoForComponent = function (config, componentName) { return __awaiter(void 0, void 0, void 0, function () {
16054
- var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
16628
+ var baseInfo, workspaces, component, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
16055
16629
  return __generator(this, function (_a) {
16056
16630
  switch (_a.label) {
16057
- case 0: return [4 /*yield*/, (0, yarnUtils_1.getYarnVersion)()];
16631
+ case 0: return [4 /*yield*/, (0, exports.getPackageManagerInfoBase)()];
16058
16632
  case 1:
16059
- version = _a.sent();
16060
- if (!version)
16061
- throw new Error("could not get yarn version");
16062
- isClassic = version.startsWith("1");
16633
+ baseInfo = _a.sent();
16634
+ workspaces = baseInfo.workspaces;
16063
16635
  component = config.components[componentName];
16064
- return [4 /*yield*/, (0, yarnUtils_1.getWorkspaces)(isClassic)];
16065
- case 2:
16066
- workspaces = _a.sent();
16067
16636
  currentWorkspace = workspaces.find(function (w) {
16068
16637
  return (0, path_equal_1.pathEqual)(component.dir, w.location);
16069
16638
  });
@@ -16086,20 +16655,35 @@ var getPackageManagerInfoForComponent = function (config, componentName) { retur
16086
16655
  ], __read((workspacePackageJson ? [workspacePackageJson] : [])), false), [
16087
16656
  lockFile
16088
16657
  ], false), __read(configFilePaths), false), __read(currentWorkspaceDependencies), false);
16658
+ return [2 /*return*/, __assign(__assign({}, baseInfo), { currentWorkspace: currentWorkspace, currentWorkspaceDependencies: currentWorkspaceDependencies, componentIsInWorkspace: componentIsInWorkspace, pathsToCopyInDocker: pathsToCopyInDocker })];
16659
+ }
16660
+ });
16661
+ }); };
16662
+ exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
16663
+ // TODO: memoizee
16664
+ var getPackageManagerInfoBase = function () { return __awaiter(void 0, void 0, void 0, function () {
16665
+ var version, isClassic, workspaces;
16666
+ return __generator(this, function (_a) {
16667
+ switch (_a.label) {
16668
+ case 0: return [4 /*yield*/, (0, yarnUtils_1.getYarnVersion)()];
16669
+ case 1:
16670
+ version = _a.sent();
16671
+ if (!version)
16672
+ throw new Error("could not get yarn version");
16673
+ isClassic = version.startsWith("1");
16674
+ return [4 /*yield*/, (0, yarnUtils_1.getWorkspaces)(isClassic)];
16675
+ case 2:
16676
+ workspaces = _a.sent();
16089
16677
  return [2 /*return*/, {
16090
16678
  type: "yarn",
16091
16679
  workspaces: workspaces,
16092
16680
  version: version,
16093
16681
  isClassic: isClassic,
16094
- currentWorkspace: currentWorkspace,
16095
- currentWorkspaceDependencies: currentWorkspaceDependencies,
16096
- componentIsInWorkspace: componentIsInWorkspace,
16097
- pathsToCopyInDocker: pathsToCopyInDocker,
16098
16682
  }];
16099
16683
  }
16100
16684
  });
16101
16685
  }); };
16102
- exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
16686
+ exports.getPackageManagerInfoBase = getPackageManagerInfoBase;
16103
16687
  //# sourceMappingURL=packageManager.js.map
16104
16688
 
16105
16689
  /***/ }),
@@ -16419,6 +17003,15 @@ exports.isKnowEnvType = isKnowEnvType;
16419
17003
  "use strict";
16420
17004
 
16421
17005
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17006
+ exports.componentContextHasWorkspaceBuild = exports.componentContextIsStandaloneBuild = void 0;
17007
+ var componentContextIsStandaloneBuild = function (context) {
17008
+ return context.build.type === "standalone";
17009
+ };
17010
+ exports.componentContextIsStandaloneBuild = componentContextIsStandaloneBuild;
17011
+ var componentContextHasWorkspaceBuild = function (context) {
17012
+ return context.build.type === "fromWorkspace";
17013
+ };
17014
+ exports.componentContextHasWorkspaceBuild = componentContextHasWorkspaceBuild;
16422
17015
  //# sourceMappingURL=context.js.map
16423
17016
 
16424
17017
  /***/ }),