@catladder/pipeline 3.47.1 โ†’ 4.0.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 (101) hide show
  1. package/dist/build/base/createBuildJobDefinition.js +1 -1
  2. package/dist/build/custom/buildJob.js +1 -1
  3. package/dist/build/index.d.ts +2 -2
  4. package/dist/build/node/buildJob.d.ts +3 -3
  5. package/dist/build/node/buildJob.js +185 -26
  6. package/dist/build/node/cache.d.ts +3 -3
  7. package/dist/build/node/cache.js +199 -36
  8. package/dist/build/node/index.d.ts +3 -3
  9. package/dist/build/node/index.js +151 -3
  10. package/dist/build/node/meteor.d.ts +1 -1
  11. package/dist/build/node/meteor.js +162 -27
  12. package/dist/build/node/testJob.d.ts +1 -1
  13. package/dist/build/node/testJob.js +174 -49
  14. package/dist/build/node/yarn.d.ts +2 -2
  15. package/dist/build/node/yarn.js +168 -21
  16. package/dist/build/types.d.ts +2 -2
  17. package/dist/constants.js +1 -1
  18. package/dist/context/createComponentContext.js +10 -12
  19. package/dist/context/createWorkspaceContext.js +29 -34
  20. package/dist/deploy/custom/deployJob.d.ts +1 -1
  21. package/dist/deploy/custom/deployJob.js +147 -23
  22. package/dist/deploy/index.d.ts +1 -1
  23. package/dist/pipeline/createAllJobs.js +30 -14
  24. package/dist/pipeline/createJobsForComponent.d.ts +1 -1
  25. package/dist/pipeline/createJobsForComponent.js +128 -4
  26. package/dist/pipeline/createJobsForWorkspace.d.ts +1 -1
  27. package/dist/pipeline/createJobsForWorkspace.js +127 -2
  28. package/dist/pipeline/yarn/yarnUtils.js +61 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/dist/types/context.d.ts +3 -3
  31. package/examples/__snapshots__/automatic-releases.test.ts.snap +9 -13
  32. package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +9 -13
  33. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +9 -13
  34. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +9 -13
  35. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +9 -13
  36. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +9 -13
  37. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +9 -13
  38. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +9 -13
  39. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +9 -13
  40. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +9 -13
  41. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +9 -13
  42. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +9 -13
  43. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +9 -13
  44. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +9 -13
  45. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +9 -13
  46. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +9 -13
  47. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +9 -13
  48. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +9 -13
  49. package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +9 -13
  50. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +9 -13
  51. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +9 -13
  52. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +9 -13
  53. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +9 -13
  54. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +18 -30
  55. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +14 -22
  56. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +9 -13
  57. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +9 -13
  58. package/examples/__snapshots__/cloud-run-worker-pool.test.ts.snap +9 -13
  59. package/examples/__snapshots__/custom-deploy.test.ts.snap +9 -13
  60. package/examples/__snapshots__/custom-docker-file.test.ts.snap +9 -13
  61. package/examples/__snapshots__/custom-envs.test.ts.snap +14 -22
  62. package/examples/__snapshots__/custom-verify-job.test.ts.snap +9 -13
  63. package/examples/__snapshots__/git-submodule.test.ts.snap +9 -13
  64. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +9 -13
  65. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +9 -13
  66. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +14 -22
  67. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +9 -13
  68. package/examples/__snapshots__/local-dot-env.test.ts.snap +9 -13
  69. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +9 -13
  70. package/examples/__snapshots__/modify-generated-files.test.ts.snap +9 -13
  71. package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +9 -13
  72. package/examples/__snapshots__/multiline-var.test.ts.snap +18 -30
  73. package/examples/__snapshots__/native-app.test.ts.snap +14 -22
  74. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +9 -13
  75. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +9 -13
  76. package/examples/__snapshots__/override-secrets.test.ts.snap +9 -13
  77. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +18 -30
  78. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +14 -22
  79. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +9 -13
  80. package/examples/__snapshots__/workspace-api-www.test.ts.snap +9 -13
  81. package/package.json +1 -1
  82. package/src/build/base/createBuildJobDefinition.ts +2 -1
  83. package/src/build/custom/buildJob.ts +1 -1
  84. package/src/build/index.ts +6 -2
  85. package/src/build/node/buildJob.ts +26 -17
  86. package/src/build/node/cache.ts +18 -15
  87. package/src/build/node/index.ts +17 -9
  88. package/src/build/node/meteor.ts +17 -12
  89. package/src/build/node/testJob.ts +10 -6
  90. package/src/build/node/yarn.ts +10 -8
  91. package/src/build/types.ts +2 -2
  92. package/src/context/createComponentContext.ts +6 -3
  93. package/src/context/createWorkspaceContext.ts +1 -1
  94. package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +3 -1
  95. package/src/deploy/custom/deployJob.ts +3 -3
  96. package/src/deploy/index.ts +1 -1
  97. package/src/pipeline/createAllJobs.ts +9 -7
  98. package/src/pipeline/createJobsForComponent.ts +6 -6
  99. package/src/pipeline/createJobsForWorkspace.ts +3 -3
  100. package/src/pipeline/yarn/yarnUtils.ts +34 -0
  101. package/src/types/context.ts +3 -3
