@catladder/cli 0.0.0-remove-deprecations-302acc53 → 0.0.0-remove-deprecations-68227daa

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 (56) hide show
  1. package/dist/bundles/catenv/index.js +232 -88
  2. package/dist/bundles/cli/index.js +230 -86
  3. package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +3 -2
  4. package/dist/pipeline/src/build/base/createAppBuildJob.js +5 -4
  5. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  6. package/dist/pipeline/src/build/base/createBuildJobDefinition.d.ts +7 -0
  7. package/dist/pipeline/src/build/base/createBuildJobDefinition.js +30 -0
  8. package/dist/pipeline/src/build/base/createBuildJobDefinition.js.map +1 -0
  9. package/dist/pipeline/src/build/cache/createJobCache.d.ts +6 -0
  10. package/dist/pipeline/src/build/cache/createJobCache.js +57 -0
  11. package/dist/pipeline/src/build/cache/createJobCache.js.map +1 -0
  12. package/dist/pipeline/src/build/cache/getAllCacheConfigsFromConfig.d.ts +3 -0
  13. package/dist/pipeline/src/build/cache/getAllCacheConfigsFromConfig.js +28 -0
  14. package/dist/pipeline/src/build/cache/getAllCacheConfigsFromConfig.js.map +1 -0
  15. package/dist/pipeline/src/build/cache/transformLegacyJobCache.d.ts +3 -0
  16. package/dist/pipeline/src/build/cache/transformLegacyJobCache.js +17 -0
  17. package/dist/pipeline/src/build/cache/transformLegacyJobCache.js.map +1 -0
  18. package/dist/pipeline/src/build/custom/buildJob.js +2 -14
  19. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  20. package/dist/pipeline/src/build/custom/testJob.d.ts +1 -1
  21. package/dist/pipeline/src/build/custom/testJob.js +12 -11
  22. package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
  23. package/dist/pipeline/src/build/docker.d.ts +3 -3
  24. package/dist/pipeline/src/build/docker.js +3 -1
  25. package/dist/pipeline/src/build/docker.js.map +1 -1
  26. package/dist/pipeline/src/build/node/buildJob.js +5 -22
  27. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  28. package/dist/pipeline/src/build/node/cache.d.ts +6 -6
  29. package/dist/pipeline/src/build/node/cache.js +12 -15
  30. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  31. package/dist/pipeline/src/build/node/meteor.js +5 -6
  32. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  33. package/dist/pipeline/src/build/node/testJob.js +6 -5
  34. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  35. package/dist/pipeline/src/build/node/yarn.js +1 -2
  36. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  37. package/dist/pipeline/src/build/rails/test.js +3 -3
  38. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  39. package/dist/pipeline/src/build/sbom.js +1 -1
  40. package/dist/pipeline/src/build/sbom.js.map +1 -1
  41. package/dist/pipeline/src/build/types.d.ts +43 -4
  42. package/dist/pipeline/src/build/types.js.map +1 -1
  43. package/dist/pipeline/src/types/gitlab-types.d.ts +2 -2
  44. package/dist/pipeline/src/types/index.d.ts +1 -0
  45. package/dist/pipeline/src/types/index.js +1 -0
  46. package/dist/pipeline/src/types/index.js.map +1 -1
  47. package/dist/pipeline/src/types/jobDefinition.d.ts +5 -0
  48. package/dist/pipeline/src/types/jobDefinition.js +3 -0
  49. package/dist/pipeline/src/types/jobDefinition.js.map +1 -0
  50. package/dist/pipeline/src/types/jobs.d.ts +3 -2
  51. package/dist/pipeline/src/types/jobs.js.map +1 -1
  52. package/dist/pipeline/src/utils/index.d.ts +2 -1
  53. package/dist/pipeline/src/utils/index.js +4 -2
  54. package/dist/pipeline/src/utils/index.js.map +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +1 -1
@@ -1057,19 +1057,20 @@ const lodash_1 = __nccwpck_require__(3255);
1057
1057
  const __1 = __nccwpck_require__(603);
1058
1058
  const utils_1 = __nccwpck_require__(2497);
1059
1059
  const createBuildJobArtifact_1 = __nccwpck_require__(8774);
1060
+ const createJobCache_1 = __nccwpck_require__(4372);
1060
1061
  const yarn_1 = __nccwpck_require__(5043);
