@catladder/pipeline 1.146.2 → 1.147.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 (84) hide show
  1. package/dist/build/base/createAppBuildJob.js +6 -6
  2. package/dist/build/base/writeBuildInfo.js +1 -1
  3. package/dist/build/base/writeDotEnv.js +1 -1
  4. package/dist/build/custom/__tests__/testJob.test.js +11 -14
  5. package/dist/build/custom/buildJob.js +5 -5
  6. package/dist/build/custom/testJob.js +5 -5
  7. package/dist/build/docker.d.ts +26 -9
  8. package/dist/build/docker.js +41 -20
  9. package/dist/build/node/buildJob.js +8 -8
  10. package/dist/build/node/cache.js +1 -1
  11. package/dist/build/node/meteor.js +6 -6
  12. package/dist/build/node/testJob.js +11 -11
  13. package/dist/build/rails/build.js +3 -3
  14. package/dist/build/rails/test.js +4 -4
  15. package/dist/build/sbom.js +2 -2
  16. package/dist/build/types.d.ts +34 -26
  17. package/dist/bundles/catladder-gitlab/index.js +2 -2
  18. package/dist/constants.js +1 -1
  19. package/dist/context/getLabels.js +1 -1
  20. package/dist/context/index.js +34 -12
  21. package/dist/deploy/base/deploy.js +9 -8
  22. package/dist/deploy/cloudRun/artifactsRegistry.d.ts +1 -5
  23. package/dist/deploy/cloudRun/artifactsRegistry.js +8 -9
  24. package/dist/deploy/cloudRun/cloudRunRevisions.js +4 -5
  25. package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +1 -1
  26. package/dist/deploy/cloudRun/createJobs/common.d.ts +4 -4
  27. package/dist/deploy/cloudRun/createJobs/common.js +2 -1
  28. package/dist/deploy/cloudRun/createJobs/index.js +2 -4
  29. package/dist/deploy/custom/deployJob.js +7 -10
  30. package/dist/deploy/dockerTag/deployJob.js +3 -5
  31. package/dist/deploy/kubernetes/cloudSql/index.js +11 -9
  32. package/dist/deploy/kubernetes/deployJob.js +4 -7
  33. package/dist/deploy/kubernetes/kubeEnv.js +2 -1
  34. package/dist/deploy/kubernetes/kubeValues.js +10 -10
  35. package/dist/deploy/kubernetes/mongodb.js +11 -11
  36. package/dist/deploy/sbom.js +1 -1
  37. package/dist/deploy/types/index.d.ts +1 -1
  38. package/dist/deploy/types/index.js +1 -1
  39. package/dist/deploy/utils.js +2 -1
  40. package/dist/pipeline/createJobsForComponent.js +5 -5
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/types/config.d.ts +1 -1
  43. package/dist/types/context.d.ts +13 -1
  44. package/examples/__snapshots__/cloud-run-storybook.ts.snap +1687 -0
  45. package/examples/__snapshots__/cloud-run-with-ngnix.ts.snap +1971 -0
  46. package/examples/cloud-run-storybook.ts +24 -0
  47. package/examples/cloud-run-with-ngnix.ts +24 -0
  48. package/package.json +1 -1
  49. package/src/build/base/createAppBuildJob.ts +7 -7
  50. package/src/build/base/writeBuildInfo.ts +1 -1
  51. package/src/build/base/writeDotEnv.ts +1 -1
  52. package/src/build/custom/__tests__/testJob.test.ts +5 -8
  53. package/src/build/custom/buildJob.ts +6 -9
  54. package/src/build/custom/testJob.ts +5 -5
  55. package/src/build/docker.ts +68 -24
  56. package/src/build/node/buildJob.ts +12 -12
  57. package/src/build/node/cache.ts +1 -1
  58. package/src/build/node/meteor.ts +11 -17
  59. package/src/build/node/testJob.ts +14 -14
  60. package/src/build/rails/build.ts +3 -3
  61. package/src/build/rails/test.ts +4 -4
  62. package/src/build/sbom.ts +3 -3
  63. package/src/build/types.ts +53 -38
  64. package/src/context/getLabels.ts +1 -1
  65. package/src/context/index.ts +21 -5
  66. package/src/deploy/base/deploy.ts +8 -14
  67. package/src/deploy/cloudRun/artifactsRegistry.ts +5 -10
  68. package/src/deploy/cloudRun/cloudRunRevisions.ts +3 -5
  69. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +1 -1
  70. package/src/deploy/cloudRun/createJobs/common.ts +5 -5
  71. package/src/deploy/cloudRun/createJobs/index.ts +1 -4
  72. package/src/deploy/custom/deployJob.ts +4 -6
  73. package/src/deploy/dockerTag/deployJob.ts +2 -5
  74. package/src/deploy/kubernetes/cloudSql/index.ts +7 -4
  75. package/src/deploy/kubernetes/deployJob.ts +1 -4
  76. package/src/deploy/kubernetes/kubeEnv.ts +1 -1
  77. package/src/deploy/kubernetes/kubeValues.ts +3 -3
  78. package/src/deploy/kubernetes/mongodb.ts +6 -6
  79. package/src/deploy/sbom.ts +1 -2
  80. package/src/deploy/types/index.ts +2 -2
  81. package/src/deploy/utils.ts +1 -1
  82. package/src/pipeline/createJobsForComponent.ts +6 -10
  83. package/src/types/config.ts +3 -1
  84. package/src/types/context.ts +16 -1
