@catladder/pipeline 0.0.0-remove-env-mode-none-9b62fbb1 → 0.0.0-remove-sbom-91cda0a4

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 (230) hide show
  1. package/dist/build/artifacts/createBuildJobArtifact.js +7 -4
  2. package/dist/build/base/index.js +2 -4
  3. package/dist/build/custom/testJob.js +13 -11
  4. package/dist/build/docker.d.ts +1 -1
  5. package/dist/build/docker.js +16 -4
  6. package/dist/build/node/cache.js +6 -3
  7. package/dist/build/node/testJob.js +13 -11
  8. package/dist/build/node/yarn.d.ts +2 -1
  9. package/dist/build/node/yarn.js +8 -3
  10. package/dist/build/rails/index.js +2 -2
  11. package/dist/build/types.d.ts +25 -11
  12. package/dist/config/readConfig.js +30 -1
  13. package/dist/constants.js +1 -1
  14. package/dist/context/getEnvironmentVariables.d.ts +4 -4
  15. package/dist/context/getEnvironmentVariables.js +15 -10
  16. package/dist/defaults/index.js +1 -2
  17. package/dist/deploy/base/deploy.js +8 -10
  18. package/dist/deploy/base/stop.js +0 -5
  19. package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +1 -0
  20. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +33 -34
  21. package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -3
  22. package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +2 -3
  23. package/dist/deploy/custom/deployJob.js +2 -3
  24. package/dist/deploy/kubernetes/deployJob.js +2 -3
  25. package/dist/deploy/kubernetes/mongodb.d.ts +4 -0
  26. package/dist/deploy/kubernetes/mongodb.js +4 -0
  27. package/dist/deploy/types/executeBase.d.ts +24 -0
  28. package/dist/deploy/types/executeBase.js +5 -0
  29. package/dist/deploy/types/googleCloudRun.d.ts +13 -5
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +1 -0
  32. package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +2 -0
  33. package/dist/pipeline/gitlab/gitlabReleaseJobs.js +5 -3
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/dist/types/config.d.ts +5 -1
  36. package/dist/utils/measureTime.d.ts +6 -0
  37. package/dist/utils/measureTime.js +49 -0
  38. package/examples/__snapshots__/automatic-releases.test.ts.snap +37 -142
  39. package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +1505 -0
  40. package/examples/__snapshots__/cloud-run-existing-image.test.ts.snap +657 -0
  41. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +37 -142
  42. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +37 -142
  43. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +37 -142
  44. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +37 -142
  45. package/examples/__snapshots__/cloud-run-llama.test.ts.snap +5 -14
  46. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +37 -142
  47. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +21 -134
  48. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +37 -142
  49. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +37 -142
  50. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +37 -142
  51. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +37 -142
  52. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +37 -142
  53. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +37 -142
  54. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +37 -142
  55. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +37 -142
  56. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +37 -142
  57. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +37 -142
  58. package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +1489 -0
  59. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +29 -138
  60. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +37 -142
  61. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +37 -142
  62. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +37 -142
  63. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +37 -142
  64. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +101 -414
  65. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +69 -278
  66. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +37 -142
  67. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +37 -142
  68. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +5 -126
  69. package/examples/__snapshots__/custom-build-job.test.ts.snap +5 -126
  70. package/examples/__snapshots__/custom-deploy.test.ts.snap +37 -130
  71. package/examples/__snapshots__/custom-docker-file.test.ts.snap +1525 -0
  72. package/examples/__snapshots__/custom-envs.test.ts.snap +33 -152
  73. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +5 -14
  74. package/examples/__snapshots__/custom-verify-job.test.ts.snap +37 -142
  75. package/examples/__snapshots__/git-submodule.test.ts.snap +37 -142
  76. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +37 -142
  77. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +37 -142
  78. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +69 -278
  79. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +57 -142
  80. package/examples/__snapshots__/local-dot-env.test.ts.snap +37 -142
  81. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +41 -134
  82. package/examples/__snapshots__/modify-generated-files.test.ts.snap +21 -102
  83. package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +21 -102
  84. package/examples/__snapshots__/multiline-var.test.ts.snap +101 -414
  85. package/examples/__snapshots__/native-app.test.ts.snap +53 -254
  86. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +37 -142
  87. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +37 -142
  88. package/examples/__snapshots__/override-secrets.test.ts.snap +37 -142
  89. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +5 -126
  90. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +5 -126
  91. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +101 -414
  92. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +37 -230
  93. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +53 -270
  94. package/examples/__snapshots__/workspace-api-www.test.ts.snap +45 -270
  95. package/examples/automatic-releases.test.ts +1 -0
  96. package/examples/cloud-run-execute-script-on-deploy.test.ts +12 -0
  97. package/examples/cloud-run-execute-script-on-deploy.ts +47 -0
  98. package/examples/cloud-run-existing-image.test.ts +12 -0
  99. package/examples/cloud-run-existing-image.ts +26 -0
  100. package/examples/cloud-run-health-check-defaults.test.ts +1 -0
  101. package/examples/cloud-run-health-check-only-startup.test.ts +1 -0
  102. package/examples/cloud-run-health-check.test.ts +1 -0
  103. package/examples/cloud-run-http2.test.ts +1 -0
  104. package/examples/cloud-run-llama.test.ts +1 -0
  105. package/examples/cloud-run-memory-limit.test.ts +1 -0
  106. package/examples/cloud-run-meteor-with-worker.test.ts +1 -0
  107. package/examples/cloud-run-nextjs.test.ts +1 -0
  108. package/examples/cloud-run-no-cpu-throttling.test.ts +1 -0
  109. package/examples/cloud-run-no-service.test.ts +1 -0
  110. package/examples/cloud-run-non-public.test.ts +1 -0
  111. package/examples/cloud-run-post-stop-job.test.ts +1 -0
  112. package/examples/cloud-run-post-stop-job.ts +1 -1
  113. package/examples/cloud-run-service-custom-vpc-connector.test.ts +1 -0
  114. package/examples/cloud-run-service-custom-vpc.test.ts +1 -0
  115. package/examples/cloud-run-service-gen2.test.ts +1 -0
  116. package/examples/cloud-run-service-increase-timout.test.ts +1 -0
  117. package/examples/cloud-run-service-with-volumes.test.ts +1 -0
  118. package/examples/cloud-run-session-affinity.test.ts +12 -0
  119. package/examples/cloud-run-session-affinity.ts +29 -0
  120. package/examples/cloud-run-storybook.test.ts +1 -0
  121. package/examples/cloud-run-with-agents.test.ts +1 -0
  122. package/examples/cloud-run-with-gpu.test.ts +1 -0
  123. package/examples/cloud-run-with-ngnix.test.ts +1 -0
  124. package/examples/cloud-run-with-sql-legacy-jobs.test.ts +1 -0
  125. package/examples/cloud-run-with-sql-multiple-dbs.test.ts +1 -0
  126. package/examples/cloud-run-with-sql-reuse-db.test.ts +1 -0
  127. package/examples/cloud-run-with-sql.test.ts +1 -0
  128. package/examples/cloud-run-with-worker.test.ts +1 -0
  129. package/examples/custom-build-job-with-tests.test.ts +1 -0
  130. package/examples/custom-build-job.test.ts +1 -0
  131. package/examples/custom-deploy.test.ts +1 -0
  132. package/examples/{custom-sbom-java.test.ts → custom-docker-file.test.ts} +3 -2
  133. package/examples/custom-docker-file.ts +36 -0
  134. package/examples/custom-envs.test.ts +1 -0
  135. package/examples/custom-verify-job.test.ts +1 -0
  136. package/examples/git-submodule.test.ts +1 -0
  137. package/examples/kubernetes-application-customization.test.ts +1 -0
  138. package/examples/kubernetes-with-cloud-sql.test.ts +1 -0
  139. package/examples/kubernetes-with-jobs.test.ts +1 -0
  140. package/examples/kubernetes-with-mongodb.test.ts +1 -0
  141. package/examples/local-dot-env.test.ts +1 -0
  142. package/examples/meteor-kubernetes.test.ts +1 -0
  143. package/examples/modify-generated-files.test.ts +1 -0
  144. package/examples/modify-generated-yaml.test.ts +1 -0
  145. package/examples/multiline-var.test.ts +1 -0
  146. package/examples/native-app.test.ts +1 -0
  147. package/examples/node-build-with-custom-image.test.ts +1 -0
  148. package/examples/node-build-with-docker-additions.test.ts +1 -0
  149. package/examples/override-secrets.test.ts +1 -0
  150. package/examples/rails-k8s-with-worker.test.ts +1 -0
  151. package/examples/referencing-other-vars.test.ts +1 -0
  152. package/examples/wait-for-other-deploy.test.ts +1 -0
  153. package/examples/workspace-api-www-turbo-cache.test.ts +1 -0
  154. package/examples/workspace-api-www.test.ts +1 -0
  155. package/examples/workspace-api-www.ts +3 -0
  156. package/package.json +2 -4
  157. package/scripts/generate-examples-test.ts +1 -0
  158. package/src/build/artifacts/createBuildJobArtifact.ts +7 -2
  159. package/src/build/base/__tests__/__snapshots__/createArtifactsConfig.test.ts.snap +4 -4
  160. package/src/build/base/__tests__/createArtifactsConfig.test.ts +1 -0
  161. package/src/build/base/index.ts +0 -4
  162. package/src/build/custom/__tests__/testJob.test.ts +1 -0
  163. package/src/build/custom/testJob.ts +12 -1
  164. package/src/build/docker.ts +26 -6
  165. package/src/build/node/cache.ts +16 -1
  166. package/src/build/node/testJob.ts +12 -2
  167. package/src/build/node/yarn.ts +25 -5
  168. package/src/build/rails/index.ts +1 -1
  169. package/src/build/types.ts +27 -14
  170. package/src/config/__tests__/__snapshots__/getAllEnvs.test.ts.snap +4 -4
  171. package/src/config/__tests__/__snapshots__/getAllEnvsInAllComponents.test.ts.snap +2 -2
  172. package/src/config/__tests__/configruedEnvs.test.ts +1 -0
  173. package/src/config/__tests__/getAllEnvs.test.ts +1 -0
  174. package/src/config/__tests__/getAllEnvsInAllComponents.test.ts +1 -0
  175. package/src/config/readConfig.ts +22 -1
  176. package/src/context/getEnvironmentVariables.ts +15 -14
  177. package/src/defaults/index.ts +0 -1
  178. package/src/deploy/base/deploy.ts +37 -37
  179. package/src/deploy/base/stop.ts +0 -6
  180. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +1 -0
  181. package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +45 -47
  182. package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +0 -2
  183. package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +0 -2
  184. package/src/deploy/custom/deployJob.ts +2 -9
  185. package/src/deploy/kubernetes/deployJob.ts +3 -10
  186. package/src/deploy/kubernetes/mongodb.ts +4 -0
  187. package/src/deploy/types/base.ts +1 -0
  188. package/src/deploy/types/executeBase.ts +27 -0
  189. package/src/deploy/types/googleCloudRun.ts +17 -3
  190. package/src/index.ts +1 -0
  191. package/src/pipeline/__tests__/__snapshots__/getPipelineStages.test.ts.snap +2 -2
  192. package/src/pipeline/__tests__/getPipelineStages.test.ts +1 -0
  193. package/src/pipeline/gitlab/gitlabReleaseJobs.ts +5 -3
  194. package/src/types/config.ts +5 -1
  195. package/src/utils/measureTime.ts +43 -0
  196. package/src/variables/__tests__/resolveAllReferences.test.ts +1 -0
  197. package/src/variables/__tests__/resolveAllReferencesOnce.test.ts +1 -0
  198. package/src/variables/__tests__/resolveReferencesOnce.test.ts +1 -0
  199. package/src/variables/__tests__/variableValue.test.ts +1 -0
  200. package/tsconfig.json +2 -1
  201. package/dist/build/base/__tests__/createArtifactsConfig.test.d.ts +0 -1
  202. package/dist/build/base/__tests__/createArtifactsConfig.test.js +0 -42
  203. package/dist/build/custom/__tests__/testJob.test.d.ts +0 -1
  204. package/dist/build/custom/__tests__/testJob.test.js +0 -36
  205. package/dist/build/sbom.d.ts +0 -5
  206. package/dist/build/sbom.js +0 -35
  207. package/dist/config/__tests__/configruedEnvs.test.d.ts +0 -1
  208. package/dist/config/__tests__/configruedEnvs.test.js +0 -112
  209. package/dist/config/__tests__/getAllEnvs.test.d.ts +0 -1
  210. package/dist/config/__tests__/getAllEnvs.test.js +0 -79
  211. package/dist/config/__tests__/getAllEnvsInAllComponents.test.d.ts +0 -1
  212. package/dist/config/__tests__/getAllEnvsInAllComponents.test.js +0 -73
  213. package/dist/deploy/sbom.d.ts +0 -4
  214. package/dist/deploy/sbom.js +0 -21
  215. package/dist/pipeline/__tests__/getPipelineStages.test.d.ts +0 -1
  216. package/dist/pipeline/__tests__/getPipelineStages.test.js +0 -73
  217. package/dist/variables/__tests__/resolveAllReferences.test.d.ts +0 -1
  218. package/dist/variables/__tests__/resolveAllReferences.test.js +0 -218
  219. package/dist/variables/__tests__/resolveAllReferencesOnce.test.d.ts +0 -1
  220. package/dist/variables/__tests__/resolveAllReferencesOnce.test.js +0 -171
  221. package/dist/variables/__tests__/resolveReferencesOnce.test.d.ts +0 -1
  222. package/dist/variables/__tests__/resolveReferencesOnce.test.js +0 -199
  223. package/dist/variables/__tests__/variableValue.test.d.ts +0 -1
  224. package/dist/variables/__tests__/variableValue.test.js +0 -36
  225. package/examples/custom-sbom-java.ts +0 -38
  226. package/src/build/sbom.ts +0 -53
  227. package/src/deploy/sbom.ts +0 -34
  228. /package/dist/build/rails/{test.d.ts → testJob.d.ts} +0 -0
  229. /package/dist/build/rails/{test.js → testJob.js} +0 -0
  230. /package/src/build/rails/{test.ts → testJob.ts} +0 -0