1061
1062
  const constants_1 = __nccwpck_require__(2786);
1062
1063
  const writeBuildInfo_1 = __nccwpck_require__(9578);
1063
1064
  const writeDotEnv_1 = __nccwpck_require__(8052);
1064
- const createAppBuildJob = (context, { script, variables, runnerVariables, ...def }) => {
1065
- var _a, _b;
1065
+ const createAppBuildJob = (context, { script, variables, runnerVariables, cache, ...def }) => {
1066
+ var _a;
1066
1067
  return (0, lodash_1.merge)({
1067
1068
  name: constants_1.APP_BUILD_JOB_NAME,
1068
1069
  envMode: "jobPerEnv",
1069
1070
  stage: "build",
1070
1071
  image: (0, __1.getRunnerImage)("jobs-default"),
1071
1072
  needs: [],
1072
- cache: [],
1073
+ cache: cache ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, cache) : undefined,
1073
1074
  variables: {
1074
1075
  ...(variables !== null && variables !== void 0 ? variables : {}),
1075
1076
  ...(context.type === "component"
@@ -1097,7 +1098,7 @@ const createAppBuildJob = (context, { script, variables, runnerVariables, ...def
1097
1098
  ...(context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : []),
1098
1099
  ...(0, yarn_1.ensureNodeVersion)(context), // in pure node repos, we might want to have the nvmrc file in top-level
1099
1100
  `cd ${context.build.dir}`,
1100
- ...((_b = (0, utils_1.ensureArray)(script)) !== null && _b !== void 0 ? _b : []),
1101
+ ...(0, utils_1.ensureArray)(script),
1101
1102
  ],
1102
1103
  artifacts: (0, createBuildJobArtifact_1.createBuildJobArtifacts)(context),
1103
1104
  }, def);
@@ -1144,6 +1145,43 @@ exports.createArtifactsConfig = createArtifactsConfig;
1144
1145
 
1145
1146
  /***/ }),
1146
1147
 
1148
+ /***/ 6354:
1149
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1150
+
1151
+ "use strict";
1152
+
1153
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1154
+ exports.createBuildJobDefinition = void 0;
1155
+ const runner_1 = __nccwpck_require__(4058);
1156
+ const utils_1 = __nccwpck_require__(2497);
1157
+ const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(673);
1158
+ const constants_1 = __nccwpck_require__(1765);
1159
+ const createBuildJobDefinition = (context, buildConfig, customize = {}) => {
1160
+ var _a, _b, _c, _d;
1161
+ if (buildConfig.buildCommand === null)
1162
+ return undefined;
1163
+ const defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
1164
+ return {
1165
+ image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
1166
+ runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
1167
+ cache: [
1168
+ ...((_b = customize.cache) !== null && _b !== void 0 ? _b : []),
1169
+ ...(0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, buildConfig),
1170
+ ],
1171
+ services: "jobServices" in buildConfig ? buildConfig.jobServices : undefined,
1172
+ script: [
1173
+ ...((_c = customize.prescript) !== null && _c !== void 0 ? _c : []),
1174
+ ...(0, utils_1.ensureArray)(buildConfig.buildCommand),
1175
+ ...((_d = customize.postscript) !== null && _d !== void 0 ? _d : []),
1176
+ ],
1177
+ jobTags: buildConfig.jobTags,
1178
+ };
1179
+ };
1180
+ exports.createBuildJobDefinition = createBuildJobDefinition;
1181
+ //# sourceMappingURL=createBuildJobDefinition.js.map
1182
+
1183
+ /***/ }),
1184
+
1147
1185
  /***/ 9366:
1148
1186
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1149
1187
 
@@ -1257,6 +1295,129 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
1257
1295
 
1258
1296
  /***/ }),
1259
1297
 