@@ -74,15 +74,15 @@ var createAppBuildJob = function (context, _a) {
74
74
  image: (0, __1.getRunnerImage)("jobs-default"),
75
75
  needs: [],
76
76
  cache: [],
77
- variables: __assign(__assign(__assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
78
- runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.componentConfig.build.runnerVariables) !== null && _c !== void 0 ? _c : {}),
77
+ variables: __assign(__assign(__assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {}),
78
+ runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {}),
79
79
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(context.componentConfig.dotEnv === true // don't build when set to `local`
80
- ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.buildContext)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : []), false),
80
+ ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.build)), false), ["cd ".concat(context.build.dir)], false), __read((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : []), false),
81
81
  artifacts: {
82
- paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
82
+ paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
83
83
  reports: {
84
- junit: (_f = (_e = context.componentConfig.build.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) {
85
- return (0, path_1.join)(context.componentConfig.dir, p);
84
+ junit: (_f = (_e = context.build.config.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) {
85
+ return (0, path_1.join)(context.build.dir, p);
86
86
  })
87
87
  }
88
88
  }
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.writeBuildInfo = void 0;
7
7
  var writeBuildInfo = function (context) {
8
- return ["echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.componentConfig.dir, "/__build_info.json")];
8
+ return ["echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.build.dir, "/__build_info.json")];
9
9
  };
10
10
  exports.writeBuildInfo = writeBuildInfo;
@@ -47,6 +47,6 @@ var writeDotEnv = function (context) {
47
47
  value = _b[1];
48
48
  return "".concat(key, "=").concat(value === null || value === void 0 ? void 0 : value.toString().replaceAll("\n", "\\n"));
49
49
  }).join("\n");
50
- return ["cat <<EOF > ".concat(context.componentConfig.dir, "/.env\n").concat(keyValueString, "\nEOF")];
50
+ return ["cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF")];
51
51
  };
52
52
  exports.writeDotEnv = writeDotEnv;
@@ -5,17 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var testJob_1 = require("../testJob");
7
7
  describe("createCustomTestJobs", function () {
8
- var componentConfig = {
9
- dir: ".",
10
- build: {
11
- type: "custom",
12
- docker: {
13
- type: "custom"
14
- },
15
- jobImage: ""
16
- },
17
- deploy: {}
18
- };
19
8
  var baseContext = {
20
9
  componentName: "testComponent",
21
10
  environment: {
@@ -23,14 +12,22 @@ describe("createCustomTestJobs", function () {
23
12
  build: {}
24
13
  }
25
14
  },
26
- componentConfig: componentConfig
15
+ build: {
16
+ config: {
17
+ type: "custom",
18
+ docker: {
19
+ type: "custom"
20
+ },
21
+ jobImage: ""
22
+ }
23
+ }
27
24
  };
28
25
  it("throws error when not build type custom", function () {
29
- componentConfig.build.type = "node";
26
+ baseContext.build.config.type = "node";
30
27
  expect(function () {
31
28
  return (0, testJob_1.createCustomTestJobs)(baseContext);
32
29
  }).toThrowError("deploy config is not custom");
33
- componentConfig.build.type = "custom";
30
+ baseContext.build.config.type = "custom";
34
31
  });
35
32
  it("returns empty array if no audit, lint, and test definition", function () {
36
33
  var jobs = (0, testJob_1.createCustomTestJobs)(baseContext);
@@ -46,8 +46,8 @@ var RUNNER_BUILD_VARIABLES = {
46
46
  KUBERNETES_MEMORY_LIMIT: "4Gi"
47
47
  };
48
48
  var createCustomBuildJobs = function (context) {
49
- var _a, _b, _c, _d;
50
- var buildConfig = context.componentConfig.build;
49
+ var _a, _b, _c;
50
+ var buildConfig = context.build.config;
51
51
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
52
52
  throw new Error("deploy config is not custom");
53
53
  }
@@ -59,14 +59,14 @@ var createCustomBuildJobs = function (context) {
59
59
  services: buildConfig.jobServices,
60
60
  script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
61
61
  artifacts: {
62
- paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "__build_info.json"), (0, path_1.join)(context.componentConfig.dir, "dist")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
63
- return (0, path_1.join)(context.componentConfig.dir, path);
62
+ paths: __spreadArray([(0, path_1.join)(context.build.dir, "__build_info.json"), (0, path_1.join)(context.build.dir, "dist")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
63
+ return (0, path_1.join)(context.build.dir, path);
64
64
  })) !== null && _c !== void 0 ? _c : []), false),
65
65
  expire_in: "1 day"
66
66
  }
67
67
  } : undefined,
68
68
  dockerBuild: {
69
- script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
69
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
70
70
  variables: {}
71
71
  }
72
72
  });