@@ -1,5 +1,120 @@
1
1
  "use strict";
2
2
 
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __generator = this && this.__generator || function (thisArg, body) {
31
+ var _ = {
32
+ label: 0,
33
+ sent: function () {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ },
40
+ f,
41
+ y,
42
+ t,
43
+ g;
44
+ return g = {
45
+ next: verb(0),
46
+ "throw": verb(1),
47
+ "return": verb(2)
48
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
+ return this;
50
+ }), g;
51
+ function verb(n) {
52
+ return function (v) {
53
+ return step([n, v]);
54
+ };
55
+ }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return {
113
+ value: op[0] ? op[1] : void 0,
114
+ done: true
115
+ };
116
+ }
117
+ };
3
118
  var __read = this && this.__read || function (o, n) {
4
119
  var m = typeof Symbol === "function" && o[Symbol.iterator];
5
120
  if (!m) return o;
@@ -39,14 +154,47 @@ var buildJob_1 = require("./buildJob");
39
154
  var meteor_1 = require("./meteor");
40
155
  var testJob_1 = require("./testJob");
41
156
  var createNodeJobs = function (context) {
42
- return __spreadArray(__spreadArray([], __read((0, testJob_1.createNodeTestJobs)(context)), false), __read((0, buildJob_1.createNodeBuildJobs)(context)), false);
157
+ return __awaiter(void 0, void 0, void 0, function () {
158
+ var _a, testJobs, buildJobs;
159
+ return __generator(this, function (_b) {
160
+ switch (_b.label) {
161
+ case 0:
162
+ return [4 /*yield*/, Promise.all([(0, testJob_1.createNodeTestJobs)(context), (0, buildJob_1.createNodeBuildJobs)(context)])];
163
+ case 1:
164
+ _a = __read.apply(void 0, [_b.sent(), 2]), testJobs = _a[0], buildJobs = _a[1];
165
+ return [2 /*return*/, __spreadArray(__spreadArray([], __read(testJobs), false), __read(buildJobs), false)];
166
+ }
167
+ });
168
+ });
43
169
  };
44
170
  exports.createNodeJobs = createNodeJobs;
45
171
  var createStorybookJobs = function (context) {
46
- return __spreadArray([], __read((0, buildJob_1.createNodeBuildJobs)(context)), false);
172
+ return __awaiter(void 0, void 0, void 0, function () {
173
+ var _a;
174
+ return __generator(this, function (_b) {
175
+ switch (_b.label) {
176
+ case 0:
177
+ _a = [[]];
178
+ return [4 /*yield*/, (0, buildJob_1.createNodeBuildJobs)(context)];
179
+ case 1:
180
+ return [2 /*return*/, __spreadArray.apply(void 0, _a.concat([__read.apply(void 0, [_b.sent()]), false]))];
181
+ }
182
+ });
183
+ });
47
184
  };
48
185
  exports.createStorybookJobs = createStorybookJobs;
49
186
  var createMeteorJobs = function (context) {
50
- return __spreadArray(__spreadArray([], __read((0, testJob_1.createNodeTestJobs)(context)), false), __read((0, meteor_1.createMeteorBuildJobs)(context)), false);
187
+ return __awaiter(void 0, void 0, void 0, function () {
188
+ var _a, testJobs, buildJobs;
189
+ return __generator(this, function (_b) {
190
+ switch (_b.label) {
191
+ case 0:
192
+ return [4 /*yield*/, Promise.all([(0, testJob_1.createNodeTestJobs)(context), (0, meteor_1.createMeteorBuildJobs)(context)])];
193
+ case 1:
194
+ _a = __read.apply(void 0, [_b.sent(), 2]), testJobs = _a[0], buildJobs = _a[1];
195
+ return [2 /*return*/, __spreadArray(__spreadArray([], __read(testJobs), false), __read(buildJobs), false)];
196
+ }
197
+ });
198
+ });
51
199
  };
52
200
  exports.createMeteorJobs = createMeteorJobs;
@@ -1,3 +1,3 @@
1
1
  import type { ComponentContextWithBuild } from "../../types/context";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createMeteorBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
3
+ export declare const createMeteorBuildJobs: (context: ComponentContextWithBuild) => Promise<CatladderJob[]>;
@@ -1,5 +1,120 @@
1
1
  "use strict";
2
2
 
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __generator = this && this.__generator || function (thisArg, body) {
31
+ var _ = {
32
+ label: 0,
33
+ sent: function () {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ },
40
+ f,
41
+ y,
42
+ t,
43
+ g;
44
+ return g = {
45
+ next: verb(0),
46
+ "throw": verb(1),
47
+ "return": verb(2)
48
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
+ return this;
50
+ }), g;
51
+ function verb(n) {
52
+ return function (v) {
53
+ return step([n, v]);
54
+ };
55
+ }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return {
113
+ value: op[0] ? op[1] : void 0,
114
+ done: true
115
+ };
116
+ }
117
+ };
3
118
  var __read = this && this.__read || function (o, n) {
4
119
  var m = typeof Symbol === "function" && o[Symbol.iterator];
5
120
  if (!m) return o;
@@ -50,37 +165,57 @@ var getMeteorCache = function (context) {
50
165
  }];