@@ -49,6 +49,11 @@ var path_1 = require("path");
49
49
  var types_1 = require("../../types");
50
50
  var lodash_1 = require("lodash");
51
51
  var writeDotEnv_1 = require("../base/writeDotEnv");
52
+ var uniqueAndAlphabeticalSort = function (arr) {
53
+ return (0, lodash_1.uniq)(arr).sort(function (a, b) {
54
+ return a.localeCompare(b);
55
+ });
56
+ };
52
57
  var createBuildJobArtifacts = function (context) {
53
58
  var _a, _b;
54
59
  var paths = context.type === "workspace" ? context.components.flatMap(function (c) {
@@ -58,11 +63,9 @@ var createBuildJobArtifacts = function (context) {
58
63
  return getAllArtifactExcludePathsForComponent(c);
59
64
  }) : getAllArtifactExcludePathsForComponent(context);
60
65
  return __assign(__assign({
61
- paths: (0, lodash_1.uniq)(paths).sort(function (a, b) {
62
- return a.localeCompare(b);
63
- })
66
+ paths: uniqueAndAlphabeticalSort(paths)
64
67
  }, exclude.length > 0 ? {
65
- exclude: exclude
68
+ exclude: uniqueAndAlphabeticalSort(exclude)
66
69
  } : {}), {
67
70
  expire_in: "1 day",
68
71
  when: "always",
@@ -45,21 +45,19 @@ Object.defineProperty(exports, "__esModule", {
45
45
  value: true
46
46
  });
47
47
  exports.createWorkspaceBuildJobs = exports.createComponentBuildJobs = void 0;
48
- var sbom_1 = require("../../deploy/sbom");
49
48
  var context_1 = require("../../types/context");
50
49
  var docker_1 = require("../docker");
51
- var sbom_2 = require("../sbom");
52
50
  var constants_1 = require("./constants");
53
51
  var createAppBuildJob_1 = require("./createAppBuildJob");
54
52
  var createComponentBuildJobs = function (context, definitions) {
55
53
  var _a;
56
- return __spreadArray(__spreadArray(__spreadArray([], __read(definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context) ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)] : []), false), __read((0, docker_1.requiresDockerBuild)(context) ? [(0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), {
54
+ return __spreadArray(__spreadArray([], __read(definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context) ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)] : []), false), __read((0, docker_1.requiresDockerBuild)(context) ? [(0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), {
57
55
  needs: __spreadArray(__spreadArray([], __read((_a = definitions.dockerBuild.needs) !== null && _a !== void 0 ? _a : []), false), __read(definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context) ? [constants_1.APP_BUILD_JOB_NAME] : (0, context_1.componentContextHasWorkspaceBuild)(context) ? [{
58
56
  job: constants_1.APP_BUILD_JOB_NAME,
59
57
  artifacts: true,
60
58
  workspaceName: context.build.workspaceName
61
59
  }] : []), false)
62
- }))] : []), false), __read((0, sbom_1.sbomDeactivated)(context) ? [] : [(0, sbom_2.createSbomBuildJob)(context)]), false);
60
+ }))] : []), false);
63
61
  };