@@ -60,13 +60,13 @@ var createCustomTestJobs = function (context) {
60
60
  if (context.trigger === "taggedRelease") {
61
61
  return [];
62
62
  }
63
- var buildConfig = context.componentConfig.build;
63
+ var buildConfig = context.build.config;
64
64
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
65
65
  throw new Error("deploy config is not custom");
66
66
  }
67
67
  var base = {
68
68
  variables: __assign(__assign({
69
- APP_PATH: context.componentConfig.dir
69
+ APP_PATH: context.build.dir
70
70
  }, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
71
71
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
72
72
  services: buildConfig.jobServices,
@@ -82,19 +82,19 @@ var createCustomTestJobs = function (context) {
82
82
  cache: undefined,
83
83
  script: __spreadArray([], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : []), false),
84
84
  allow_failure: true
85
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.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
89
  image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage,
90
90
  script: __spreadArray([], __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : []), false)
91
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
91
+ }), (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)) : null;
92
92
  var testJob = buildConfig.test ? __assign(__assign(__assign({
93
93
  name: "🧪 test"
94
94
  }, base), {
95
95
  image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage,
96
96
  script: __spreadArray([], __read((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : []), false)
97
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
97
+ }), (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)) : null;
98
98
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
99
99
  };
100
100
  exports.createCustomTestJobs = createCustomTestJobs;
