@catladder/cli 0.0.0-main-d05b00fd → 0.0.0-main-d53664e5

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 +233 -88
  2. package/dist/bundles/cli/index.js +231 -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 +13 -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, _c;
1065
+ const createAppBuildJob = (context, { script, variables, runnerVariables, cache, ...def }) => {
1066
+ var _a, _b;
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"
@@ -1098,7 +1099,7 @@ const createAppBuildJob = (context, { script, variables, runnerVariables, ...def
1098
1099
  ...(context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : []),
1099
1100
  ...(0, yarn_1.ensureNodeVersion)(context), // in pure node repos, we might want to have the nvmrc file in top-level
1100
1101
  `cd ${context.build.dir}`,
1101
- ...((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []),
1102
+ ...(0, utils_1.ensureArray)(script),
1102
1103
  ],
1103
1104
  artifacts: (0, createBuildJobArtifact_1.createBuildJobArtifacts)(context),
1104
1105
  }, def);
@@ -1145,6 +1146,43 @@ exports.createArtifactsConfig = createArtifactsConfig;
1145
1146
 
1146
1147
  /***/ }),
1147
1148
 
1149
+ /***/ 6354:
1150
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1151
+
1152
+ "use strict";
1153
+
1154
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1155
+ exports.createBuildJobDefinition = void 0;
1156
+ const runner_1 = __nccwpck_require__(4058);
1157
+ const utils_1 = __nccwpck_require__(2497);
1158
+ const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(673);
1159
+ const constants_1 = __nccwpck_require__(1765);
1160
+ const createBuildJobDefinition = (context, buildConfig, customize = {}) => {
1161
+ var _a, _b, _c, _d;
1162
+ if (buildConfig.buildCommand === null)
1163
+ return undefined;
1164
+ const defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
1165
+ return {
1166
+ image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
1167
+ runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
1168
+ cache: [
1169
+ ...((_b = customize.cache) !== null && _b !== void 0 ? _b : []),
1170
+ ...(0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, buildConfig),
1171
+ ],
1172
+ services: "jobServices" in buildConfig ? buildConfig.jobServices : undefined,
1173
+ script: [
1174
+ ...((_c = customize.prescript) !== null && _c !== void 0 ? _c : []),
1175
+ ...(0, utils_1.ensureArray)(buildConfig.buildCommand),
1176
+ ...((_d = customize.postscript) !== null && _d !== void 0 ? _d : []),
1177
+ ],
1178
+ jobTags: buildConfig.jobTags,
1179
+ };
1180
+ };
1181
+ exports.createBuildJobDefinition = createBuildJobDefinition;
1182
+ //# sourceMappingURL=createBuildJobDefinition.js.map
1183
+
1184
+ /***/ }),
1185
+
1148
1186
  /***/ 9366:
1149
1187
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1150
1188
 
@@ -1258,6 +1296,129 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
1258
1296
 
1259
1297
  /***/ }),
1260
1298
 
