@catladder/pipeline 1.101.3 → 1.102.0

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 (50) hide show
  1. package/dist/build/base/createBuildJob.js +1 -1
  2. package/dist/build/custom/testJob.js +2 -2
  3. package/dist/build/node/testJob.js +2 -2
  4. package/dist/build/rails/build.js +11 -1
  5. package/dist/build/rails/test.js +1 -1
  6. package/dist/build/types.d.ts +8 -1
  7. package/dist/bundles/catladder-gitlab/index.js +3 -3
  8. package/dist/constants.js +1 -1
  9. package/dist/context/getEnvironment.js +18 -12
  10. package/dist/context/getEnvironmentVariables.d.ts +2 -7
  11. package/dist/context/getEnvironmentVariables.js +27 -31
  12. package/dist/context/transformJobOnlyVars.d.ts +10 -0
  13. package/dist/context/transformJobOnlyVars.js +160 -0
  14. package/dist/context/utils/envVars.d.ts +8 -0
  15. package/dist/context/utils/envVars.js +52 -0
  16. package/dist/deploy/base.js +4 -4
  17. package/dist/deploy/types/base.d.ts +8 -0
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/dist/types/context.d.ts +16 -6
  20. package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +8 -8
  21. package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +8 -8
  22. package/examples/__snapshots__/cloud-run-non-public.ts.snap +8 -8
  23. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +16 -16
  24. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +16 -16
  25. package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +8 -8
  26. package/examples/__snapshots__/custom-build-job.ts.snap +8 -8
  27. package/examples/__snapshots__/custom-deploy.ts.snap +16 -8
  28. package/examples/__snapshots__/custom-sbom-java.ts.snap +8 -8
  29. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +12 -12
  30. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +12 -12
  31. package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +12 -12
  32. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
  33. package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +12 -12
  34. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +12 -12
  35. package/examples/__snapshots__/wait-for-other-deploy.ts.snap +8 -8
  36. package/examples/custom-deploy.ts +3 -0
  37. package/package.json +1 -1
  38. package/src/build/base/createBuildJob.ts +1 -0
  39. package/src/build/custom/testJob.ts +1 -0
  40. package/src/build/node/testJob.ts +1 -0
  41. package/src/build/rails/build.ts +4 -1
  42. package/src/build/rails/test.ts +4 -1
  43. package/src/build/types.ts +9 -1
  44. package/src/context/getEnvironment.ts +9 -7
  45. package/src/context/getEnvironmentVariables.ts +36 -24
  46. package/src/context/transformJobOnlyVars.ts +42 -0
  47. package/src/context/utils/envVars.ts +26 -0
  48. package/src/deploy/base.ts +4 -1
  49. package/src/deploy/types/base.ts +10 -0
  50. package/src/types/context.ts +18 -6
@@ -70,7 +70,7 @@ var createBuildJob = function (context, _a) {
70
70
  image: (0, __1.getRunnerImage)("jobs-default"),
71
71
  needs: [],
72
72
  cache: [],
73
- variables: __assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
73
+ variables: __assign(__assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
74
74
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
75
75
  artifacts: {
76
76
  paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
@@ -63,9 +63,9 @@ var createCustomTestJobs = function (context) {
63
63
  throw new Error("deploy config is not custom");
64
64
  }
65
65
  var base = {
66
- variables: __assign(__assign({
66
+ variables: __assign(__assign(__assign({
67
67
  APP_PATH: context.componentConfig.dir
68
- }, RUNNER_CUSTOM_TEST_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
68
+ }, RUNNER_CUSTOM_TEST_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
69
69
  services: buildConfig.jobServices,
70
70
  cache: buildConfig.jobCache,
71
71
  stage: "test",
@@ -56,9 +56,9 @@ var createNodeTestJobs = function (context) {
56
56
  }
57
57
  var buildConfig = context.componentConfig.build;
58
58
  var base = {
59
- variables: __assign(__assign({
59
+ variables: __assign(__assign(__assign({
60
60
  APP_PATH: context.componentConfig.dir
61
- }, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
61
+ }, constants_1.NODE_RUNNER_BUILD_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
62
62
  stage: "test",
63
63
  needs: [],
64
64
  envMode: "none"
@@ -1,5 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
3
13
  var __read = this && this.__read || function (o, n) {
4
14
  var m = typeof Symbol === "function" && o[Symbol.iterator];
5
15
  if (!m) return o;
@@ -41,7 +51,7 @@ var createRailsBuildJobs = function (context) {
41
51
  return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
42
52
  }).join(" ");
43
53
  return [(0, docker_1.createDockerBuildJobBase)(context, {
44
- variables: context.componentConfig.build.extraVars,
54
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
45
55
  // custom script
46
56
  script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
47
57
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
@@ -52,7 +52,7 @@ var createRailsTestJobs = function (context) {
52
52
  }
53
53
  var buildConfig = context.componentConfig.build;
54
54
  var base = {
55
- variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
55
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
56
56
  stage: "test",
57
57
  needs: [],
58
58
  envMode: "none"
@@ -1,4 +1,4 @@
1
- import type { GitlabJobImage, GitlabJobService } from "../types";
1
+ import type { EnvVars, GitlabJobImage, GitlabJobService } from "../types";
2
2
  import type { CatladderJob } from "../types/jobs";
3
3
  export declare type BuildConfigArtifactsReports = {
4
4
  /**
@@ -14,8 +14,15 @@ export declare type BuildConfigBase = {
14
14
  * command to run on the image to start the app (e.g. yarn start)
15
15
  */
16
16
  startCommand?: string;
17
+ /**
18
+ * vars that only exist in the build jobs.
19
+ * Can curently not reference other variables from other components
20
+ */
21
+ jobVars?: EnvVars;
17
22
  /**
18
23
  * additional env vars for the buid jobs
24
+ *
25
+ * @deprecated use jobVars
19
26
  */
20
27
  extraVars?: Record<string, string>;
21
28
  /**