1298
+ /***/ 4372:
1299
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1300
+
1301
+ "use strict";
1302
+
1303
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1304
+ exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
1305
+ const path_1 = __nccwpck_require__(1017);
1306
+ const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(673);
1307
+ const createJobCacheFromCacheConfigs = (context, caches) => {
1308
+ if (caches.length === 0)
1309
+ return undefined;
1310
+ const simpleCacheDefs = caches.filter((c) => !("key" in c));
1311
+ const advancedCacheDefs = caches.filter((c) => "key" in c);
1312
+ // simple caches are merged together into one. This is because e.g. gitlab has a limit of 4 caches, see https://gitlab.com/gitlab-org/gitlab/-/issues/421962
1313
+ const simpleCaches = simpleCacheDefs.length > 0
1314
+ ? [
1315
+ {
1316
+ key: context.name + "-default",
1317
+ policy: "pull-push",
1318
+ paths: simpleCacheDefs.flatMap((c) => c.paths.map((p) => {
1319
+ var _a;
1320
+ const baseDir = c.pathMode === "absolute"
1321
+ ? ""
1322
+ : (_a = c.baseDir) !== null && _a !== void 0 ? _a : context.build.dir;
1323
+ return (0, path_1.join)(baseDir, p);
1324
+ })),
1325
+ },
1326
+ ]
1327
+ : [];
1328
+ const advancedCaches = advancedCacheDefs.map(({ key, paths, policy, scope, pathMode, buildDir, ...rest }) => {
1329
+ var _a;
1330
+ const baseDir = pathMode === "absolute" ? "" : buildDir !== null && buildDir !== void 0 ? buildDir : context.build.dir;
1331
+ const transformedKey = scope === "global"
1332
+ ? key
1333
+ : typeof key === "string"
1334
+ ? (scope === "buildDir" // really edge case...
1335
+ ? baseDir
1336
+ : context.name) +
1337
+ "-" +
1338
+ key
1339
+ : {
1340
+ ...key,
1341
+ files: (_a = key.files) === null || _a === void 0 ? void 0 : _a.map((f) => pathMode === "absolute" ? f : (0, path_1.join)(baseDir, f)),
1342
+ };
1343
+ return {
1344
+ key: transformedKey,
1345
+ policy: policy !== null && policy !== void 0 ? policy : "pull-push",
1346
+ paths: pathMode === "absolute" ? paths : paths === null || paths === void 0 ? void 0 : paths.map((p) => (0, path_1.join)(baseDir, p)),
1347
+ ...rest,
1348
+ };
1349
+ });
1350
+ return [...advancedCaches, ...simpleCaches];
1351
+ };
1352
+ exports.createJobCacheFromCacheConfigs = createJobCacheFromCacheConfigs;
1353
+ /** shortcut, used in some build types */
1354
+ const createJobCacheFromConfig = (context, buildConfig) => {
1355
+ return (0, exports.createJobCacheFromCacheConfigs)(context, (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, buildConfig));
1356
+ };
1357
+ exports.createJobCacheFromConfig = createJobCacheFromConfig;
1358
+ //# sourceMappingURL=createJobCache.js.map
1359
+
1360
+ /***/ }),
1361
+
1362
+ /***/ 673:
1363
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1364
+
1365
+ "use strict";
1366
+
1367
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1368
+ exports.getAllCacheConfigsFromConfig = void 0;
1369
+ const index_1 = __nccwpck_require__(2497);
1370
+ const transformLegacyJobCache_1 = __nccwpck_require__(6673);
1371
+ const getAllCacheConfigsFromConfig = (context, buildConfig) => {
1372
+ return [
1373
+ ...("jobCache" in buildConfig
1374
+ ? (0, transformLegacyJobCache_1.transformLegacyJobCache)(buildConfig.jobCache)
1375
+ : []),
1376
+ ...(0, index_1.ensureArray)(buildConfig.cache).map((c) => ({
1377
+ ...c,
1378
+ context,
1379
+ })),
1380
+ ...(context.type === "workspace"
1381
+ ? // also add cache configs of the components of that workspace
1382
+ context.components.flatMap((componentContext) => {
1383
+ var _a;
1384
+ return (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map((c) => ({
1385
+ ...c,
1386
+ baseDir: componentContext.build.dir,
1387
+ }))) !== null && _a !== void 0 ? _a : [];
1388
+ })
1389
+ : []),
1390
+ ];
1391
+ };
1392
+ exports.getAllCacheConfigsFromConfig = getAllCacheConfigsFromConfig;
1393
+ //# sourceMappingURL=getAllCacheConfigsFromConfig.js.map
1394
+
1395
+ /***/ }),
1396
+
1397
+ /***/ 6673:
1398
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1399
+
1400
+ "use strict";
1401
+
1402
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1403
+ exports.transformLegacyJobCache = void 0;
1404
+ const utils_1 = __nccwpck_require__(2497);
1405
+ function transformLegacyJobCache(jobCache) {
1406
+ return (0, utils_1.ensureArray)(jobCache).map((cache) => {
1407
+ var _a, _b;
1408
+ return ({
1409
+ pathMode: "absolute",
1410
+ ...cache,
1411
+ key: (_a = cache.key) !== null && _a !== void 0 ? _a : "default",
1412
+ paths: (_b = cache.paths) !== null && _b !== void 0 ? _b : [],
1413
+ });
1414
+ });
1415
+ }
1416
+ exports.transformLegacyJobCache = transformLegacyJobCache;
1417
+ //# sourceMappingURL=transformLegacyJobCache.js.map
1418
+
1419
+ /***/ }),
1420
+
1260
1421
  /***/ 1637:
1261
1422
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1262
1423
 
@@ -1264,30 +1425,18 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
1264
1425
 
1265
1426
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1266
1427
  exports.createCustomBuildJobs = void 0;
1267
- const utils_1 = __nccwpck_require__(2497);
1268
1428
  const docker_1 = __nccwpck_require__(9641);
1269
1429
  const types_1 = __nccwpck_require__(4466);
1270
1430
  const base_1 = __nccwpck_require__(9366);
1271
- const RUNNER_BUILD_VARIABLES = {
1272
- KUBERNETES_CPU_REQUEST: "0.45",
1273
- KUBERNETES_MEMORY_REQUEST: "1Gi",
1274
- KUBERNETES_MEMORY_LIMIT: "4Gi",
1275
- };
1431
+ const createBuildJobDefinition_1 = __nccwpck_require__(6354);
1276
1432
  const createCustomBuildJobs = (context) => {
1277
- var _a;
1278
1433
  const buildConfig = context.build.config;
1279
1434
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
1280
1435
  throw new Error("deploy config is not custom");
1281
1436
  }
1282
1437
  return (0, base_1.createComponentBuildJobs)(context, {
1283
1438
  appBuild: buildConfig.buildCommand !== null
1284
- ? {
1285
- image: buildConfig.jobImage,
1286
- runnerVariables: RUNNER_BUILD_VARIABLES,
1287
- cache: buildConfig.jobCache,
1288
- services: buildConfig.jobServices,
1289
- script: [...((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])],
1290
- }
1439
+ ? (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig)
1291
1440
  : undefined,
1292
1441
  dockerBuild: {
1293
1442
  script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
@@ -1325,15 +1474,16 @@ exports.createCustomJobs = createCustomJobs;
1325
1474
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1326
1475
  exports.createCustomTestJobs = void 0;
1327
1476
  const utils_1 = __nccwpck_require__(2497);
1328
- const types_1 = __nccwpck_require__(4466);
1329
1477
  const createArtifactsConfig_1 = __nccwpck_require__(2820);
1478
+ const createJobCache_1 = __nccwpck_require__(4372);
1479
+ const types_1 = __nccwpck_require__(4466);
1330
1480
  const RUNNER_CUSTOM_TEST_VARIABLES = {
1331
1481
  KUBERNETES_CPU_REQUEST: "0.45",
1332
1482
  KUBERNETES_MEMORY_REQUEST: "1Gi",
1333
1483
  KUBERNETES_MEMORY_LIMIT: "4Gi",
1334
1484
  };
1335
1485
  const createCustomTestJobs = (context) => {
1336
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1486
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1337
1487
  // don't run tests after release
1338
1488
  // TODO: this will be replaced by using rules
1339
1489
  if (context.trigger === "taggedRelease") {
@@ -1350,7 +1500,7 @@ const createCustomTestJobs = (context) => {
1350
1500
  },
1351
1501
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
1352
1502
  services: buildConfig.jobServices,
1353
- cache: buildConfig.jobCache,
1503
+ cache: (0, createJobCache_1.createJobCacheFromConfig)(context, buildConfig),
1354
1504
  stage: "test",
1355
1505
  needs: [],
1356
1506
  envMode: "none",
@@ -1361,27 +1511,27 @@ const createCustomTestJobs = (context) => {
1361
1511
  ...base,
1362
1512
  image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage,
1363
1513
  cache: undefined,
1364
- script: [...((_d = (0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : [])],
1514
+ script: [...(0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)],
1365
1515
  allow_failure: true,
1366
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifactsReports, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifacts),
1516
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.artifactsReports, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifacts),
1367
1517
  }
1368
1518
  : null;
1369
1519
  const lintJob = buildConfig.lint
1370
1520
  ? {
1371
1521
  name: "👮 lint",
1372
1522
  ...base,
1373
- image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage,
1374
- script: [...((_k = (0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : [])],
1375
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifactsReports, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifacts),
1523
+ image: (_g = (_f = buildConfig.lint) === null || _f === void 0 ? void 0 : _f.jobImage) !== null && _g !== void 0 ? _g : buildConfig.jobImage,
1524
+ script: [...(0, utils_1.ensureArray)((_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.command)],
1525
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.artifactsReports, (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.artifacts),
1376
1526
  }
1377
1527
  : null;
1378
1528
  const testJob = buildConfig.test
1379
1529
  ? {
1380
1530
  name: "🧪 test",
1381
1531
  ...base,
1382
- image: (_p = (_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : buildConfig.jobImage,
1383
- script: [...((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [])],
1384
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.artifactsReports, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifacts),
1532
+ image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage,
1533
+ script: [...(0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)],
1534
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.artifactsReports, (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.artifacts),
1385
1535
  }
1386
1536
  : null;
1387
1537
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
@@ -1409,6 +1559,7 @@ const artifactsRegistry_1 = __nccwpck_require__(4963);
1409
1559
  const gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(6320);
1410
1560
  const runner_1 = __nccwpck_require__(4058);
1411
1561
  const gitlab_1 = __nccwpck_require__(8490);
1562
+ const createJobCache_1 = __nccwpck_require__(4372);
1412
1563
  const DOCKER_BUILD_RUNNER_REQUESTS = {
1413
1564
  KUBERNETES_CPU_REQUEST: "0.45",
1414
1565
  KUBERNETES_MEMORY_REQUEST: "1Gi",
@@ -1498,11 +1649,12 @@ const getDockerJobBaseProps = () => {
1498
1649
  };
1499
1650
  };
1500
1651
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
1501
- const createDockerBuildJobBase = (context, { script, ...def }) => {
1652
+ const createDockerBuildJobBase = (context, { script, cache, ...def }) => {
1502
1653
  return (0, lodash_1.merge)({
1503
1654
  name: exports.DOCKER_BUILD_JOB_NAME,
1504
1655
  envMode: "jobPerEnv",
1505
1656
  stage: "build",
1657
+ cache: cache ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, cache) : undefined,
1506
1658
  ...(0, exports.getDockerJobBaseProps)(),
1507
1659
  script: script || [],
1508
1660
  }, {
@@ -1656,14 +1808,11 @@ exports.WORKSPACE_BUILD_TYPES = {
1656
1808
 
1657
1809
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1658
1810
  exports.createNodeDockerJobDefinition = exports.createNodeBuildJobDefinition = exports.createNodeBuildJobs = void 0;
1659
- const runner_1 = __nccwpck_require__(4058);
1660
1811
  const context_1 = __nccwpck_require__(1724);
1661
- const utils_1 = __nccwpck_require__(2497);
1662
1812
  const base_1 = __nccwpck_require__(9366);
1813
+ const createBuildJobDefinition_1 = __nccwpck_require__(6354);
1663
1814
  const docker_1 = __nccwpck_require__(9641);
1664
- const types_1 = __nccwpck_require__(4466);
1665
1815
  const cache_1 = __nccwpck_require__(2026);
1666
- const constants_1 = __nccwpck_require__(1765);
1667
1816
  const yarn_1 = __nccwpck_require__(5043);
1668
1817
  const createNodeBuildJobs = (context) => {
1669
1818
  if (context.type === "workspace") {
@@ -1680,26 +1829,12 @@ const createNodeBuildJobs = (context) => {
1680
1829
  };
1681
1830
  exports.createNodeBuildJobs = createNodeBuildJobs;
1682
1831
  const createNodeBuildJobDefinition = (context) => {
1683
- var _a, _b, _c;
1684
1832
  const buildConfig = context.build.config;
1685
- if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
1686
- throw new Error("deploy config is not node, node-static or storybook");
1687
- }
1688
- if (buildConfig.buildCommand === null)
1689
- return undefined;
1690
- const defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
1691
1833
  const yarnInstall = (0, yarn_1.getYarnInstall)(context);
1692
- return {
1693
- image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
1694
- runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
1695
- cache: [
1696
- ...((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []),
1697
- ...(0, cache_1.getNodeCache)(context),
1698
- ...(0, cache_1.getNextCache)(context),
1699
- ],
1700
- script: [...yarnInstall, ...((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])],
1701
- jobTags: buildConfig.jobTags,
1702
- };
1834
+ return (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
1835
+ prescript: yarnInstall,
1836
+ cache: [...(0, cache_1.getNodeCache)(context), ...(0, cache_1.getNextCache)(context)],
1837
+ });
1703
1838
  };
1704
1839
  exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
1705
1840
  const createNodeDockerJobDefinition = (context) => {
@@ -1741,17 +1876,12 @@ const getYarnCache = (context, policy = "pull-push") => {
1741
1876
  const componentIsInWorkspace = context.type === "component" &&
1742
1877
  context.packageManagerInfo.componentIsInWorkspace;
1743
1878
  return [
1744
- componentIsInWorkspace
1745
- ? {
1746
- key: "yarn",
1747
- policy,
1748
- paths: [".yarn"],
1749
- }
1750
- : {
1751
- key: (0, slugify_1.default)(context.build.dir) + "-yarn",
1752
- policy,
1753
- paths: [(0, path_1.join)(context.build.dir, ".yarn")],
1754
- },
1879
+ {
1880
+ scope: componentIsInWorkspace ? "global" : "buildDir",
1881
+ key: "yarn",
1882
+ policy,
1883
+ paths: [".yarn"],
1884
+ },
1755
1885
  ];
1756
1886
  };
1757
1887
  exports.getYarnCache = getYarnCache;
@@ -1763,6 +1893,8 @@ const getNodeModulesCache = (context, policy = "pull-push") => {
1763
1893
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
1764
1894
  return [
1765
1895
  {
1896
+ scope: "global",
1897
+ pathMode: "absolute",
1766
1898
  // if component is in a shared workspace, use workspace cache. use individual cache else
1767
1899
  key: componentIsInWorkspace
1768
1900
  ? "node-modules-workspace"
@@ -1789,13 +1921,13 @@ const getNodeCache = (context, policy = "pull-push") => {
1789
1921
  };
1790
1922
  exports.getNodeCache = getNodeCache;
1791
1923
  const getNextCache = (context) => {
1792
- const key = context.name + "-next-cache";
1793
1924
  const paths = context.build
1794
1925
  .getComponentDirs("direct")
1795
1926
  .map((c) => (0, path_1.join)(c, ".next/cache"));
1796
1927
  return [
1797
1928
  {
1798
- key,
1929
+ pathMode: "absolute",
1930
+ key: "next-cache",
1799
1931
  policy: "pull-push",
1800
1932
  paths,
1801
1933
  },
@@ -1806,9 +1938,9 @@ const getWorkspaceDefaultCaches = (context) => {
1806
1938
  return [
1807
1939
  {
1808
1940
  // turbo repo
1809
- key: context.name + "-turbo",
1941
+ key: "turbo",
1810
1942
  policy: "pull-push",
1811
- paths: [(0, path_1.join)(context.build.dir, ".turbo")],
1943
+ paths: [".turbo"],
1812
1944
  },
1813
1945
  ];
1814
1946
  };
@@ -1866,7 +1998,6 @@ exports.createMeteorJobs = createMeteorJobs;
1866
1998
 
1867
1999
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1868
2000
  exports.createMeteorBuildJobs = void 0;
1869
- const path_1 = __nccwpck_require__(1017);
1870
2001
  const runner_1 = __nccwpck_require__(4058);
1871
2002
  const base_1 = __nccwpck_require__(9366);
1872
2003
  const docker_1 = __nccwpck_require__(9641);
@@ -1875,13 +2006,13 @@ const cache_1 = __nccwpck_require__(2026);
1875
2006
  const yarn_1 = __nccwpck_require__(5043);
1876
2007
  const getMeteorCache = (context) => [
1877
2008
  {
1878
- key: context.name + "-meteor-build-cache",
2009
+ key: "meteor-build-cache",
1879
2010
  policy: "pull-push",
1880
2011
  paths: [
1881
- (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
1882
- (0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
1883
- (0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
1884
- (0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
2012
+ ".meteor/local/resolver-result-cache.json",
2013
+ ".meteor/local/plugin-cache",
2014
+ ".meteor/local/isopacks",
2015
+ ".meteor/local/bundler-cache/scanner",
1885
2016
  ],
1886
2017
  },
1887
2018
  ];
@@ -1936,6 +2067,7 @@ const createArtifactsConfig_1 = __nccwpck_require__(2820);
1936
2067
  const cache_1 = __nccwpck_require__(2026);
1937
2068
  const constants_1 = __nccwpck_require__(1765);
1938
2069
  const yarn_1 = __nccwpck_require__(5043);
2070
+ const createJobCache_1 = __nccwpck_require__(4372);
1939
2071
  const createNodeTestJobs = (context) => {
1940
2072
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1941
2073
  // don't run tests after release
@@ -1973,7 +2105,7 @@ const createNodeTestJobs = (context) => {
1973
2105
  cache: undefined, // audit does not need yarn install and no cache
1974
2106
  script: [
1975
2107
  `cd ${context.build.dir}`,
1976
- ...((_d = (0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : [
2108
+ ...((_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : [
1977
2109
  context.packageManagerInfo.isClassic
1978
2110
  ? "yarn audit"
1979
2111
  : "yarn npm audit --environment production", // yarn 2
@@ -1988,12 +2120,12 @@ const createNodeTestJobs = (context) => {
1988
2120
  name: "👮 lint",
1989
2121
  ...base,
1990
2122
  image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
1991
- cache: (0, cache_1.getNodeCache)(context),
2123
+ cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
1992
2124
  script: [
1993
2125
  ...(0, yarn_1.ensureNodeVersion)(context),
1994
2126
  `cd ${context.build.dir}`,
1995
2127
  ...yarnInstall,
1996
- ...((_k = (0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["yarn lint"]),
2128
+ ...((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["yarn lint"]),
1997
2129
  ],
1998
2130
  ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifactsReports, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifacts),
1999
2131
  }
@@ -2003,12 +2135,12 @@ const createNodeTestJobs = (context) => {
2003
2135
  name: "🧪 test",
2004
2136
  ...base,
2005
2137
  image: (_p = (_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
2006
- cache: (0, cache_1.getNodeCache)(context),
2138
+ cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
2007
2139
  script: [
2008
2140
  ...(0, yarn_1.ensureNodeVersion)(context),
2009
2141
  `cd ${context.build.dir}`,
2010
2142
  ...yarnInstall,
2011
- ...((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn test"]),
2143
+ ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn test"]),
2012
2144
  ],
2013
2145
  ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.artifactsReports, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifacts),
2014
2146
  }
@@ -2045,7 +2177,6 @@ const ensureNodeVersion = (context) => (0, gitlab_1.collapseableSection)("nodein
2045
2177
  ]);
2046
2178
  exports.ensureNodeVersion = ensureNodeVersion;
2047
2179
  const getYarnInstall = (context, options) => {
2048
- var _a;
2049
2180
  const postInstall = context.type !== "workspace" && "postInstall" in context.build.config
2050
2181
  ? context.build.config.postInstall
2051
2182
  : null;
@@ -2053,7 +2184,7 @@ const getYarnInstall = (context, options) => {
2053
2184
  ...(0, exports.ensureNodeVersion)(context),
2054
2185
  ...(0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)]),
2055
2186
  ...(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
2056
- ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [])
2187
+ ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall))
2057
2188
  : []),
2058
2189
  ];
2059
2190
  };
@@ -2214,7 +2345,7 @@ const createRailsTestJobs = (context) => {
2214
2345
  image: (_c = (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
2215
2346
  script: [
2216
2347
  `cd ${context.build.dir}`,
2217
- ...((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
2348
+ ...((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
2218
2349
  "gem install bundler-audit",
2219
2350
  "bundle audit check",
2220
2351
  ]),
@@ -2231,7 +2362,7 @@ const createRailsTestJobs = (context) => {
2231
2362
  script: [
2232
2363
  `cd ${context.build.dir}`,
2233
2364
  ...bundlerInstall,
2234
- ...((_k = (0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : [
2365
+ ...((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : [
2235
2366
  "bundle exec rubocop",
2236
2367
  ]),
2237
2368
  ],
@@ -2246,7 +2377,7 @@ const createRailsTestJobs = (context) => {
2246
2377
  script: [
2247
2378
  `cd ${context.build.dir}`,
2248
2379
  ...bundlerInstall,
2249
- ...((_q = (0, utils_1.ensureArray)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)) !== null && _q !== void 0 ? _q : [
2380
+ ...((_q = (0, utils_1.ensureArrayOrNull)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)) !== null && _q !== void 0 ? _q : [
2250
2381
  "bundle exec rspec",
2251
2382
  ]),
2252
2383
  ],
@@ -2287,7 +2418,7 @@ const createSbomBuildJob = (context) => {
2287
2418
  const script = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
2288
2419
  buildConfig.type === "custom" &&
2289
2420
  buildConfig.sbom !== false
2290
- ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
2421
+ ? (_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
2291
2422
  : defaultScript;
2292
2423
  return {
2293
2424
  name: exports.SBOM_BUILD_JOB_NAME,
@@ -6227,11 +6358,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
6227
6358
  __exportStar(__nccwpck_require__(7770), exports);
6228
6359
  __exportStar(__nccwpck_require__(688), exports);
6229
6360
  __exportStar(__nccwpck_require__(1724), exports);
6361
+ __exportStar(__nccwpck_require__(8207), exports);
6230
6362
  __exportStar(__nccwpck_require__(2074), exports);
6231
6363
  //# sourceMappingURL=index.js.map
6232
6364
 
6233
6365
  /***/ }),
6234
6366
 
6367
+ /***/ 8207:
6368
+ /***/ ((__unused_webpack_module, exports) => {
6369
+
6370
+ "use strict";
6371
+
6372
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
6373
+ //# sourceMappingURL=jobDefinition.js.map
6374
+
6375
+ /***/ }),
6376
+
6235
6377
  /***/ 7432:
6236
6378
  /***/ ((__unused_webpack_module, exports) => {
6237
6379
 
@@ -6305,13 +6447,15 @@ exports.collapseableSection = collapseableSection;
6305
6447
  "use strict";
6306
6448
 
6307
6449
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6308
- exports.mergeWithMergingArrays = exports.ensureArray = exports.notNil = void 0;
6450
+ exports.mergeWithMergingArrays = exports.ensureArray = exports.ensureArrayOrNull = exports.notNil = void 0;
6309
6451
  const lodash_1 = __nccwpck_require__(3255);
6310
6452
  function notNil(value) {
6311
6453
  return value !== null && value !== undefined;
6312
6454
  }
6313
6455
  exports.notNil = notNil;
6314
- const ensureArray = (s) => (0, lodash_1.isNil)(s) ? null : Array.isArray(s) ? s : [s];
6456
+ const ensureArrayOrNull = (s) => (0, lodash_1.isNil)(s) ? null : Array.isArray(s) ? s : [s];
6457
+ exports.ensureArrayOrNull = ensureArrayOrNull;
6458
+ const ensureArray = (s) => { var _a; return (_a = (0, exports.ensureArrayOrNull)(s)) !== null && _a !== void 0 ? _a : []; };
6315
6459
  exports.ensureArray = ensureArray;
6316
6460
  // see https://github.com/lodash/lodash/issues/5384
6317
6461
  const mergeWithMergingArrays = (obj1, obj2) => {
@@ -9217,7 +9361,7 @@ module.exports = {
9217
9361
  '949': 'cp949',
9218
9362
  'cp949': {
9219
9363
  type: '_dbcs',
9220
- table: function() { return __nccwpck_require__(6354) },
9364
+ table: function() { return __nccwpck_require__(8388) },
9221
9365
  },
9222
9366
 
9223
9367
  'cseuckr': 'cp949',
@@ -48399,7 +48543,7 @@ module.exports = JSON.parse('[["0","\\u0000",127,"€"],["8140","丂丄丅丆丏
48399
48543
 
48400
48544
  /***/ }),
48401
48545
 
48402
- /***/ 6354:
48546
+ /***/ 8388:
48403
48547
  /***/ ((module) => {
48404
48548
 
48405
48549
  "use strict";