@catladder/pipeline 1.0.4 → 1.1.2

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 (86) hide show
  1. package/dist/build/base/constants.d.ts +7 -0
  2. package/dist/build/base/constants.js +11 -0
  3. package/dist/build/base/createBuildJob.d.ts +5 -0
  4. package/dist/build/base/createBuildJob.js +99 -0
  5. package/dist/build/docker.d.ts +5 -0
  6. package/dist/build/docker.js +95 -0
  7. package/dist/build/index.d.ts +12 -0
  8. package/dist/build/index.js +63 -0
  9. package/dist/build/node/buildJob.d.ts +3 -0
  10. package/dist/build/node/buildJob.js +100 -0
  11. package/dist/build/node/cache.d.ts +4 -0
  12. package/dist/build/node/cache.js +67 -0
  13. package/dist/build/node/constants.d.ts +6 -0
  14. package/dist/build/node/constants.js +10 -0
  15. package/dist/build/node/index.d.ts +5 -0
  16. package/dist/build/node/index.js +63 -0
  17. package/dist/build/node/meteor.d.ts +3 -0
  18. package/dist/build/node/meteor.js +103 -0
  19. package/dist/build/node/testJob.d.ts +3 -0
  20. package/dist/build/node/testJob.js +112 -0
  21. package/dist/build/node/yarn.d.ts +2 -0
  22. package/dist/build/node/yarn.js +12 -0
  23. package/dist/build/tests/storybook.test.d.ts +1 -0
  24. package/dist/build/tests/storybook.test.js +221 -0
  25. package/dist/build/types.d.ts +63 -0
  26. package/dist/build/types.js +16 -0
  27. package/dist/catladder-gitlab.d.ts +1 -0
  28. package/dist/catladder-gitlab.js +44 -0
  29. package/dist/config/configruedEnvs.d.ts +4 -0
  30. package/dist/config/configruedEnvs.js +86 -0
  31. package/dist/config/configruedEnvs.test.d.ts +1 -0
  32. package/dist/config/configruedEnvs.test.js +103 -0
  33. package/dist/config/index.d.ts +2 -0
  34. package/dist/config/index.js +24 -0
  35. package/dist/config/readConfig.d.ts +2 -0
  36. package/dist/config/readConfig.js +47 -0
  37. package/dist/constants.d.ts +2 -0
  38. package/dist/constants.js +6 -0
  39. package/dist/context/index.d.ts +5 -0
  40. package/dist/context/index.js +211 -0
  41. package/dist/defaults/index.d.ts +2 -0
  42. package/dist/defaults/index.js +8 -0
  43. package/dist/deploy/base.d.ts +9 -0
  44. package/dist/deploy/base.js +94 -0
  45. package/dist/deploy/index.d.ts +11 -0
  46. package/dist/deploy/index.js +34 -0
  47. package/dist/deploy/kubernetes/cloudsql.d.ts +6 -0
  48. package/dist/deploy/kubernetes/cloudsql.js +16 -0
  49. package/dist/deploy/kubernetes/deployJob.d.ts +3 -0
  50. package/dist/deploy/kubernetes/deployJob.js +149 -0
  51. package/dist/deploy/kubernetes/index.d.ts +1 -0
  52. package/dist/deploy/kubernetes/index.js +22 -0
  53. package/dist/deploy/kubernetes/mongodb.d.ts +15 -0
  54. package/dist/deploy/kubernetes/mongodb.js +23 -0
  55. package/dist/deploy/types.d.ts +92 -0
  56. package/dist/deploy/types.js +16 -0
  57. package/dist/index.d.ts +8 -0
  58. package/dist/index.js +36 -0
  59. package/dist/pipeline/createChildPipeline.d.ts +9 -0
  60. package/dist/pipeline/createChildPipeline.js +266 -0
  61. package/dist/pipeline/createChildPipeline.test.d.ts +1 -0
  62. package/dist/pipeline/createChildPipeline.test.js +199 -0
  63. package/dist/pipeline/createJobs.d.ts +3 -0
  64. package/dist/pipeline/createJobs.js +331 -0
  65. package/dist/pipeline/index.d.ts +2 -0
  66. package/dist/pipeline/index.js +24 -0
  67. package/dist/pipeline/yarnInfo.d.ts +2 -0
  68. package/dist/pipeline/yarnInfo.js +296 -0
  69. package/dist/rules/index.d.ts +3 -0
  70. package/dist/rules/index.js +27 -0
  71. package/dist/runner/index.d.ts +3 -0
  72. package/dist/runner/index.js +12 -0
  73. package/dist/tsconfig.tsbuildinfo +1 -0
  74. package/dist/types/config.d.ts +73 -0
  75. package/dist/types/config.js +80 -0
  76. package/dist/types/context.d.ts +36 -0
  77. package/dist/types/context.js +3 -0
  78. package/dist/types/gitlab-types.d.ts +86 -0
  79. package/dist/types/gitlab-types.js +5 -0
  80. package/dist/types/index.d.ts +3 -0
  81. package/dist/types/index.js +26 -0
  82. package/dist/utils/index.d.ts +2 -0
  83. package/dist/utils/index.js +18 -0
  84. package/package.json +1 -1
  85. package/src/build/node/buildJob.ts +4 -0
  86. package/src/build/node/constants.ts +1 -1