51
166
  };
52
167
  var getMeteorDockerInstallScripts = function (context) {
53
- if (context.packageManagerInfo.isClassic) {
54
- return new BashExpression_1.BashExpression("\nCOPY $APP_DIR/package.json $APP_DIR/yarn.lock ./\n\nRUN yarn --frozen-lockfile --production=true --ignore-scripts --ignore-engines\nCOPY $APP_DIR .\nRUN yarn --frozen-lockfile --production=true --ignore-engines\n ".trim());
55
- }
56
- // yarn >= 4 ships with built-in plugins, see https://github.com/yarnpkg/berry/pull/4253
57
- var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
58
- return context.packageManagerInfo.version.startsWith(v);
168
+ return __awaiter(void 0, void 0, void 0, function () {
169
+ var packageManagerInfo, doesNotShipWithBuiltInPlugins, maybeAddWorkspaceToolsCommand;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0:
173
+ return [4 /*yield*/, context.packageManagerInfo];
174
+ case 1:
175
+ packageManagerInfo = _a.sent();
176
+ if (packageManagerInfo.isClassic) {
177
+ return [2 /*return*/, new BashExpression_1.BashExpression("\nCOPY $APP_DIR/package.json $APP_DIR/yarn.lock ./\n\nRUN yarn --frozen-lockfile --production=true --ignore-scripts --ignore-engines\nCOPY $APP_DIR .\nRUN yarn --frozen-lockfile --production=true --ignore-engines\n ".trim())];
178
+ }
179
+ doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
180
+ return packageManagerInfo.version.startsWith(v);
181
+ });
182
+ maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
183
+ return [2 /*return*/, new BashExpression_1.BashExpression("\nENV YARN_ENABLE_INLINE_BUILDS=1\nCOPY $APP_DIR .\n".concat(maybeAddWorkspaceToolsCommand, "\nRUN yarn workspaces focus --production\n ").trim())];
184
+ }
185
+ });
59
186
  });
60
- var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
61
- return new BashExpression_1.BashExpression("\nENV YARN_ENABLE_INLINE_BUILDS=1\nCOPY $APP_DIR .\n".concat(maybeAddWorkspaceToolsCommand, "\nRUN yarn workspaces focus --production\n ").trim());
62
187
  };