64
62
  exports.createComponentBuildJobs = createComponentBuildJobs;
65
63
  var createWorkspaceBuildJobs = function (context, definitions) {
@@ -55,7 +55,7 @@ var RUNNER_CUSTOM_TEST_VARIABLES = {
55
55
  KUBERNETES_MEMORY_LIMIT: "4Gi"
56
56
  };
57
57
  var createCustomTestJobs = function (context) {
58
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
59
59
  // don't run tests after release
60
60
  // TODO: this will be replaced by using rules
61
61
  if (context.trigger === "taggedRelease") {
@@ -69,7 +69,6 @@ var createCustomTestJobs = function (context) {
69
69
  variables: __assign({
70
70
  APP_PATH: context.build.dir
71
71
  }, context.environment.jobOnlyVars.build.envVars),
72
- runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
73
72
  services: buildConfig.jobServices,
74
73
  cache: (0, createJobCache_1.createJobCacheFromConfig)(context, buildConfig),
75
74
  stage: "test",
@@ -78,23 +77,26 @@ var createCustomTestJobs = function (context) {
78
77
  var auditJob = buildConfig.audit ? __assign(__assign(__assign({
79
78
  name: "🛡 audit"
80
79
  }, base), {
81
- image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage,
80
+ runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.runnerVariables) !== null && _b !== void 0 ? _b : {}),
81
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : buildConfig.jobImage,
82
82
  cache: undefined,
83
- script: __spreadArray([], __read((0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)), false),
83
+ script: __spreadArray([], __read((0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)), false),
84
84
  allow_failure: true
85
- }), (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)) : null;
85
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
86
86
  var lintJob = buildConfig.lint ? __assign(__assign(__assign({
87
87
  name: "👮 lint"
88
88
  }, base), {
89
- image: (_g = (_f = buildConfig.lint) === null || _f === void 0 ? void 0 : _f.jobImage) !== null && _g !== void 0 ? _g : buildConfig.jobImage,
90
- script: __spreadArray([], __read((0, utils_1.ensureArray)((_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.command)), false)
91
- }), (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)) : null;
89
+ runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.runnerVariables) !== null && _j !== void 0 ? _j : {}),
90
+ image: (_l = (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.jobImage) !== null && _l !== void 0 ? _l : buildConfig.jobImage,
91
+ script: __spreadArray([], __read((0, utils_1.ensureArray)((_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.command)), false)
92
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
92
93
  var testJob = buildConfig.test ? __assign(__assign(__assign({
93
94
  name: "🧪 test"
94
95
  }, base), {
95
- image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage,
96
- script: __spreadArray([], __read((0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)), false)
97
- }), (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)) : null;
96
+ runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.runnerVariables) !== null && _r !== void 0 ? _r : {}),
97
+ image: (_t = (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.jobImage) !== null && _t !== void 0 ? _t : buildConfig.jobImage,
98
+ script: __spreadArray([], __read((0, utils_1.ensureArray)((_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.command)), false)
99
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifactsReports, (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.artifacts)) : null;
98
100
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
99
101
  };
100
102
  exports.createCustomTestJobs = createCustomTestJobs;
@@ -64,6 +64,6 @@ export declare const createDockerBuildJobBase: (context: ComponentContextWithBui
64
64
  ...def
65
65
  }: DockerBuildJobDefinition) => CatladderJob;
66
66
  export declare const gitlabDockerLogin: (context: ComponentContext) => string[];
67
- export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContextWithBuild, defaultType?: BuildConfigDocker["type"]) => (string | undefined)[];
67
+ export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContextWithBuild, fallbackType?: BuildConfigDocker["type"]) => (string | undefined)[];
68
68
  export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string | null) => (string | undefined)[];