@@ -1,3 +1,4 @@
1
+ import type { BuildConfigDocker } from ".";
1
2
  import type { ComponentContext } from "../types";
2
3
  import type { CatladderJob } from "../types/jobs";
3
4
  export declare const getDockerImageVariables: (context: ComponentContext) => {
@@ -15,38 +16,54 @@ export declare const getDockerImageVariables: (context: ComponentContext) => {
15
16
  /**
16
17
  * Weather the context requires a docker build
17
18
  */
18
- export declare const requiresDockerBuild: ({
19
- componentConfig: {
20
- deploy
21
- }
22
- }: ComponentContext) => boolean;
19
+ export declare const requiresDockerBuild: (context: ComponentContext) => boolean;
23
20
  export declare const getDockerBuildVariables: (context: ComponentContext) => {
24
21
  DOCKER_IMAGE_TAG: string;
25
22
  DOCKER_REGISTRY: string;
26
23
  DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
27
24
  DOCKER_CACHE_IMAGE: string;
28
- DOCKERFILE_ADDITIONS: string | undefined;
29
- DOCKERFILE_ADDITIONS_END: string | undefined;
30
25
  APP_DIR: string;
31
26
  DOCKER_DIR: string;
27
+ DOCKERFILE_ADDITIONS?: undefined;
28
+ DOCKERFILE_ADDITIONS_END?: undefined;
32
29
  } | {
33
30
  DOCKER_IMAGE_TAG: string;
34
31
  DOCKER_REGISTRY: string;
35
32
  DOCKER_CACHE_IMAGE: string;
36
33
  DOCKER_IMAGE_NAME: string;
37
34
  DOCKER_IMAGE: string;
35
+ APP_DIR: string;
36
+ DOCKER_DIR: string;
37
+ DOCKERFILE_ADDITIONS?: undefined;
38
+ DOCKERFILE_ADDITIONS_END?: undefined;
39
+ } | {
40
+ DOCKER_IMAGE_TAG: string;
41
+ DOCKER_REGISTRY: string;
42
+ DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
43
+ DOCKER_CACHE_IMAGE: string;
44
+ APP_DIR: string;
45
+ DOCKER_DIR: string;
38
46
  DOCKERFILE_ADDITIONS: string | undefined;
39
47
  DOCKERFILE_ADDITIONS_END: string | undefined;
48
+ } | {
49
+ DOCKER_IMAGE_TAG: string;
50
+ DOCKER_REGISTRY: string;
51
+ DOCKER_CACHE_IMAGE: string;
52
+ DOCKER_IMAGE_NAME: string;
53
+ DOCKER_IMAGE: string;
40
54
  APP_DIR: string;
41
55
  DOCKER_DIR: string;
56
+ DOCKERFILE_ADDITIONS: string | undefined;
57
+ DOCKERFILE_ADDITIONS_END: string | undefined;
42
58
  };
43
59
  export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
44
- export declare const getDockerJobBaseProps: (context: ComponentContext) => Pick<CatladderJob, "image" | "services" | "variables" | "runnerVariables">;
60
+ export declare const getDockerJobBaseProps: () => Pick<CatladderJob, "image" | "services" | "variables" | "runnerVariables">;
45
61
  export type DockerBuildJobDefinition = Partial<CatladderJob>;
46
62
  export declare const createDockerBuildJobBase: (context: ComponentContext, {
47
63
  script,
48
64
  ...def
49
65
  }: Partial<CatladderJob>) => CatladderJob;
50
66
  export declare const gitlabDockerLogin: (context: ComponentContext) => string[];
51
- export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string) => (string | undefined)[];
67
+ export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContext, defaultType?: BuildConfigDocker["type"]) => (string | undefined)[];
68
+ export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string | null) => (string | undefined)[];
52
69
  export declare const hasDockerfile: (context: ComponentContext) => boolean;