63
188
  var createMeteorBuildJobs = function (context) {
64
- var buildConfig = context.build.config;
65
- if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
66
- throw new Error("deploy config is not meteor");
67
- }
68
- var yarnInstall = (0, yarn_1.getYarnInstall)(context);
69
- return (0, base_1.createComponentBuildJobs)(context, {
70
- appBuild: buildConfig.buildCommand !== null ? {
71
- cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
72
- image: (0, runner_1.getRunnerImage)("jobs-meteor"),
73
- variables: {
74
- METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
75
- },
76
- script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['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)
77
- } : undefined,
78
- dockerBuild: {
79
- script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
80
- variables: {
81
- METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? getMeteorDockerInstallScripts(context) : ""
189
+ return __awaiter(void 0, void 0, void 0, function () {
190
+ var buildConfig, _a, yarnInstall, nodeCache, meteorInstallScripts;
191
+ return __generator(this, function (_b) {
192
+ switch (_b.label) {
193
+ case 0:
194
+ buildConfig = context.build.config;
195
+ if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
196
+ throw new Error("deploy config is not meteor");
197
+ }
198
+ return [4 /*yield*/, Promise.all([(0, yarn_1.getYarnInstall)(context), (0, cache_1.getNodeCache)(context), buildConfig.installScripts ? getMeteorDockerInstallScripts(context) : Promise.resolve("")])];
199
+ case 1:
200
+ _a = __read.apply(void 0, [_b.sent(), 3]), yarnInstall = _a[0], nodeCache = _a[1], meteorInstallScripts = _a[2];
201
+ return [2 /*return*/, (0, base_1.createComponentBuildJobs)(context, {
202
+ appBuild: buildConfig.buildCommand !== null && buildConfig.buildCommand !== false ? {
203
+ cache: __spreadArray(__spreadArray([], __read(nodeCache), false), __read(getMeteorCache(context)), false),
204
+ image: (0, runner_1.getRunnerImage)("jobs-meteor"),
205
+ variables: {
206
+ METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
207
+ },
208
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['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)
209
+ } : undefined,
210
+ dockerBuild: {
211
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
212
+ variables: {
213
+ METEOR_INSTALL_SCRIPTS: meteorInstallScripts
214
+ }
215
+ }
216
+ })];
82
217
  }
83
- }
218
+ });
84
219
  });
85
220
  };
86
221
  exports.createMeteorBuildJobs = createMeteorBuildJobs;
@@ -1,4 +1,4 @@
1
1
  import type { WorkspaceContext } from "../../types/context";
2
2
  import { type ComponentContext } from "../../types/context";
3
3
  import type { CatladderJob } from "../../types/jobs";
4
- export declare const createNodeTestJobs: (context: ComponentContext | WorkspaceContext) => CatladderJob[];
4
+ export declare const createNodeTestJobs: (context: ComponentContext | WorkspaceContext) => Promise<CatladderJob[]>;
@@ -10,6 +10,121 @@ var __assign = this && this.__assign || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) {
15
+ return value instanceof P ? value : new P(function (resolve) {
16
+ resolve(value);
17
+ });
18
+ }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) {
21
+ try {
22
+ step(generator.next(value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ }
27
+ function rejected(value) {
28
+ try {
29
+ step(generator["throw"](value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ }
34
+ function step(result) {
35
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
36
+ }
37
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
38
+ });
39
+ };
40
+ var __generator = this && this.__generator || function (thisArg, body) {
41
+ var _ = {
42
+ label: 0,
43
+ sent: function () {
44
+ if (t[0] & 1) throw t[1];
45
+ return t[1];
46
+ },
47
+ trys: [],
48
+ ops: []
49
+ },
50
+ f,
51
+ y,
52
+ t,
53
+ g;
54
+ return g = {
55
+ next: verb(0),
56
+ "throw": verb(1),
57
+ "return": verb(2)
58
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
59
+ return this;
60
+ }), g;
61
+ function verb(n) {
62
+ return function (v) {
63
+ return step([n, v]);
64
+ };
65
+ }
66
+ function step(op) {
67
+ if (f) throw new TypeError("Generator is already executing.");
68
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
69
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
70
+ if (y = 0, t) op = [op[0] & 2, t.value];
71
+ switch (op[0]) {
72
+ case 0:
73
+ case 1:
74
+ t = op;
75
+ break;
76
+ case 4:
77
+ _.label++;
78
+ return {
79
+ value: op[1],
80
+ done: false
81
+ };
82
+ case 5:
83
+ _.label++;
84
+ y = op[1];
85
+ op = [0];
86
+ continue;
87
+ case 7:
88
+ op = _.ops.pop();
89
+ _.trys.pop();
90
+ continue;
91
+ default:
92
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
93
+ _ = 0;
94
+ continue;
95
+ }
96
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
97
+ _.label = op[1];
98
+ break;
99
+ }
100
+ if (op[0] === 6 && _.label < t[1]) {
101
+ _.label = t[1];
102
+ t = op;
103
+ break;
104
+ }
105
+ if (t && _.label < t[2]) {
106
+ _.label = t[2];
107
+ _.ops.push(op);
108
+ break;
109
+ }
110
+ if (t[2]) _.ops.pop();
111
+ _.trys.pop();
112
+ continue;
113
+ }
114
+ op = body.call(thisArg, _);
115
+ } catch (e) {
116
+ op = [6, e];
117
+ y = 0;
118
+ } finally {
119
+ f = t = 0;
120
+ }
121
+ if (op[0] & 5) throw op[1];
122
+ return {
123
+ value: op[0] ? op[1] : void 0,
124
+ done: true
125
+ };
126
+ }
127
+ };
13
128
  var __read = this && this.__read || function (o, n) {
14
129
  var m = typeof Symbol === "function" && o[Symbol.iterator];
15
130
  if (!m) return o;
@@ -54,54 +169,64 @@ var constants_1 = require("./constants");
54
169
  var yarn_1 = require("./yarn");
55
170
  var createJobCache_1 = require("../cache/createJobCache");
56
171
  var createNodeTestJobs = function (context) {
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, _0, _1, _2, _3;
58
- // don't run tests after release
59
- // TODO: this will be replaced by using rules
60
- if (context.trigger === "taggedRelease") {
61
- return [];
62
- }
63
- // if its not a standalone build, we don't need to run tests
64
- if (context.type === "component" && !(0, context_1.componentContextIsStandaloneBuild)(context)) {
65
- return [];
66
- }
67
- var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
68
- var base = {
69
- variables: __assign({
70
- APP_PATH: context.build.dir
71
- }, context.type === "component" ? __assign({}, context.environment.jobOnlyVars.build.envVars) : {}),
72
- stage: "test",
73
- needs: []
74
- };
75
- var buildConfig = context.build.config;
76
- var yarnInstall = (0, yarn_1.getYarnInstall)(context);
77
- var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
78
- name: "๐Ÿ›ก audit"
79
- }, base), {
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
- cache: undefined,
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 --level critical" : "yarn npm audit --environment production --severity critical" // yarn 2
84
- ]), false),
85
- allow_failure: (_h = (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.allowFailure) !== null && _h !== void 0 ? _h : true
86
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_j = buildConfig.audit) === null || _j === void 0 ? void 0 : _j.artifactsReports, (_k = buildConfig.audit) === null || _k === void 0 ? void 0 : _k.artifacts)) : null;
87
- var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
88
- name: "๐Ÿ‘ฎ lint"
89
- }, base), {
90
- runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_m = (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.runnerVariables) !== null && _m !== void 0 ? _m : {}),
91
- image: (_p = (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
92
- cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
93
- 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.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn lint"]), false),
94
- allow_failure: (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.allowFailure
95
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.lint) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
96
- var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
97
- name: "๐Ÿงช test"
98
- }, base), {
99
- runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_w = (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.runnerVariables) !== null && _w !== void 0 ? _w : {}),
100
- image: (_y = (_x = buildConfig.test) === null || _x === void 0 ? void 0 : _x.jobImage) !== null && _y !== void 0 ? _y : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
101
- cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
102
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : ["yarn test"]), false),
103
- allow_failure: (_1 = buildConfig.test) === null || _1 === void 0 ? void 0 : _1.allowFailure
104
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.artifactsReports, (_3 = buildConfig.test) === null || _3 === void 0 ? void 0 : _3.artifacts)) : null;
105
- return [auditJob, lintJob, testJob].filter(utils_1.notNil);
172
+ return __awaiter(void 0, void 0, void 0, function () {
173
+ var defaultImage, base, buildConfig, _a, yarnInstall, packageManagerInfo, nodeCache, auditJob, lintJob, testJob;
174
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
175
+ return __generator(this, function (_5) {
176
+ switch (_5.label) {
177
+ case 0:
178
+ // don't run tests after release
179
+ // TODO: this will be replaced by using rules
180
+ if (context.trigger === "taggedRelease") {
181
+ return [2 /*return*/, []];
182
+ }
183
+ // if its not a standalone build, we don't need to run tests
184
+ if (context.type === "component" && !(0, context_1.componentContextIsStandaloneBuild)(context)) {
185
+ return [2 /*return*/, []];
186
+ }
187
+ defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
188
+ base = {
189
+ variables: __assign({
190
+ APP_PATH: context.build.dir
191
+ }, context.type === "component" ? __assign({}, context.environment.jobOnlyVars.build.envVars) : {}),
192
+ stage: "test",
193
+ needs: []
194
+ };
195
+ buildConfig = context.build.config;
196
+ return [4 /*yield*/, Promise.all([(0, yarn_1.getYarnInstall)(context), context.packageManagerInfo, (0, cache_1.getNodeCache)(context)])];
197
+ case 1:
198
+ _a = __read.apply(void 0, [_5.sent(), 3]), yarnInstall = _a[0], packageManagerInfo = _a[1], nodeCache = _a[2];
199
+ auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
200
+ name: "๐Ÿ›ก audit"
201
+ }, base), {
202
+ runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.runnerVariables) !== null && _c !== void 0 ? _c : {}),
203
+ image: (_e = (_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.jobImage) !== null && _e !== void 0 ? _e : defaultImage,
204
+ cache: undefined,
205
+ script: __spreadArray(["cd ".concat(context.build.dir)], __read((_g = (0, utils_1.ensureArrayOrNull)((_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.command)) !== null && _g !== void 0 ? _g : [packageManagerInfo.isClassic ? "yarn audit --level critical" : "yarn npm audit --environment production --severity critical" // yarn 2
206
+ ]), false),
207
+ allow_failure: (_j = (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.allowFailure) !== null && _j !== void 0 ? _j : true
208
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_k = buildConfig.audit) === null || _k === void 0 ? void 0 : _k.artifactsReports, (_l = buildConfig.audit) === null || _l === void 0 ? void 0 : _l.artifacts)) : null;
209
+ lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
210
+ name: "๐Ÿ‘ฎ lint"
211
+ }, base), {
212
+ runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_o = (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.runnerVariables) !== null && _o !== void 0 ? _o : {}),
213
+ image: (_q = (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : defaultImage,
214
+ cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, nodeCache),
215
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn lint"]), false),
216
+ allow_failure: (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.allowFailure
217
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.lint) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.lint) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
218
+ testJob = buildConfig.test !== false ? __assign(__assign(__assign({
219
+ name: "๐Ÿงช test"
220
+ }, base), {
221
+ runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_x = (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.runnerVariables) !== null && _x !== void 0 ? _x : {}),
222
+ image: (_z = (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.jobImage) !== null && _z !== void 0 ? _z : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
223
+ cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, nodeCache),
224
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_1 = (0, utils_1.ensureArrayOrNull)((_0 = buildConfig.test) === null || _0 === void 0 ? void 0 : _0.command)) !== null && _1 !== void 0 ? _1 : ["yarn test"]), false),
225
+ allow_failure: (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.allowFailure
226
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_3 = buildConfig.test) === null || _3 === void 0 ? void 0 : _3.artifactsReports, (_4 = buildConfig.test) === null || _4 === void 0 ? void 0 : _4.artifacts)) : null;
227
+ return [2 /*return*/, [auditJob, lintJob, testJob].filter(utils_1.notNil)];
228
+ }
229
+ });
230
+ });
106
231
  };
107
232
  exports.createNodeTestJobs = createNodeTestJobs;
@@ -4,5 +4,5 @@ import { type Context } from "../../types";
4
4
  export declare const ensureNodeVersion: (context: Context) => string[];
5
5
  export declare const getYarnInstall: (context: Context, options?: {
6
6
  noCustomPostInstall: boolean;
7
- }) => string[];
8
- export declare const getDockerAppCopyAndBuildScript: (context: ComponentContextWithBuild) => BashExpression;
7
+ }) => Promise<string[]>;
8
+ export declare const getDockerAppCopyAndBuildScript: (context: ComponentContextWithBuild) => Promise<BashExpression>;