69
69
  export declare const hasDockerfile: (context: ComponentContext) => boolean;
@@ -168,10 +168,22 @@ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
168
168
  nginx: "ensureNginxDockerfile",
169
169
  custom: null
170
170
  };
171
- var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
172
- var _a;
173
- var type = "docker" in context.build.config && context.build.config.docker && "type" in context.build.config.docker ? (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.type : defaultType;
174
- return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
171
+ var getEnsureDockerFileScript = function (context, fallbackType) {
172
+ var _a, _b, _c, _d, _e, _f;
173
+ if ("docker" in context.build.config && context.build.config.docker && "type" in context.build.config.docker) {
174
+ if (((_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.type) === "custom") {
175
+ if ((_b = context.build.config.docker) === null || _b === void 0 ? void 0 : _b.dockerfileContent) {
176
+ // we need to create a script that creates a Dockerfile in the current directory
177
+ return "\necho \"Creating Dockerfile\"\ncat >$APP_DIR/Dockerfile <<EOF\n".concat((_d = (_c = context.build.config.docker) === null || _c === void 0 ? void 0 : _c.dockerfileContent) === null || _d === void 0 ? void 0 : _d.join("\n"), "\nEOF");
178
+ }
179
+ }
180
+ var type = (_f = (_e = context.build.config.docker) === null || _e === void 0 ? void 0 : _e.type) !== null && _f !== void 0 ? _f : fallbackType;
181
+ return type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null;
182
+ }
183
+ return fallbackType ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[fallbackType] : null;
184
+ };
185
+ var getDockerBuildScriptWithBuiltInDockerFile = function (context, fallbackType) {
186
+ return (0, exports.getDockerBuildDefaultScript)(context, getEnsureDockerFileScript(context, fallbackType));
175
187
  };
176
188
  exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
177
189
  var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
@@ -58,11 +58,12 @@ var getYarnCache = function (context, policy) {
58
58
  };
59
59
  exports.getYarnCache = getYarnCache;
60
60
  var getNodeModulesCache = function (context, policy) {
61
- var _a;
61
+ var _a, _b;
62
62
  if (policy === void 0) {
63
63
  policy = "pull-push";
64
64
  }
65
65
  var componentIsInWorkspace = context.type === "component" && context.packageManagerInfo.componentIsInWorkspace;
66
+ var isClassic = context.packageManagerInfo.isClassic;
66
67
  // 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.
67
68
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
68
69
  return [{
@@ -72,9 +73,11 @@ var getNodeModulesCache = function (context, policy) {
72
73
  key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
73
74
  // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
74
75
  policy: policy,
75
- paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_a = context.packageManagerInfo.workspaces.map(function (w) {
76
+ paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(__spreadArray(["node_modules"], __read((_a = context.packageManagerInfo.workspaces.map(function (w) {
76
77
  return (0, path_1.join)(w.location, "node_modules");
77
- })) !== null && _a !== void 0 ? _a : []), false)) : [(0, path_1.join)(context.build.dir, "node_modules")]), false)
78
+ })) !== null && _a !== void 0 ? _a : []), false), __read(!isClassic ? __spreadArray([".yarn/install-state.gz"], __read((_b = context.packageManagerInfo.workspaces.map(function (w) {
79
+ return (0, path_1.join)(w.location, ".yarn/install-state.gz");
80
+ })) !== null && _b !== void 0 ? _b : []), false) : []), false)) : __spreadArray([(0, path_1.join)(context.build.dir, "node_modules")], __read(!isClassic ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")] : []), false)), false)
78
81
  }];