@@ -57,22 +57,24 @@ var __importDefault = this && this.__importDefault || function (mod) {
57
57
  Object.defineProperty(exports, "__esModule", {
58
58
  value: true
59
59
  });
60
- exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
61
- var lodash_1 = require("lodash");
62
- var deploy_1 = require("../deploy");
63
- var runner_1 = require("../runner");
60
+ exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
64
61
  var fs_1 = require("fs");
62
+ var lodash_1 = require("lodash");
65
63
  var path_1 = __importDefault(require("path"));
66
- var gitlab_1 = require("../utils/gitlab");
64
+ var deploy_1 = require("../deploy");
67
65
  var artifactsRegistry_1 = require("../deploy/cloudRun/artifactsRegistry");
68
66
  var gcloudServiceAccountLoginCommands_1 = require("../deploy/cloudRun/utils/gcloudServiceAccountLoginCommands");
67
+ var runner_1 = require("../runner");
68
+ var gitlab_1 = require("../utils/gitlab");
69
69
  var DOCKER_BUILD_RUNNER_REQUESTS = {
70
70
  KUBERNETES_CPU_REQUEST: "0.5",
71
71
  KUBERNETES_MEMORY_REQUEST: "1Gi",
72
72
  KUBERNETES_MEMORY_LIMIT: "2Gi"
73
73
  };
74
74
  var getDockerImageVariables = function (context) {
75
- return __assign(__assign({}, (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? {
75
+ var _a;
76
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
77
+ return __assign(__assign({}, (0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun") ? {
76
78
  DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
77
79
  DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
78
80
  DOCKER_CACHE_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryBuildCacheImage)(context)
@@ -92,9 +94,10 @@ exports.getDockerImageVariables = getDockerImageVariables;
92
94
  /**
93
95
  * Weather the context requires a docker build
94
96
  */
95
- var requiresDockerBuild = function (_a) {
96
- var deploy = _a.componentConfig.deploy;
97
- return (0, deploy_1.isOfDeployType)(deploy, "kubernetes", "google-cloudrun", "dockerTag") || (0, deploy_1.isOfDeployType)(deploy, "custom") && deploy.requiresDocker;
97
+ var requiresDockerBuild = function (context) {
98
+ var _a;
99
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
100
+ return (0, deploy_1.isOfDeployType)(deployConfig, "kubernetes", "google-cloudrun", "dockerTag") || (0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker;
98
101
  };
99
102
  exports.requiresDockerBuild = requiresDockerBuild;
100
103
  // those need to be runner variables
@@ -107,18 +110,24 @@ var getDockerBuildRunnerVariables = function () {
107
110
  };
108
111
  };
109
112
 
113
+ var getDockerAdditions = function (build) {
114
+ var _a, _b;
115
+ if (!("docker" in build)) return {};
116
+ if (!build.docker) return {};
117
+ return {
118
+ DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker ? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n") : undefined,
119
+ DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker ? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n") : undefined
120
+ };
121
+ };
110
122
  var getDockerBuildVariables = function (context) {
111
- var _a, _b, _c, _d;
112
- return __assign({
113
- DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
114
- DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
115
- APP_DIR: context.componentConfig.dir,
123
+ return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), {
124
+ APP_DIR: context.build.dir,
116
125
  DOCKER_DIR: "."
117
- }, (0, exports.getDockerImageVariables)(context));
126
+ }), (0, exports.getDockerImageVariables)(context));
118
127
  };
119
128
  exports.getDockerBuildVariables = getDockerBuildVariables;
120
129
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
121
- var getDockerJobBaseProps = function (context) {
130
+ var getDockerJobBaseProps = function () {
122
131
  return {
123
132
  image: (0, runner_1.getRunnerImage)("docker-build"),
124
133
  services: [{
@@ -138,7 +147,7 @@ var createDockerBuildJobBase = function (context, _a) {
138
147
  name: exports.DOCKER_BUILD_JOB_NAME,
139
148
  envMode: "jobPerEnv",
140
149
  stage: "build"
141
- }, (0, exports.getDockerJobBaseProps)(context)), {
150
+ }, (0, exports.getDockerJobBaseProps)()), {
142
151
  script: script || []
143
152
  }), {
144
153
  variables: (0, exports.getDockerBuildVariables)(context),
@@ -147,15 +156,27 @@ var createDockerBuildJobBase = function (context, _a) {
147
156
  };
148
157
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
149
158
  var gitlabDockerLogin = function (context) {
150
- return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
159
+ return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
151
160
  };
152
161
  exports.gitlabDockerLogin = gitlabDockerLogin;
162
+ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
163
+ meteor: "ensureMeteorDockerfile",
164
+ node: "ensureNodeDockerfile",
165
+ nginx: "ensureNginxDockerfile",
166
+ custom: null
167
+ };
168
+ var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
169
+ var _a;
170
+ var type = "docker" in context.componentConfig.build && context.componentConfig.build.docker && "type" in context.componentConfig.build.docker ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type : defaultType;
171
+ return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
172
+ };
173
+ exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
153
174
  var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
154
- return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1" //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
175
+ return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1" //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
155
176
  ])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")(["docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"])), false).filter(Boolean);
156
177
  };
157
178
  exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
158
179
  var hasDockerfile = function (context) {
159
- return (0, fs_1.existsSync)(path_1.default.join(context.componentConfig.dir, "Dockerfile"));
180
+ return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
160
181
  };
161
182
  exports.hasDockerfile = hasDockerfile;
@@ -46,20 +46,20 @@ var constants_1 = require("./constants");
46
46
  var yarn_1 = require("./yarn");
47
47
  var createNodeBuildJobs = function (context) {
48
48
  var _a, _b, _c, _d, _e, _f, _g;
49
- var buildConfig = context.componentConfig.build;
49
+ var buildConfig = context.build.config;
50
50
  if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
51
51
  throw new Error("deploy config is not node, node-static or storybook");
52
52
  }
53
53
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
54
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext);
54
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
55
55
  return (0, base_1.createBuildJobs)(context, {
56
56
  appBuild: buildConfig.buildCommand !== null ? {
57
57
  image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
58
58
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
59
- cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context.buildContext)), false), __read((0, cache_1.getNextCache)(context)), false),
59
+ cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context.build)), false), __read((0, cache_1.getNextCache)(context)), false),
60
60
  script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false),