1299
+ /***/ 4372:
1300
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1301
+
1302
+ "use strict";
1303
+
1304
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1305
+ exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
1306
+ const path_1 = __nccwpck_require__(1017);
1307
+ const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(673);
1308
+ const createJobCacheFromCacheConfigs = (context, caches) => {
1309
+ if (caches.length === 0)
1310
+ return undefined;
1311
+ const simpleCacheDefs = caches.filter((c) => !("key" in c));
1312
+ const advancedCacheDefs = caches.filter((c) => "key" in c);
1313
+ // 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
1314
+ const simpleCaches = simpleCacheDefs.length > 0
1315
+ ? [
1316
+ {
1317
+ key: context.name + "-default",
1318
+ policy: "pull-push",
1319
+ paths: simpleCacheDefs.flatMap((c) => c.paths.map((p) => {
1320
+ var _a;
1321
+ const baseDir = c.pathMode === "absolute"
1322
+ ? ""
1323
+ : (_a = c.baseDir) !== null && _a !== void 0 ? _a : context.build.dir;
1324
+ return (0, path_1.join)(baseDir, p);
1325
+ })),
1326
+ },
1327
+ ]
1328
+ : [];
1329
+ const advancedCaches = advancedCacheDefs.map(({ key, paths, policy, scope, pathMode, buildDir, ...rest }) => {
1330
+ var _a;
1331
+ const baseDir = pathMode === "absolute" ? "" : buildDir !== null && buildDir !== void 0 ? buildDir : context.build.dir;
1332
+ const transformedKey = scope === "global"
1333
+ ? key
1334
+ : typeof key === "string"
1335
+ ? (scope === "buildDir" // really edge case...
1336
+ ? baseDir
1337
+ : context.name) +
1338
+ "-" +
1339
+ key
1340
+ : {
1341
+ ...key,
1342
+ files: (_a = key.files) === null || _a === void 0 ? void 0 : _a.map((f) => pathMode === "absolute" ? f : (0, path_1.join)(baseDir, f)),
1343
+ };
1344
+ return {
1345
+ key: transformedKey,
1346
+ policy: policy !== null && policy !== void 0 ? policy : "pull-push",
1347
+ paths: pathMode === "absolute" ? paths : paths === null || paths === void 0 ? void 0 : paths.map((p) => (0, path_1.join)(baseDir, p)),
1348
+ ...rest,
1349
+ };
1350
+ });
1351
+ return [...advancedCaches, ...simpleCaches];
1352
+ };
1353
+ exports.createJobCacheFromCacheConfigs = createJobCacheFromCacheConfigs;
1354
+ /** shortcut, used in some build types */
1355
+ const createJobCacheFromConfig = (context, buildConfig) => {
1356
+ return (0, exports.createJobCacheFromCacheConfigs)(context, (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, buildConfig));
1357
+ };
1358
+ exports.createJobCacheFromConfig = createJobCacheFromConfig;
1359
+ //# sourceMappingURL=createJobCache.js.map
1360
+
1361
+ /***/ }),
1362
+
1363
+ /***/ 673:
1364
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1365
+
1366
+ "use strict";
1367
+
1368
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1369
+ exports.getAllCacheConfigsFromConfig = void 0;
1370
+ const index_1 = __nccwpck_require__(2497);
1371
+ const transformLegacyJobCache_1 = __nccwpck_require__(6673);
1372
+ const getAllCacheConfigsFromConfig = (context, buildConfig) => {
1373
+ return [
1374
+ ...("jobCache" in buildConfig
1375
+ ? (0, transformLegacyJobCache_1.transformLegacyJobCache)(buildConfig.jobCache)
1376
+ : []),
1377
+ ...(0, index_1.ensureArray)(buildConfig.cache).map((c) => ({
1378
+ ...c,
1379
+ context,
1380
+ })),
1381
+ ...(context.type === "workspace"
1382
+ ? // also add cache configs of the components of that workspace
1383
+ context.components.flatMap((componentContext) => {
1384
+ var _a;
1385
+ return (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map((c) => ({
1386
+ ...c,
1387
+ baseDir: componentContext.build.dir,
1388
+ }))) !== null && _a !== void 0 ? _a : [];
1389
+ })
1390
+ : []),
1391
+ ];
1392
+ };
1393
+ exports.getAllCacheConfigsFromConfig = getAllCacheConfigsFromConfig;
1394
+ //# sourceMappingURL=getAllCacheConfigsFromConfig.js.map
1395
+
1396
+ /***/ }),
1397
+
1398
+ /***/ 6673:
1399
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1400
+
1401
+ "use strict";
1402
+
1403
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1404
+ exports.transformLegacyJobCache = void 0;
1405
+ const utils_1 = __nccwpck_require__(2497);
1406
+ function transformLegacyJobCache(jobCache) {
1407
+ return (0, utils_1.ensureArray)(jobCache).map((cache) => {
1408
+ var _a, _b;
1409
+ return ({
1410
+ pathMode: "absolute",
1411
+ ...cache,
1412
+ key: (_a = cache.key) !== null && _a !== void 0 ? _a : "default",
1413
+ paths: (_b = cache.paths) !== null && _b !== void 0 ? _b : [],
1414
+ });
1415
+ });
1416
+ }
1417
+ exports.transformLegacyJobCache = transformLegacyJobCache;
1418
+ //# sourceMappingURL=transformLegacyJobCache.js.map
1419
+
1420
+ /***/ }),
1421
+
1261
1422
  /***/ 1637:
1262
1423
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1263
1424
 
@@ -1265,30 +1426,18 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
1265
1426
 
1266
1427
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1267
1428
  exports.createCustomBuildJobs = void 0;
1268
- const utils_1 = __nccwpck_require__(2497);
1269
1429
  const docker_1 = __nccwpck_require__(9641);
1270
1430
  const types_1 = __nccwpck_require__(4466);
1271
1431
  const base_1 = __nccwpck_require__(9366);
1272
- const RUNNER_BUILD_VARIABLES = {
1273
- KUBERNETES_CPU_REQUEST: "0.45",
1274
- KUBERNETES_MEMORY_REQUEST: "1Gi",
1275
- KUBERNETES_MEMORY_LIMIT: "4Gi",
1276
- };
1432
+ const createBuildJobDefinition_1 = __nccwpck_require__(6354);
1277
1433
  const createCustomBuildJobs = (context) => {
1278
- var _a;
1279
1434
  const buildConfig = context.build.config;
1280
1435
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
1281
1436
  throw new Error("deploy config is not custom");
1282
1437
  }
1283
1438
  return (0, base_1.createComponentBuildJobs)(context, {
1284
1439
  appBuild: buildConfig.buildCommand !== null
1285
- ? {
1286
- image: buildConfig.jobImage,
1287
- runnerVariables: RUNNER_BUILD_VARIABLES,
1288
- cache: buildConfig.jobCache,
1289
- services: buildConfig.jobServices,
1290
- script: [...((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])],
1291
- }
1440
+ ? (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig)
1292
1441
  : undefined,
1293
1442
  dockerBuild: {
1294
1443
  script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
@@ -1326,15 +1475,16 @@ exports.createCustomJobs = createCustomJobs;
1326
1475
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1327
1476
  exports.createCustomTestJobs = void 0;
1328
1477
  const utils_1 = __nccwpck_require__(2497);
1329
- const types_1 = __nccwpck_require__(4466);
1330
1478
  const createArtifactsConfig_1 = __nccwpck_require__(2820);
1479
+ const createJobCache_1 = __nccwpck_require__(4372);
1480
+ const types_1 = __nccwpck_require__(4466);
1331
1481
  const RUNNER_CUSTOM_TEST_VARIABLES = {
1332
1482
  KUBERNETES_CPU_REQUEST: "0.45",
1333
1483
  KUBERNETES_MEMORY_REQUEST: "1Gi",
1334
1484
  KUBERNETES_MEMORY_LIMIT: "4Gi",
1335
1485
  };
1336
1486
  const createCustomTestJobs = (context) => {
1337
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1487
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1338
1488
  // don't run tests after release
1339
1489
  // TODO: this will be replaced by using rules
1340
1490
  if (context.trigger === "taggedRelease") {
@@ -1352,7 +1502,7 @@ const createCustomTestJobs = (context) => {
1352
1502
  },
1353
1503
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
1354
1504
  services: buildConfig.jobServices,
1355
- cache: buildConfig.jobCache,
1505
+ cache: (0, createJobCache_1.createJobCacheFromConfig)(context, buildConfig),
1356
1506
  stage: "test",
1357
1507
  needs: [],
1358
1508
  envMode: "none",
@@ -1363,27 +1513,27 @@ const createCustomTestJobs = (context) => {
1363
1513
  ...base,
1364
1514
  image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage,
1365
1515
  cache: undefined,
1366
- script: [...((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])],
1516
+ script: [...(0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)],
1367
1517
  allow_failure: true,
1368
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts),
1518
+ ...(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),
1369
1519
  }
1370
1520
  : null;
1371
1521
  const lintJob = buildConfig.lint
1372
1522
  ? {
1373
1523
  name: "👮 lint",
1374
1524
  ...base,
1375
- image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage,
1376
- script: [...((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])],
1377
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts),
1525
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage,
1526
+ script: [...(0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)],
1527
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.artifactsReports, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifacts),
1378
1528
  }
1379
1529
  : null;
1380
1530
  const testJob = buildConfig.test
1381
1531
  ? {
1382
1532
  name: "🧪 test",
1383
1533
  ...base,
1384
- image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage,
1385
- script: [...((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])],
1386
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts),
1534
+ image: (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage,
1535
+ script: [...(0, utils_1.ensureArray)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)],
1536
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.artifactsReports, (_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.artifacts),
1387
1537
  }
1388
1538
  : null;
1389
1539
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
@@ -1411,6 +1561,7 @@ const artifactsRegistry_1 = __nccwpck_require__(4963);
1411
1561
  const gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(6320);
1412
1562
  const runner_1 = __nccwpck_require__(4058);
1413
1563
  const gitlab_1 = __nccwpck_require__(8490);
1564
+ const createJobCache_1 = __nccwpck_require__(4372);
1414
1565
  const DOCKER_BUILD_RUNNER_REQUESTS = {
1415
1566
  KUBERNETES_CPU_REQUEST: "0.45",
1416
1567
  KUBERNETES_MEMORY_REQUEST: "1Gi",
@@ -1500,11 +1651,12 @@ const getDockerJobBaseProps = () => {
1500
1651
  };
1501
1652
  };
1502
1653
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
1503
- const createDockerBuildJobBase = (context, { script, ...def }) => {
1654
+ const createDockerBuildJobBase = (context, { script, cache, ...def }) => {
1504
1655
  return (0, lodash_1.merge)({
1505
1656
  name: exports.DOCKER_BUILD_JOB_NAME,
1506
1657
  envMode: "jobPerEnv",
1507
1658
  stage: "build",
1659
+ cache: cache ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, cache) : undefined,
1508
1660
  ...(0, exports.getDockerJobBaseProps)(),
1509
1661
  script: script || [],
1510
1662
  }, {
@@ -1658,14 +1810,11 @@ exports.WORKSPACE_BUILD_TYPES = {
1658
1810
 
1659
1811
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1660
1812
  exports.createNodeDockerJobDefinition = exports.createNodeBuildJobDefinition = exports.createNodeBuildJobs = void 0;
1661
- const runner_1 = __nccwpck_require__(4058);
1662
1813
  const context_1 = __nccwpck_require__(1724);
1663
- const utils_1 = __nccwpck_require__(2497);
1664
1814
  const base_1 = __nccwpck_require__(9366);
1815
+ const createBuildJobDefinition_1 = __nccwpck_require__(6354);
1665
1816
  const docker_1 = __nccwpck_require__(9641);
1666
- const types_1 = __nccwpck_require__(4466);
1667
1817
  const cache_1 = __nccwpck_require__(2026);
1668
- const constants_1 = __nccwpck_require__(1765);
1669
1818
  const yarn_1 = __nccwpck_require__(5043);
1670
1819
  const createNodeBuildJobs = (context) => {
1671
1820
  if (context.type === "workspace") {
@@ -1682,26 +1831,12 @@ const createNodeBuildJobs = (context) => {
1682
1831
  };
1683
1832
  exports.createNodeBuildJobs = createNodeBuildJobs;
1684
1833
  const createNodeBuildJobDefinition = (context) => {
1685
- var _a, _b, _c;
1686
1834
  const buildConfig = context.build.config;
1687
- if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
1688
- throw new Error("deploy config is not node, node-static or storybook");
1689
- }
1690
- if (buildConfig.buildCommand === null)
1691
- return undefined;
1692
- const defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
1693
1835
  const yarnInstall = (0, yarn_1.getYarnInstall)(context);
1694
- return {
1695
- image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
1696
- runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
1697
- cache: [
1698
- ...((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []),
1699
- ...(0, cache_1.getNodeCache)(context),
1700
- ...(0, cache_1.getNextCache)(context),
1701
- ],
1702
- script: [...yarnInstall, ...((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])],
1703
- jobTags: buildConfig.jobTags,
1704
- };
1836
+ return (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
1837
+ prescript: yarnInstall,
1838
+ cache: [...(0, cache_1.getNodeCache)(context), ...(0, cache_1.getNextCache)(context)],
1839
+ });
1705
1840
  };
1706
1841
  exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
1707
1842
  const createNodeDockerJobDefinition = (context) => {
@@ -1743,17 +1878,13 @@ const getYarnCache = (context, policy = "pull-push") => {
1743
1878
  const componentIsInWorkspace = context.type === "component" &&
1744
1879
  context.packageManagerInfo.componentIsInWorkspace;
1745
1880
  return [
1746
- componentIsInWorkspace
1747
- ? {
1748
- key: "yarn",
1749
- policy,
1750
- paths: [".yarn"],
1751
- }
1752
- : {
1753
- key: (0, slugify_1.default)(context.build.dir) + "-yarn",
1754
- policy,
1755
- paths: [(0, path_1.join)(context.build.dir, ".yarn")],
1756
- },
1881
+ {
1882
+ scope: componentIsInWorkspace ? "global" : "buildDir",
1883
+ pathMode: componentIsInWorkspace ? "absolute" : "relative",
1884
+ key: "yarn",
1885
+ policy,
1886
+ paths: [".yarn"],
1887
+ },
1757
1888
  ];
1758
1889
  };
1759
1890
  exports.getYarnCache = getYarnCache;
@@ -1765,6 +1896,8 @@ const getNodeModulesCache = (context, policy = "pull-push") => {
1765
1896
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
1766
1897
  return [
1767
1898
  {
1899
+ scope: "global",
1900
+ pathMode: "absolute",
1768
1901
  // if component is in a shared workspace, use workspace cache. use individual cache else
1769
1902
  key: componentIsInWorkspace
1770
1903
  ? "node-modules-workspace"
@@ -1791,13 +1924,13 @@ const getNodeCache = (context, policy = "pull-push") => {
1791
1924
  };
1792
1925
  exports.getNodeCache = getNodeCache;
1793
1926
  const getNextCache = (context) => {
1794
- const key = context.name + "-next-cache";
1795
1927
  const paths = context.build
1796
1928
  .getComponentDirs("direct")
1797
1929
  .map((c) => (0, path_1.join)(c, ".next/cache"));
1798
1930
  return [
1799
1931
  {
1800
- key,
1932
+ pathMode: "absolute",
1933
+ key: "next-cache",
1801
1934
  policy: "pull-push",
1802
1935
  paths,
1803
1936
  },
@@ -1808,9 +1941,9 @@ const getWorkspaceDefaultCaches = (context) => {
1808
1941
  return [
1809
1942
  {
1810
1943
  // turbo repo
1811
- key: context.name + "-turbo",
1944
+ key: "turbo",
1812
1945
  policy: "pull-push",
1813
- paths: [(0, path_1.join)(context.build.dir, ".turbo")],
1946
+ paths: [".turbo"],
1814
1947
  },
1815
1948
  ];
1816
1949
  };
@@ -1868,7 +2001,6 @@ exports.createMeteorJobs = createMeteorJobs;
1868
2001
 
1869
2002
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1870
2003
  exports.createMeteorBuildJobs = void 0;
1871
- const path_1 = __nccwpck_require__(1017);
1872
2004
  const runner_1 = __nccwpck_require__(4058);
1873
2005
  const base_1 = __nccwpck_require__(9366);
1874
2006
  const docker_1 = __nccwpck_require__(9641);
@@ -1877,13 +2009,13 @@ const cache_1 = __nccwpck_require__(2026);
1877
2009
  const yarn_1 = __nccwpck_require__(5043);
1878
2010
  const getMeteorCache = (context) => [
1879
2011
  {
1880
- key: context.name + "-meteor-build-cache",
2012
+ key: "meteor-build-cache",
1881
2013
  policy: "pull-push",
1882
2014
  paths: [
1883
- (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
1884
- (0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
1885
- (0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
1886
- (0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
2015
+ ".meteor/local/resolver-result-cache.json",
2016
+ ".meteor/local/plugin-cache",
2017
+ ".meteor/local/isopacks",
2018
+ ".meteor/local/bundler-cache/scanner",
1887
2019
  ],
1888
2020
  },
1889
2021
  ];
@@ -1938,6 +2070,7 @@ const createArtifactsConfig_1 = __nccwpck_require__(2820);
1938
2070
  const cache_1 = __nccwpck_require__(2026);
1939
2071
  const constants_1 = __nccwpck_require__(1765);
1940
2072
  const yarn_1 = __nccwpck_require__(5043);
2073
+ const createJobCache_1 = __nccwpck_require__(4372);
1941
2074
  const createNodeTestJobs = (context) => {
1942
2075
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1943
2076
  // don't run tests after release
@@ -1976,7 +2109,7 @@ const createNodeTestJobs = (context) => {
1976
2109
  cache: undefined, // audit does not need yarn install and no cache
1977
2110
  script: [
1978
2111
  `cd ${context.build.dir}`,
1979
- ...((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
2112
+ ...((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
1980
2113
  context.packageManagerInfo.isClassic
1981
2114
  ? "yarn audit"
1982
2115
  : "yarn npm audit --environment production", // yarn 2
@@ -1991,12 +2124,12 @@ const createNodeTestJobs = (context) => {
1991
2124
  name: "👮 lint",
1992
2125
  ...base,
1993
2126
  image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
1994
- cache: (0, cache_1.getNodeCache)(context),
2127
+ cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
1995
2128
  script: [
1996
2129
  ...(0, yarn_1.ensureNodeVersion)(context),
1997
2130
  `cd ${context.build.dir}`,
1998
2131
  ...yarnInstall,
1999
- ...((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]),
2132
+ ...((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]),
2000
2133
  ],
2001
2134
  ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts),
2002
2135
  }
@@ -2006,12 +2139,12 @@ const createNodeTestJobs = (context) => {
2006
2139
  name: "🧪 test",
2007
2140
  ...base,
2008
2141
  image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
2009
- cache: (0, cache_1.getNodeCache)(context),
2142
+ cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
2010
2143
  script: [
2011
2144
  ...(0, yarn_1.ensureNodeVersion)(context),
2012
2145
  `cd ${context.build.dir}`,
2013
2146
  ...yarnInstall,
2014
- ...((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]),
2147
+ ...((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]),
2015
2148
  ],
2016
2149
  ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts),
2017
2150
  }
@@ -2048,7 +2181,6 @@ const ensureNodeVersion = (context) => (0, gitlab_1.collapseableSection)("nodein
2048
2181
  ]);
2049
2182
  exports.ensureNodeVersion = ensureNodeVersion;
2050
2183
  const getYarnInstall = (context, options) => {
2051
- var _a;
2052
2184
  const postInstall = context.type !== "workspace" && "postInstall" in context.build.config
2053
2185
  ? context.build.config.postInstall
2054
2186
  : null;
@@ -2056,7 +2188,7 @@ const getYarnInstall = (context, options) => {
2056
2188
  ...(0, exports.ensureNodeVersion)(context),
2057
2189
  ...(0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)]),
2058
2190
  ...(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
2059
- ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [])
2191
+ ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall))
2060
2192
  : []),
2061
2193
  ];
2062
2194
  };
@@ -2219,7 +2351,7 @@ const createRailsTestJobs = (context) => {
2219
2351
  image: (_d = (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
2220
2352
  script: [
2221
2353
  `cd ${context.build.dir}`,
2222
- ...((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
2354
+ ...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
2223
2355
  "gem install bundler-audit",
2224
2356
  "bundle audit check",
2225
2357
  ]),
@@ -2236,7 +2368,7 @@ const createRailsTestJobs = (context) => {
2236
2368
  script: [
2237
2369
  `cd ${context.build.dir}`,
2238
2370
  ...bundlerInstall,
2239
- ...((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [
2371
+ ...((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [
2240
2372
  "bundle exec rubocop",
2241
2373
  ]),
2242
2374
  ],
@@ -2251,7 +2383,7 @@ const createRailsTestJobs = (context) => {
2251
2383
  script: [
2252
2384
  `cd ${context.build.dir}`,
2253
2385
  ...bundlerInstall,
2254
- ...((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
2386
+ ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
2255
2387
  "bundle exec rspec",
2256
2388
  ]),
2257
2389
  ],
@@ -2292,7 +2424,7 @@ const createSbomBuildJob = (context) => {
2292
2424
  const script = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
2293
2425
  buildConfig.type === "custom" &&
2294
2426
  buildConfig.sbom !== false
2295
- ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
2427
+ ? (_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
2296
2428
  : defaultScript;
2297
2429
  return {
2298
2430
  name: exports.SBOM_BUILD_JOB_NAME,
@@ -6305,11 +6437,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
6305
6437
  __exportStar(__nccwpck_require__(7770), exports);
6306
6438
  __exportStar(__nccwpck_require__(688), exports);
6307
6439
  __exportStar(__nccwpck_require__(1724), exports);
6440
+ __exportStar(__nccwpck_require__(8207), exports);
6308
6441
  __exportStar(__nccwpck_require__(2074), exports);
6309
6442
  //# sourceMappingURL=index.js.map
6310
6443
 
6311
6444
  /***/ }),
6312
6445
 
6446
+ /***/ 8207:
6447
+ /***/ ((__unused_webpack_module, exports) => {
6448
+
6449
+ "use strict";
6450
+
6451
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
6452
+ //# sourceMappingURL=jobDefinition.js.map
6453
+
6454
+ /***/ }),
6455
+
6313
6456
  /***/ 7432:
6314
6457
  /***/ ((__unused_webpack_module, exports) => {
6315
6458
 
@@ -6383,13 +6526,15 @@ exports.collapseableSection = collapseableSection;
6383
6526
  "use strict";
6384
6527
 
6385
6528
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6386
- exports.mergeWithMergingArrays = exports.ensureArray = exports.notNil = void 0;
6529
+ exports.mergeWithMergingArrays = exports.ensureArray = exports.ensureArrayOrNull = exports.notNil = void 0;
6387
6530
  const lodash_1 = __nccwpck_require__(3255);
6388
6531
  function notNil(value) {
6389
6532
  return value !== null && value !== undefined;
6390
6533
  }
6391
6534
  exports.notNil = notNil;
6392
- const ensureArray = (s) => (0, lodash_1.isNil)(s) ? null : Array.isArray(s) ? s : [s];
6535
+ const ensureArrayOrNull = (s) => (0, lodash_1.isNil)(s) ? null : Array.isArray(s) ? s : [s];
6536
+ exports.ensureArrayOrNull = ensureArrayOrNull;
6537
+ const ensureArray = (s) => { var _a; return (_a = (0, exports.ensureArrayOrNull)(s)) !== null && _a !== void 0 ? _a : []; };
6393
6538
  exports.ensureArray = ensureArray;
6394
6539
  // see https://github.com/lodash/lodash/issues/5384
6395
6540
  const mergeWithMergingArrays = (obj1, obj2) => {
@@ -9295,7 +9440,7 @@ module.exports = {
9295
9440
  '949': 'cp949',
9296
9441
  'cp949': {
9297
9442
  type: '_dbcs',
9298
- table: function() { return __nccwpck_require__(6354) },
9443
+ table: function() { return __nccwpck_require__(8388) },
9299
9444
  },
9300
9445
 
9301
9446
  'cseuckr': 'cp949',
@@ -48477,7 +48622,7 @@ module.exports = JSON.parse('[["0","\\u0000",127,"€"],["8140","丂丄丅丆丏
48477
48622
 
48478
48623
  /***/ }),
48479
48624
 
48480
- /***/ 6354:
48625
+ /***/ 8388:
48481
48626
  /***/ ((module) => {
48482
48627
 
48483
48628
  "use strict";