79
82
  };
80
83
  exports.getNodeModulesCache = getNodeModulesCache;
@@ -54,7 +54,7 @@ var constants_1 = require("./constants");
54
54
  var yarn_1 = require("./yarn");
55
55
  var createJobCache_1 = require("../cache/createJobCache");
56
56
  var createNodeTestJobs = function (context) {
57
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
58
58
  // don't run tests after release
59
59
  // TODO: this will be replaced by using rules
60
60
  if (context.trigger === "taggedRelease") {
@@ -69,7 +69,6 @@ var createNodeTestJobs = function (context) {
69
69
  variables: __assign({
70
70
  APP_PATH: context.build.dir
71
71
  }, context.type === "component" ? __assign({}, context.environment.jobOnlyVars.build.envVars) : {}),
72
- runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
73
72
  stage: "test",
74
73
  needs: []
75
74
  };
@@ -78,26 +77,29 @@ var createNodeTestJobs = function (context) {
78
77
  var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
79
78
  name: "🛡 audit"
80
79
  }, base), {
81
- image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage,
80
+ runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.runnerVariables) !== null && _b !== void 0 ? _b : {}),
81
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
82
82
  cache: undefined,
83
- script: __spreadArray(["cd ".concat(context.build.dir)], __read((_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
83
+ script: __spreadArray(["cd ".concat(context.build.dir)], __read((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
84
84
  ]), false),
85
85
  allow_failure: true
86
- }), (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)) : null;
86
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
87
87
  var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
88
88
  name: "👮 lint"
89
89
  }, base), {
90
- image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
90
+ runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.runnerVariables) !== null && _k !== void 0 ? _k : {}),
91
+ image: (_m = (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : defaultImage,
91
92
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
92
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["yarn lint"]), false)
93
- }), (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)) : null;
93
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_p = (0, utils_1.ensureArrayOrNull)((_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.command)) !== null && _p !== void 0 ? _p : ["yarn lint"]), false)
94
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.artifactsReports, (_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.artifacts)) : null;
94
95
  var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
95
96
  name: "🧪 test"
96
97
  }, base), {
97
- 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"),
98
+ runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_t = (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.runnerVariables) !== null && _t !== void 0 ? _t : {}),
99
+ image: (_v = (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.jobImage) !== null && _v !== void 0 ? _v : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
98
100
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
99
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn test"]), false)
100
- }), (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)) : null;
101
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_x = (0, utils_1.ensureArrayOrNull)((_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.command)) !== null && _x !== void 0 ? _x : ["yarn test"]), false)
102
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.artifactsReports, (_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.artifacts)) : null;
101
103
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
102
104
  };
103
105
  exports.createNodeTestJobs = createNodeTestJobs;
@@ -1,7 +1,8 @@
1
1
  import { BashExpression } from "../../bash/BashExpression";
2
+ import type { ComponentContextWithBuild } from "../../types";
2
3
  import { type Context } from "../../types";