@@ -0,0 +1,331 @@
1
+ "use strict";
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
+
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) {
19
+ return value instanceof P ? value : new P(function (resolve) {
20
+ resolve(value);
21
+ });
22
+ }
23
+
24
+ return new (P || (P = Promise))(function (resolve, reject) {
25
+ function fulfilled(value) {
26
+ try {
27
+ step(generator.next(value));
28
+ } catch (e) {
29
+ reject(e);
30
+ }
31
+ }
32
+
33
+ function rejected(value) {
34
+ try {
35
+ step(generator["throw"](value));
36
+ } catch (e) {
37
+ reject(e);
38
+ }
39
+ }
40
+
41
+ function step(result) {
42
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43
+ }
44
+
45
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
46
+ });
47
+ };
48
+
49
+ var __generator = this && this.__generator || function (thisArg, body) {
50
+ var _ = {
51
+ label: 0,
52
+ sent: function () {
53
+ if (t[0] & 1) throw t[1];
54
+ return t[1];
55
+ },
56
+ trys: [],
57
+ ops: []
58
+ },
59
+ f,
60
+ y,
61
+ t,
62
+ g;
63
+ return g = {
64
+ next: verb(0),
65
+ "throw": verb(1),
66
+ "return": verb(2)
67
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
68
+ return this;
69
+ }), g;
70
+
71
+ function verb(n) {
72
+ return function (v) {
73
+ return step([n, v]);
74
+ };
75
+ }
76
+
77
+ function step(op) {
78
+ if (f) throw new TypeError("Generator is already executing.");
79
+
80
+ while (_) try {
81
+ 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;
82
+ if (y = 0, t) op = [op[0] & 2, t.value];
83
+
84
+ switch (op[0]) {
85
+ case 0:
86
+ case 1:
87
+ t = op;
88
+ break;
89
+
90
+ case 4:
91
+ _.label++;
92
+ return {
93
+ value: op[1],
94
+ done: false
95
+ };
96
+
97
+ case 5:
98
+ _.label++;
99
+ y = op[1];
100
+ op = [0];
101
+ continue;
102
+
103
+ case 7:
104
+ op = _.ops.pop();
105
+
106
+ _.trys.pop();
107
+
108
+ continue;
109
+
110
+ default:
111
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
112
+ _ = 0;
113
+ continue;
114
+ }
115
+
116
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
117
+ _.label = op[1];
118
+ break;
119
+ }
120
+
121
+ if (op[0] === 6 && _.label < t[1]) {
122
+ _.label = t[1];
123
+ t = op;
124
+ break;
125
+ }
126
+
127
+ if (t && _.label < t[2]) {
128
+ _.label = t[2];
129
+
130
+ _.ops.push(op);
131
+
132
+ break;
133
+ }
134
+
135
+ if (t[2]) _.ops.pop();
136
+
137
+ _.trys.pop();
138
+
139
+ continue;
140
+ }
141
+
142
+ op = body.call(thisArg, _);
143
+ } catch (e) {
144
+ op = [6, e];
145
+ y = 0;
146
+ } finally {
147
+ f = t = 0;
148
+ }
149
+
150
+ if (op[0] & 5) throw op[1];
151
+ return {
152
+ value: op[0] ? op[1] : void 0,
153
+ done: true
154
+ };
155
+ }
156
+ };
157
+
158
+ var __read = this && this.__read || function (o, n) {
159
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
160
+ if (!m) return o;
161
+ var i = m.call(o),
162
+ r,
163
+ ar = [],
164
+ e;
165
+
166
+ try {
167
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
168
+ } catch (error) {
169
+ e = {
170
+ error: error
171
+ };
172
+ } finally {
173
+ try {
174
+ if (r && !r.done && (m = i["return"])) m.call(i);
175
+ } finally {
176
+ if (e) throw e.error;
177
+ }
178
+ }
179
+
180
+ return ar;
181
+ };
182
+
183
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
184
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
185
+ if (ar || !(i in from)) {
186
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
187
+ ar[i] = from[i];
188
+ }
189
+ }
190
+ return to.concat(ar || Array.prototype.slice.call(from));
191
+ };
192
+
193
+ exports.__esModule = true;
194
+ exports.createJobs = void 0;
195
+
196
+ var lodash_1 = require("lodash");
197
+
198
+ var build_1 = require("../build");
199
+
200
+ var context_1 = require("../context");
201
+
202
+ var deploy_1 = require("../deploy");
203
+
204
+ var utils_1 = require("../utils");
205
+
206
+ var yarnInfo_1 = require("./yarnInfo");
207
+
208
+ var createRawJobs = function (context) {
209
+ if (context.componentConfig.deploy === false) {
210
+ return [];
211
+ }
212
+
213
+ var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
214
+ var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
215
+ return __spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false);
216
+ };
217
+
218
+ var getFullJobName = function (name, componentName, env) {
219
+ if (env) {
220
+ return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
221
+ }
222
+
223
+ return "".concat(componentName, " ").concat(name);
224
+ };
225
+
226
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
227
+ var referencedJob = allRawJobs.find(function (j) {
228
+ return j.name === referencedJobName;
229
+ });
230
+
231
+ if (!referencedJob) {
232
+ throw new Error("unknown job referenced: " + referencedJobName);
233
+ }
234
+
235
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
236
+ return getFullJobName(referencedJobName, componentName, envToSet);
237
+ }; // replaces references to other jobs with the full name
238
+ // the full name contains the componentname and the env name (if any)
239
+
240
+
241
+ var replaceReferences = function (job, componentName, env, allRawJobs) {
242
+ var _a, _b, _c;
243
+
244
+ var def = job.job;
245
+ var stage = job.envMode === "stagePerEnv" ? "".concat(def.stage, " ").concat(env) : def.stage;
246
+ return __assign(__assign({}, def), {
247
+ stage: stage,
248
+ needs: (_a = def.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
249
+ return (0, lodash_1.isObject)(n) ? {
250
+ job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
251
+ artifacts: n.artifacts
252
+ } : getFullReferencedJobName(n, componentName, env, allRawJobs);
253
+ }),
254
+ environment: ((_b = def.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, def.environment), {
255
+ on_stop: getFullReferencedJobName(def.environment.on_stop, componentName, env, allRawJobs)
256
+ }) : def.environment,
257
+ dependencies: (_c = def.dependencies) === null || _c === void 0 ? void 0 : _c.map(function (n) {
258
+ return getFullReferencedJobName(n, componentName, env, allRawJobs);
259
+ })
260
+ });
261
+ }; // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
262
+
263
+
264
+ var addStageNeeds = function (jobs) {
265
+ // when a job defines needsStages, we add these as needs
266
+ return jobs.map(function (job) {
267
+ var _a;
268
+
269
+ if (!job.needsStages || job.needsStages.length === 0) {
270
+ return job;
271
+ }
272
+
273
+ var neededJobs = jobs.map(function (j) {
274
+ var _a, _b;
275
+
276
+ var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
277
+ return j.job.stage === s.stage;
278
+ });
279
+
280
+ if (neededStage) {
281
+ return {
282
+ job: j.name,
283
+ artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
284
+ };
285
+ }
286
+ }).filter(utils_1.notNil);
287
+ return __assign(__assign({}, job), {
288
+ job: __assign(__assign({}, job.job), {
289
+ needs: __spreadArray(__spreadArray([], __read((_a = job.job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
290
+ })
291
+ });
292
+ });
293
+ };
294
+
295
+ var createJobs = function (envs, config, componentName, trigger) {
296
+ return __awaiter(void 0, void 0, void 0, function () {
297
+ var commitInfo, yarnInfo;
298
+
299
+ var _a, _b;
300
+
301
+ return __generator(this, function (_c) {
302
+ switch (_c.label) {
303
+ case 0:
304
+ commitInfo = {
305
+ refName: (_a = process.env.CI_COMMIT_REF_NAME) !== null && _a !== void 0 ? _a : "unknown",
306
+ refSlug: (_b = process.env.CI_COMMIT_REF_SLUG) !== null && _b !== void 0 ? _b : "unknown",
307
+ trigger: trigger
308
+ };
309
+ return [4
310
+ /*yield*/
311
+ , (0, yarnInfo_1.getYarnInfo)(config, componentName)];
312
+
313
+ case 1:
314
+ yarnInfo = _c.sent();
315
+ return [2
316
+ /*return*/
317
+ , envs.reduce(function (acc, env) {
318
+ var context = (0, context_1.createContext)(config, componentName, env, commitInfo, yarnInfo);
319
+ var jobs = addStageNeeds(createRawJobs(context));
320
+ return __assign(__assign({}, acc), jobs.reduce(function (acc, job) {
321
+ var _a;
322
+
323
+ return __assign(__assign({}, acc), (_a = {}, _a[getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined)] = replaceReferences(job, componentName, env, jobs), _a));
324
+ }, {}));
325
+ }, {})];
326
+ }
327
+ });
328
+ });
329
+ };
330
+
331
+ exports.createJobs = createJobs;
@@ -0,0 +1,2 @@
1
+ export * from "./createChildPipeline";
2
+ export * from "./createJobs";
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, {
6
+ enumerable: true,
7
+ get: function () {
8
+ return m[k];
9
+ }
10
+ });
11
+ } : function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ });
15
+
16
+ var __exportStar = this && this.__exportStar || function (m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+
20
+ exports.__esModule = true;
21
+
22
+ __exportStar(require("./createChildPipeline"), exports);
23
+
24
+ __exportStar(require("./createJobs"), exports);
@@ -0,0 +1,2 @@
1
+ import { Config, YarnInfo } from "../types";
2
+ export declare const getYarnInfo: (config: Config, componentName: string) => Promise<YarnInfo>;
@@ -0,0 +1,296 @@
1
+ "use strict";
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
+
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) {
12
+ try {
13
+ step(generator.next(value));
14
+ } catch (e) {
15
+ reject(e);
16
+ }
17
+ }
18
+
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+
27
+ function step(result) {
28
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
29
+ }
30
+
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+
35
+ var __generator = this && this.__generator || function (thisArg, body) {
36
+ var _ = {
37
+ label: 0,
38
+ sent: function () {
39
+ if (t[0] & 1) throw t[1];
40
+ return t[1];
41
+ },
42
+ trys: [],
43
+ ops: []
44
+ },
45
+ f,
46
+ y,
47
+ t,
48
+ g;
49
+ return g = {
50
+ next: verb(0),
51
+ "throw": verb(1),
52
+ "return": verb(2)
53
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
54
+ return this;
55
+ }), g;
56
+
57
+ function verb(n) {
58
+ return function (v) {
59
+ return step([n, v]);
60
+ };
61
+ }
62
+
63
+ function step(op) {
64
+ if (f) throw new TypeError("Generator is already executing.");
65
+
66
+ while (_) try {
67
+ 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;
68
+ if (y = 0, t) op = [op[0] & 2, t.value];
69
+
70
+ switch (op[0]) {
71
+ case 0:
72
+ case 1:
73
+ t = op;
74
+ break;
75
+
76
+ case 4:
77
+ _.label++;
78
+ return {
79
+ value: op[1],
80
+ done: false
81
+ };
82
+
83
+ case 5:
84
+ _.label++;
85
+ y = op[1];
86
+ op = [0];
87
+ continue;
88
+
89
+ case 7:
90
+ op = _.ops.pop();
91
+
92
+ _.trys.pop();
93
+
94
+ continue;
95
+
96
+ default:
97
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
98
+ _ = 0;
99
+ continue;
100
+ }
101
+
102
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
103
+ _.label = op[1];
104
+ break;
105
+ }
106
+
107
+ if (op[0] === 6 && _.label < t[1]) {
108
+ _.label = t[1];
109
+ t = op;
110
+ break;
111
+ }
112
+
113
+ if (t && _.label < t[2]) {
114
+ _.label = t[2];
115
+
116
+ _.ops.push(op);
117
+
118
+ break;
119
+ }
120
+
121
+ if (t[2]) _.ops.pop();
122
+
123
+ _.trys.pop();
124
+
125
+ continue;
126
+ }
127
+
128
+ op = body.call(thisArg, _);
129
+ } catch (e) {
130
+ op = [6, e];
131
+ y = 0;
132
+ } finally {
133
+ f = t = 0;
134
+ }
135
+
136
+ if (op[0] & 5) throw op[1];
137
+ return {
138
+ value: op[0] ? op[1] : void 0,
139
+ done: true
140
+ };
141
+ }
142
+ };
143
+
144
+ var __importDefault = this && this.__importDefault || function (mod) {
145
+ return mod && mod.__esModule ? mod : {
146
+ "default": mod
147
+ };
148
+ };
149
+
150
+ exports.__esModule = true;
151
+ exports.getYarnInfo = void 0;
152
+
153
+ var child_process_promise_1 = require("child-process-promise");
154
+
155
+ var path_equal_1 = require("path-equal");
156
+
157
+ var memoizee_1 = __importDefault(require("memoizee"));
158
+
159
+ var execOrFail = function (cmd, onFail) {
160
+ return __awaiter(void 0, void 0, void 0, function () {
161
+ var e_1;
162
+ return __generator(this, function (_a) {
163
+ switch (_a.label) {
164
+ case 0:
165
+ _a.trys.push([0, 2,, 3]);
166
+
167
+ return [4
168
+ /*yield*/
169
+ , (0, child_process_promise_1.exec)(cmd).then(function (r) {
170
+ return r.stdout;
171
+ })];
172
+
173
+ case 1:
174
+ return [2
175
+ /*return*/
176
+ , _a.sent()];
177
+
178
+ case 2:
179
+ e_1 = _a.sent();
180
+ return [2
181
+ /*return*/
182
+ , onFail !== null && onFail !== void 0 ? onFail : null];
183
+
184
+ case 3:
185
+ return [2
186
+ /*return*/
187
+ ];
188
+ }
189
+ });
190
+ });
191
+ };
192
+
193
+ var getYarnVersion = (0, memoizee_1["default"])(function () {
194
+ return __awaiter(void 0, void 0, void 0, function () {
195
+ return __generator(this, function (_a) {
196
+ switch (_a.label) {
197
+ case 0:
198
+ return [4
199
+ /*yield*/
200
+ , execOrFail("yarn --version", "")];
201
+
202
+ case 1:
203
+ return [2
204
+ /*return*/
205
+ , _a.sent()];
206
+ }
207
+ });
208
+ });
209
+ }, {
210
+ promise: true
211
+ });
212
+ var getWorkspaces = (0, memoizee_1["default"])(function (isClassic) {
213
+ return __awaiter(void 0, void 0, void 0, function () {
214
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
215
+
216
+ var _l, _m;
217
+
218
+ return __generator(this, function (_o) {
219
+ switch (_o.label) {
220
+ case 0:
221
+ if (!isClassic) return [3
222
+ /*break*/
223
+ , 2];
224
+ _c = (_b = Object).values;
225
+ _e = (_d = JSON).parse;
226
+ _g = (_f = JSON).parse;
227
+ return [4
228
+ /*yield*/
229
+ , execOrFail("yarn workspaces --json info", "{}")];
230
+
231
+ case 1:
232
+ _a = _c.apply(_b, [_e.apply(_d, [(_m = (_l = _g.apply(_f, [_o.sent()])) === null || _l === void 0 ? void 0 : _l.data) !== null && _m !== void 0 ? _m : "{}"])]);
233
+ return [3
234
+ /*break*/
235
+ , 4];
236
+
237
+ case 2:
238
+ _j = (_h = JSON).parse;
239
+ _k = "[".concat;
240
+ return [4
241
+ /*yield*/
242
+ , execOrFail("yarn workspaces list --json", "")];
243
+
244
+ case 3:
245
+ _a = _j.apply(_h, [_k.apply("[", [_o.sent(), "]"])]);
246
+ _o.label = 4;
247
+
248
+ case 4:
249
+ return [2
250
+ /*return*/
251
+ , _a];
252
+ }
253
+ });
254
+ });
255
+ }, {
256
+ promise: true
257
+ });
258
+
259
+ var getYarnInfo = function (config, componentName) {
260
+ return __awaiter(void 0, void 0, void 0, function () {
261
+ var version, isClassic, component, workspaces, componentIsInWorkspace;
262
+ return __generator(this, function (_a) {
263
+ switch (_a.label) {
264
+ case 0:
265
+ return [4
266
+ /*yield*/
267
+ , getYarnVersion()];
268
+
269
+ case 1:
270
+ version = _a.sent();
271
+ if (!version) throw new Error("could not get yarn version");
272
+ isClassic = version.startsWith("1");
273
+ component = config.components[componentName];
274
+ return [4
275
+ /*yield*/
276
+ , getWorkspaces(isClassic)];
277
+
278
+ case 2:
279
+ workspaces = _a.sent();
280
+ componentIsInWorkspace = workspaces.some(function (w) {
281
+ return (0, path_equal_1.pathEqual)(component.dir, w.location);
282
+ });
283
+ return [2
284
+ /*return*/
285
+ , {
286
+ workspaces: workspaces,
287
+ version: version,
288
+ isClassic: isClassic,
289
+ componentIsInWorkspace: componentIsInWorkspace
290
+ }];
291
+ }
292
+ });
293
+ });
294
+ };
295
+
296
+ exports.getYarnInfo = getYarnInfo;
@@ -0,0 +1,3 @@
1
+ import { GitlabRule } from "../types";
2
+ export declare const RULES_ALWAYS: GitlabRule[];
3
+ export declare const RULES_RELEASE: GitlabRule[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.RULES_RELEASE = exports.RULES_ALWAYS = void 0;
5
+ var NEVER_ON_RELEASE_COMMIT = {
6
+ "if": "$CI_COMMIT_MESSAGE =~ /^chore\\(release\\).*/",
7
+ when: "never"
8
+ };
9
+ exports.RULES_ALWAYS = [{
10
+ "if": "$CI_COMMIT_TAG"
11
+ }, NEVER_ON_RELEASE_COMMIT, {
12
+ "if": "$CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/"
13
+ }, {
14
+ "if": "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
15
+ }, {
16
+ "if": "$CI_MERGE_REQUEST_ID"
17
+ }];
18
+ exports.RULES_RELEASE = [NEVER_ON_RELEASE_COMMIT, {
19
+ "if": '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $AUTO_RELEASE == "true"',
20
+ when: "on_success"
21
+ }, {
22
+ "if": "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH",
23
+ when: "manual"
24
+ }, {
25
+ "if": "$CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/",
26
+ when: "manual"
27
+ }];
@@ -0,0 +1,3 @@
1
+ declare type RunnerImageName = "jobs" | "kubernetes" | "base-pipeline" | "docker-build" | "semantic-release";
2
+ export declare const getRunnerImage: (imageName: RunnerImageName) => string;
3
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getRunnerImage = void 0;
5
+
6
+ var constants_1 = require("../constants");
7
+
8
+ var getRunnerImage = function (imageName) {
9
+ return constants_1.DOCKER_REGISTRY + "/" + imageName + ":" + constants_1.PIPELINE_IMAGE_TAG;
10
+ };
11
+
12
+ exports.getRunnerImage = getRunnerImage;