61
61
  artifacts: {
62
- paths: __spreadArray([context.componentConfig.dir], __read((_e = (_d = context.buildContext.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : []), false).flatMap(function (dir) {
62
+ paths: __spreadArray([context.build.dir], __read((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : []), false).flatMap(function (dir) {
63
63
  var _a, _b;
64
64
  return __spreadArray([(0, path_1.join)(dir, "__build_info.json"), (0, path_1.join)(dir, "dist"), (0, path_1.join)(dir, ".next")], __read((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
65
65
  return (0, path_1.join)(dir, path);
@@ -71,12 +71,12 @@ var createNodeBuildJobs = function (context) {
71
71
  jobTags: buildConfig.jobTags
72
72
  } : undefined,
73
73
  dockerBuild: {
74
- script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
75
- cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.buildContext, "pull")), false),
74
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "nginx" : "node"),
75
+ cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
76
76
  variables: {
77
77
  // only required for non static
78
- DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.buildContext),
79
- DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.buildContext.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) {
78
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
79
+ DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) {
80
80
  return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
81
81
  })) === null || _g === void 0 ? void 0 : _g.join("\n")
82
82
  }
@@ -90,7 +90,7 @@ var getNextCache = function (context) {
90
90
  return [{
91
91
  key: context.componentName + "-next-cache",
92
92
  policy: "pull-push",
93
- paths: [context.componentConfig.dir + "/.next/cache/"]
93
+ paths: [context.build.dir + "/.next/cache/"]
94
94
  }];
95
95
  };
96
96
  exports.getNextCache = getNextCache;
@@ -46,18 +46,18 @@ var getMeteorCache = function (context) {
46
46
  return [{
47
47
  key: context.componentName + "meteor-build-cache",
48
48
  policy: "pull-push",
49
- paths: [(0, path_1.join)(context.componentConfig.dir, ".meteor/local/resolver-result-cache.json"), (0, path_1.join)(context.componentConfig.dir, ".meteor/local/plugin-cache"), (0, path_1.join)(context.componentConfig.dir, ".meteor/local/isopacks"), (0, path_1.join)(context.componentConfig.dir, ".meteor/local/bundler-cache/scanner")]
49
+ paths: [(0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"), (0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"), (0, path_1.join)(context.build.dir, ".meteor/local/isopacks"), (0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner")]
50
50
  }];
51
51
  };
52
52
  var createMeteorBuildJobs = function (context) {
53
- var buildConfig = context.componentConfig.build;
53
+ var buildConfig = context.build.config;
54
54
  if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
55
55
  throw new Error("deploy config is not meteor");
56
56
  }
57
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext);
57
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
58
58
  return (0, base_1.createBuildJobs)(context, {
59
59
  appBuild: buildConfig.buildCommand !== null ? {
60
- cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.buildContext)), false), __read(getMeteorCache(context)), false),
60
+ cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
61
61
  image: (0, runner_1.getRunnerImage)("jobs-meteor"),
62
62
  variables: {
63
63
  METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
@@ -65,11 +65,11 @@ var createMeteorBuildJobs = function (context) {
65
65
 
66
66
  script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['echo "add healthcheck package"', "meteor add panter:healthroute --allow-superuser", "meteor add qualia:prod-shell --allow-superuser", 'TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory', "cp ./__build_info.json ./dist/bundle/programs/server"], false),
67
67
  artifacts: {
68
- paths: [context.componentConfig.dir + "/__build_info.json", context.componentConfig.dir + "/dist"]
68
+ paths: [context.build.dir + "/__build_info.json", context.build.dir + "/dist"]
69
69
  }
70
70
  } : undefined,
71
71
  dockerBuild: {
72
- script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
72
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
73
73
  variables: {
74
74
  METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
75
75
  }
@@ -58,41 +58,41 @@ var createNodeTestJobs = function (context) {
58
58
  if (context.trigger === "taggedRelease") {
59
59
  return [];
60
60
  }
61
- var buildConfig = context.componentConfig.build;
61
+ var buildConfig = context.build.config;
62
62
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
63
63
  var base = {
64
64
  variables: __assign(__assign({
65
- APP_PATH: context.componentConfig.dir
65
+ APP_PATH: context.build.dir
66
66
  }, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
67
67
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
68
68
  stage: "test",
69
69
  needs: [],
70
70
  envMode: "none"
71
71
  };
72
- var yarnInstall = (0, yarn_1.getYarnInstall)(context.buildContext);
72
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
73
73
  var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
74
74
  name: "🛡 audit"
75
75
  }, base), {
76
76
  image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
77
77
  cache: undefined,
78
- script: __spreadArray(["cd ".concat(context.componentConfig.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [((_f = context.buildContext.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic) ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
78
+ script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic) ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
79
79
  ]), false),
80
80
  allow_failure: true
81
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
81
+ }), (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;
82
82
  var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
83
83
  name: "👮 lint"
84
84
  }, base), {
85
85
  image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage,
86
- cache: (0, cache_1.getNodeCache)(context.buildContext),
87
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.buildContext)), false), ["cd ".concat(context.componentConfig.dir)], false), __read(yarnInstall), false), __read((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"]), false)
88
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
86
+ cache: (0, cache_1.getNodeCache)(context.build),
87
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"]), false)
88
+ }), (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;
89
89
  var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
90
90
  name: "🧪 test"
91
91
  }, base), {
92
92
  image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
93
- cache: (0, cache_1.getNodeCache)(context.buildContext),
94
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.buildContext)), false), ["cd ".concat(context.componentConfig.dir)], false), __read(yarnInstall), false), __read((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"]), false)
95
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
93
+ cache: (0, cache_1.getNodeCache)(context.build),
94
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"]), false)
95
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
96
96
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
97
97
  };
98
98
  exports.createNodeTestJobs = createNodeTestJobs;
@@ -50,7 +50,7 @@ var docker_1 = require("../docker");
50
50
  var types_1 = require("../types");
51
51
  var createRailsBuildJobs = function (context) {
52
52
  var _a, _b, _c;
53
- var buildConfig = context.componentConfig.build;
53
+ var buildConfig = context.build.config;
54
54
  if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
55
55
  // should not happen
56
56
  throw new Error("build type is not rails");
@@ -74,9 +74,9 @@ var createRailsBuildJobs = function (context) {
74
74
  return (0, base_1.createBuildJobs)(context, {
75
75
  appBuild: undefined,
76
76
  dockerBuild: {
77
- variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
77
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
78
78
  // custom script
79
- script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["cd ".concat(context.componentConfig.dir), "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",
79
+ script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["cd ".concat(context.build.dir), "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",
80
80
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
81
81
  "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
82
82
  }
@@ -53,7 +53,7 @@ var createRailsTestJobs = function (context) {
53
53
  if (context.trigger === "taggedRelease") {
54
54
  return [];
55
55
  }
56
- var buildConfig = context.componentConfig.build;
56
+ var buildConfig = context.build.config;
57
57
  var base = {
58
58
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
59
59
  stage: "test",
@@ -76,7 +76,7 @@ var createRailsTestJobs = function (context) {
76
76
  }, base), {
77
77
  cache: undefined,
78
78
  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,
79
- script: __spreadArray(["cd ".concat(context.componentConfig.dir)], __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["gem install bundler-audit", "bundle audit check"]), false),
79
+ script: __spreadArray(["cd ".concat(context.build.dir)], __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["gem install bundler-audit", "bundle audit check"]), false),
80
80
  allow_failure: true
81
81
  }) : null;
82
82
  var lintJob = buildConfig.lint !== false ? __assign(__assign({
@@ -84,14 +84,14 @@ var createRailsTestJobs = function (context) {
84
84
  }, base), {
85
85
  cache: bundlerCache,
86
86
  image: (_j = (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
87
- script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(bundlerInstall), false), __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["bundle exec rubocop"]), false)
87
+ script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["bundle exec rubocop"]), false)
88
88
  }) : null;
89
89
  var testJob = buildConfig.test !== false ? __assign(__assign({
90
90
  name: "🧪 test"
91
91
  }, base), {
92
92
  cache: bundlerCache,
93
93
  image: (_p = (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
94
- script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(bundlerInstall), false), __read((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["bundle exec rspec"]), false)
94
+ script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["bundle exec rspec"]), false)
95
95
  }) : null;
96
96
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
97
97
  };
@@ -9,9 +9,9 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
9
9
  exports.SBOM_FILE = "__sbom.json";
10
10
  var createSbomBuildJob = function (context) {
11
11
  var _a, _b, _c, _d, _e;
12
- var buildConfig = context.componentConfig.build;
12
+ var buildConfig = context.build.config;
13
13
  var defaultImage = "aquasec/trivy:0.38.3";
14
- var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.buildContext.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace) ? "." : context.buildContext.dir)];
14
+ var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace) ? "." : context.build.dir)];
15
15
  var image = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage : defaultImage;
16
16
  var script = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_e = (0, utils_1.ensureArray)((_d = buildConfig.sbom) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : defaultScript : defaultScript;
17
17
  return {