3
4
  export declare const ensureNodeVersion: (context: Context) => string[];
4
5
  export declare const getYarnInstall: (context: Context, options?: {
5
6
  noCustomPostInstall: boolean;
6
7
  }) => string[];
7
- export declare const getDockerAppCopyAndBuildScript: (context: Context) => BashExpression;
8
+ export declare const getDockerAppCopyAndBuildScript: (context: ComponentContextWithBuild) => BashExpression;
@@ -39,13 +39,15 @@ var BashExpression_1 = require("../../bash/BashExpression");
39
39
  var utils_1 = require("../../utils");
40
40
  var gitlab_1 = require("../../utils/gitlab");
41
41
  var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
42
+ var YARN_BERRY_PROD_INSTALL = "yarn workspaces focus --production";
42
43
  // FIXME: check why and when rebuild is needed
43
- var YARN_BERRY_PROD_REBUILD = "yarn workspaces focus --production && yarn rebuild";
44
+ var YARN_BERRY_PROD_REBUILD = "yarn rebuild";
44
45
  var getYarnInstallCommand = function (context) {
45
46
  if (context.packageManagerInfo.isClassic) {
46
47
  return YARN_INSTALL_CLASSIC;
47
48
  }
48
- return "yarn install --immutable";
49
+ // inline builds make debugging easier as it prints it out in the logs, instead of writing it in temp files
50
+ return "yarn install --immutable --inline-builds";
49
51
  };
50
52
  var ensureNodeVersion = function (context) {
51
53
  return (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")(["if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi", "if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi"]);
@@ -58,9 +60,12 @@ var getYarnInstall = function (context, options) {
58
60
  exports.getYarnInstall = getYarnInstall;
59
61
  var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
60
62
  var getDockerAppCopyAndBuildScript = function (context) {
63
+ var _a, _b, _c;
61
64
  if (context.packageManagerInfo.isClassic) {
62
65
  return new BashExpression_1.BashExpression("\nRUN ".concat(YARN_INSTALL_CLASSIC, " --production --ignore-scripts\n").concat(DOCKER_COPY_FILES, "\nRUN ").concat(YARN_INSTALL_CLASSIC, " --production \n ").trim());
63
66
  }
67
+ var yarnRebuildEnabledDefault = context.build.type === "fromWorkspace" ? (_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true : true;
68
+ var yarnRebuildEnabled = "docker" in context.build.config && context.build.config.docker && "yarnRebuildEnabled" in context.build.config.docker ? (_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault : yarnRebuildEnabledDefault;
64
69
  // yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
65
70
  // trying to import those fail on this version
66
71
  var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
@@ -69,6 +74,6 @@ var getDockerAppCopyAndBuildScript = function (context) {
69
74
  var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
70
75
  // copy first everything and then install
71
76
  // rebuild first does not work as it will run postinstall and that might require files in the app
72
- return new BashExpression_1.BashExpression("\n".concat(DOCKER_COPY_FILES, "\n").concat(maybeAddWorkspaceToolsCommand, "\nRUN ").concat(YARN_BERRY_PROD_REBUILD, "\n\n ").trim());
77
+ return new BashExpression_1.BashExpression("\n ENV YARN_ENABLE_INLINE_BUILDS=1\n".concat(DOCKER_COPY_FILES, "\n").concat(maybeAddWorkspaceToolsCommand, "\nRUN ").concat(YARN_BERRY_PROD_INSTALL, "\n").concat(yarnRebuildEnabled ? "RUN ".concat(YARN_BERRY_PROD_REBUILD) : "", "\n\n ").trim());
73
78
  };
74
79
  exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", {
36
36
  });
37
37
  exports.createRailsJobs = void 0;
38
38
  var build_1 = require("./build");
39
- var test_1 = require("./test");
39
+ var testJob_1 = require("./testJob");
40
40
  var createRailsJobs = function (context) {
41
- return __spreadArray(__spreadArray([], __read((0, test_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
41
+ return __spreadArray(__spreadArray([], __read((0, testJob_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
42
42
  };
43
43
  exports.createRailsJobs = createRailsJobs;
@@ -62,6 +62,10 @@ export type TestJobCustom = {
62
62
  * {@link TestJobCustom.artifacts}.reports.junit is merged with {@link TestJobCustom.artifactsReports} in case both given.
63
63
  */
64
64
  artifacts?: Artifacts;
65
+ /**
66
+ * additional vars for this job runner
67
+ */
68
+ runnerVariables?: Record<string, string>;
65
69
  };
66
70
  export type BuildConfigBase = {
67
71
  /**
@@ -168,6 +172,12 @@ type BuildConfigDockerWithAdditions = {
168
172
  };
169
173
  type BuildConfigDockerBuiltInNode = {
170
174
  type: "node";
175
+ /**
176
+ * whether to run yarn rebuild after yarn install. Defaults to true.
177
+ *
178
+ * Future versions of catladder will default to false.
179
+ */
180
+ yarnRebuildEnabled?: boolean;
171
181
  } & BuildConfigDockerWithAdditions;
172
182
  type BuildConfigDockerBuiltInMeteor = {
173
183
  type: "meteor";
@@ -190,6 +200,15 @@ type BuildConfigDockerCustom = {
190
200
  * Depending on your Dockerfile you may want to change it to "component"
191
201
  */
192
202
  buildContextLocation?: "root" | "component";
203
+ /**
204
+ * EXPERIMENTAL: custom docker file content
205
+ *
206
+ * you can use some predefined variables:
207
+ * - $DOCKER_COPY_WORKSPACE_FILES
208
+ * - $DOCKER_COPY_AND_INSTALL_APP
209
+ * - and all default variables
210
+ */
211
+ dockerfileContent?: string[];
193
212
  };
194
213
  export type BuildConfigDocker = BuildConfigDockerBuiltIn | BuildConfigDockerCustom;
195
214
  export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit"> & {
@@ -212,16 +231,6 @@ export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit">
212
231
  * custom audit, disabled when not set
213
232
  */
214
233
  audit?: TestJobCustom;
215
- /**
216
- * custom sbom (software bill of materials), set false to disable
217
- */
218
- sbom?: false | {
219
- /**
220
- * needs to create a file at `/__sbom.json` in CycloneDX format
221
- */
222
- command: string | string[];
223
- jobImage: GitlabJobImage;
224
- };
225
234
  };
226
235
  export type BuildConfigRails = BuildConfigBase & {
227
236
  type: "rails";
@@ -323,7 +332,7 @@ export type WorkspaceBuildConfigBase = {
323
332
  */
324
333
  audit?: false | TestJobCustom;
325
334
  /**
326
- * additional vars only for the runner.
335
+ * additional vars only for the build job.
327
336
  * Also if you use services: that require env vars, you need to set them here.
328
337
  *
329
338
  */
@@ -342,6 +351,11 @@ export type WorkspaceBuildConfigBase = {
342
351
  export type WorkspaceBuildConfigNode = {
343
352
  type: "node";
344
353
  buildCommand?: string | string[];
354
+ /**
355
+ * set docker config defaults for the node build type.
356
+ * Currently not all options are supported.
357
+ */
358
+ dockerDefaults?: Pick<BuildConfigDockerBuiltInNode, "yarnRebuildEnabled">;
345
359
  } & WorkspaceBuildConfigBase;
346
360
  export type WorkspaceBuildConfig = WorkspaceBuildConfigNode;
347
361
  export {};
@@ -151,13 +151,14 @@ Object.defineProperty(exports, "__esModule", {
151
151
  });
152
152
  exports.readConfig = void 0;
153
153
  var fs_1 = require("fs");
154
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
154
155
  var tsx = require("tsx/cjs/api");
155
156
  var yaml_1 = require("yaml");
156
157
  // allows us to load ts files
157
158
  var fullPath = function (directory, ext) {
158
159
  return directory + "/catladder." + ext;
159
160
  };
160
- var readConfig = function () {
161
+ var readConfigInternal = function () {
161
162
  var args_1 = [];
162
163
  for (var _i = 0; _i < arguments.length; _i++) {
163
164
  args_1[_i] = arguments[_i];
@@ -199,4 +200,32 @@ var readConfig = function () {
199
200
  });
200
201
  });
201
202
  };
203
+ var readConfig = function () {
204
+ var args_1 = [];
205
+ for (var _i = 0; _i < arguments.length; _i++) {
206
+ args_1[_i] = arguments[_i];
207
+ }
208
+ return __awaiter(void 0, __spreadArray([], __read(args_1), false), void 0, function (directory) {
209
+ var error_1;
210
+ if (directory === void 0) {
211
+ directory = process.cwd();
212
+ }
213
+ return __generator(this, function (_a) {
214
+ switch (_a.label) {
215
+ case 0:
216
+ _a.trys.push([0, 2,, 3]);
217
+ return [4 /*yield*/, readConfigInternal(directory)];
218
+ case 1:
219
+ return [2 /*return*/, _a.sent()];
220
+ case 2:
221
+ error_1 = _a.sent();
222
+ console.error("Error reading config in ".concat(directory, ":"), error_1);
223
+ console.error("\nThis may happen due to various reasons:\n - Syntax errors in your catladder.ts file\n - tsx (the TypeScript loader used by catladder) needs to understand the syntax in your project.\n If your project uses newer TypeScript/JavaScript syntax, you may need to update catladder\n to get a newer version of tsx that supports it.\n - Missing or incorrect dependencies in your project\n - TypeScript configuration issues in your tsconfig.json\n");
224
+ return [2 /*return*/, null];
225
+ case 3:
226
+ return [2 /*return*/];
227
+ }
228
+ });
229
+ });
230
+ };
202
231
  exports.readConfig = readConfig;
package/dist/constants.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
7
- exports.PIPELINE_IMAGE_TAG = "remove-env-mode-none-9b62fbb1" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "remove-sbom-91cda0a4" || "latest";
8
8
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
@@ -13,10 +13,10 @@ declare const getBasePredefinedVariables: (ctx: EnvironmentContext) => {
13
13
  };
14
14
  type BasePredefinedVariables = ReturnType<typeof getBasePredefinedVariables>;
15
15
  export type PredefinedVariables = BasePredefinedVariables & {
16
- HOSTNAME: StringOrBashExpression;
17
- ROOT_URL: StringOrBashExpression;
18
- HOSTNAME_INTERNAL: StringOrBashExpression;
19
- ROOT_URL_INTERNAL: StringOrBashExpression;
16
+ HOSTNAME?: StringOrBashExpression;
17
+ ROOT_URL?: StringOrBashExpression;
18
+ HOSTNAME_INTERNAL?: StringOrBashExpression;
19
+ ROOT_URL_INTERNAL?: StringOrBashExpression;
20
20
  };
21
21
  export declare const getEnvironmentVariables: (ctx: CreateComponentContextContext, options?: {
22
22
  shouldResolveReferences?: boolean;
@@ -197,17 +197,22 @@ var getEnvironmentVariables = function (ctx_1) {
197
197
  basePredefinedVariables = getBasePredefinedVariables(environmentContext);
198
198
  if (envType === "local") {
199
199
  devLocalConfig = envConfigRaw;
200
- port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
201
- host = "localhost:" + port.toString();
202
- url = "http://" + host;
203
- predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
204
- ENV_SHORT: "local",
205
- ROOT_URL: url,
206
- HOSTNAME: host,
207
- HOSTNAME_INTERNAL: host,
208
- ROOT_URL_INTERNAL: "http://" + host,
200
+ port = devLocalConfig.port !== false ? (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000 : null;
201
+ host = port ? "localhost:" + port.toString() : null;
202
+ url = host ? "http://" + host : null;
203
+ predefinedVariables = __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, basePredefinedVariables), {
204
+ ENV_SHORT: "local"
205
+ }), url ? {
206
+ ROOT_URL: url
207
+ } : {}), host ? {
208
+ HOSTNAME: host
209
+ } : {}), host ? {
210
+ HOSTNAME_INTERNAL: host
211
+ } : {}), host ? {
212
+ ROOT_URL_INTERNAL: "http://" + host
213
+ } : {}), port ? {
209
214
  PORT: port.toString()
210
- });
215
+ } : {});
211
216
  } else {
212
217
  additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
213
218
  HOSTNAME_INTERNAL = (_e = additionalEnvVars.HOSTNAME_INTERNAL) !== null && _e !== void 0 ? _e : "unknown-host.example.com";
@@ -5,6 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BASE_RETRY = void 0;
7
7
  exports.BASE_RETRY = {
8
- max: 2,
9
- when: ["runner_system_failure", "stuck_or_timeout_failure"]
8
+ max: 2
10
9
  };
@@ -47,9 +47,7 @@ Object.defineProperty(exports, "__esModule", {
47
47
  exports.createDeployJob = exports.DEPLOY_JOB_NAME = void 0;
48
48
  var createJobCache_1 = require("../../build/cache/createJobCache");
49
49
  var docker_1 = require("../../build/docker");
50
- var sbom_1 = require("../../build/sbom");
51
50
  var context_1 = require("../../types/context");
52
- var sbom_2 = require("../sbom");
53
51
  var utils_1 = require("../utils");
54
52
  var stop_1 = require("./stop");
55
53
  var variables_1 = require("./variables");
@@ -76,18 +74,16 @@ var createDeployJob = function (context, jobDefinition) {
76
74
  services: jobDefinition.services,
77
75
  envMode: "stagePerEnv",
78
76
  // makes it easier to run manual tasks er env
79
- needs: __spreadArray(__spreadArray([], __read((0, sbom_2.sbomDeactivated)(context) ? [] : [{
80
- job: sbom_1.SBOM_BUILD_JOB_NAME,
81
- artifacts: true
82
- }]), false), __read(deployConfig ? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) {
77
+ needs: __spreadArray([], __read(deployConfig ? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) {
83
78
  return {
84
79
  componentName: c,
85
80
  job: exports.DEPLOY_JOB_NAME,
86
81
  artifacts: false
87
82
  };
88
83
  })) !== null && _d !== void 0 ? _d : [] : []), false),
89
- // we don't want to deploy when there is a broken test
90
- needsStages: __spreadArray(__spreadArray([], __read((0, context_1.componentContextHasWorkspaceBuild)(context) ? hasDocker // docker build is per component,
84
+ needsStages:
85
+ // if the build is disabled, we don't need to wait for it
86
+ context.build.type !== "disabled" ? __spreadArray(__spreadArray([], __read((0, context_1.componentContextHasWorkspaceBuild)(context) ? hasDocker // docker build is per component,
91
87
  ? [
92
88
  // we don't need artifacts, but have to wait for the component build
93
89
  {
@@ -101,12 +97,14 @@ var createDeployJob = function (context, jobDefinition) {
101
97
  }] : [{
102
98
  stage: "build",
103
99
  artifacts: hasDocker ? false : true // we asume that no-docker deployments need build artifacts,
104
- }]), false), [{
100
+ }]), false), [
101
+ // we don't want to deploy when there is a broken test
102
+ {
105
103
  stage: "test",
106
104
  artifacts: false,
107
105
  // use test from workspace build
108
106
  workspaceName: (0, context_1.componentContextHasWorkspaceBuild)(context) ? context.build.workspaceName : undefined
109
- }], false),
107
+ }], false) : [],
110
108
  when: whenDeploy === "auto" ? "on_success" : "manual",
111
109
  allow_failure: whenDeploy === "manual" ? true : false,
112
110
  stage: "deploy",
@@ -27,11 +27,6 @@ var createStopJob = function (context, jobDefinition) {
27
27
  allow_failure: true,
28
28
  when: "manual",
29
29
  // stop is always manual
30
- rules: [{
31
- if: "$CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/",
32
- // automatic on hotfix branches
33
- when: "on_success"
34
- }],
35
30
  variables: __assign(__assign({}, context.environment.jobOnlyVars.deploy.envVars), jobDefinition.variables),
36
31
  runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), {
37
32
  GIT_STRATEGY: "none"
@@ -84,6 +84,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
84
84
  "use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
85
85
  "allow-unauthenticated": (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _e !== void 0 ? _e : true,
86
86
  ingress: (_f = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _f !== void 0 ? _f : "all",
87
+ "session-affinity": customConfig === null || customConfig === void 0 ? void 0 : customConfig.sessionAffinity,
87
88
  "cpu-boost": true,
88
89
  "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
89
90
  gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,