@catladder/pipeline 0.0.0-main-ef2d95a2 → 0.0.0-main-57e22cfd

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.
@@ -1,5 +1,5 @@
1
1
  import { GitlabJobCache, GitlabJobs } from "../types/gitlab-types";
2
2
  import { Context } from "../types/context";
3
- export declare const getNodeCache: (policy?: string) => GitlabJobCache[];
3
+ export declare const getNodeCache: (context: Context) => GitlabJobCache[];
4
4
  export declare const createStorybookJobs: (context: Context) => GitlabJobs;
5
5
  export declare const createNodeJobs: (context: Context) => GitlabJobs;
@@ -56,6 +56,10 @@ var docker_1 = require("./docker");
56
56
 
57
57
  var types_1 = require("./types");
58
58
 
59
+ var utils_1 = require("../utils");
60
+
61
+ var path_1 = require("path");
62
+
59
63
  var NODE_RUNNER_BUILD_VARIABLES = {
60
64
  KUBERNETES_CPU_REQUEST: "0.5",
61
65
  KUBERNETES_CPU_LIMIT: "2",
@@ -69,18 +73,22 @@ var baseRetry = {
69
73
  };
70
74
 
71
75
  var getYarnInstall = function (context) {
72
- return ["cd ".concat(context.componentConfig.dir), "if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi", "yarn install --frozen-lockfile"];
76
+ var _a;
77
+
78
+ return ["cd ".concat(context.componentConfig.dir), "if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi", ((_a = context.yarnInfo) === null || _a === void 0 ? void 0 : _a.isClassic) ? "yarn install --frozen-lockfile" : "yarn install --immutable"];
73
79
  };
74
80
 
75
- var getNodeCache = function (policy) {
76
- if (policy === void 0) {
77
- policy = "pull-push";
78
- }
81
+ var getNodeCache = function (context) {
82
+ var _a, _b, _c;
79
83
 
84
+ var componentIsInWorkspace = (_a = context.yarnInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace;
80
85
  return [{
81
- key: "node-modules",
82
- policy: policy,
83
- paths: [".yarn", "node_modules", "**/node_modules/"]
86
+ // if component is in a shared workspace, use workspace cache. use individual cache else
87
+ key: componentIsInWorkspace ? "node-modules-workspace" : context.componentName + "-node-modules",
88
+ policy: "pull-push",
89
+ paths: __spreadArray([".yarn"], __read(componentIsInWorkspace ? __spreadArray(["node_modules"], __read((_c = (_b = context.yarnInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
90
+ return (0, path_1.join)(w.location, "node_modules");
91
+ })) !== null && _c !== void 0 ? _c : []), false) : [(0, path_1.join)(context.componentConfig.dir, "node_modules")]), false)
84
92
  }];
85
93
  };
86
94
 
@@ -88,57 +96,61 @@ exports.getNodeCache = getNodeCache;
88
96
 
89
97
  var getNextCache = function (context) {
90
98
  return [{
91
- key: "next-cache",
99
+ key: context.componentName + "-next-cache",
92
100
  policy: "pull-push",
93
101
  paths: [context.componentConfig.dir + "/.next/cache/"]
94
102
  }];
95
103
  };
96
104
 
97
105
  var createNodeTestJobs = function (context) {
98
- var _a, _b; // don't run tests after release
106
+ var _a, _b, _c, _d, _e, _f, _g, _h; // don't run tests after release
99
107
 
100
108
 
101
109
  if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
102
110
  return [];
103
111
  }
104
112
 
113
+ var buildConfig = context.componentConfig.build;
105
114
  var base = {
106
115
  variables: __assign(__assign({
107
116
  APP_PATH: context.componentConfig.dir
108
- }, NODE_RUNNER_BUILD_VARIABLES), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
117
+ }, NODE_RUNNER_BUILD_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
109
118
  stage: "test",
110
119
  interruptible: true,
111
120
  needs: [],
112
121
  retry: baseRetry
113
122
  };
114
123
  var yarnInstall = getYarnInstall(context);
115
- return [{
124
+ var auditJob = buildConfig.audit !== false ? {
116
125
  name: "🛡 audit",
117
126
  envMode: "none",
118
127
  job: __assign(__assign({}, base), {
119
128
  cache: undefined,
120
- script: ["yarn audit"],
129
+ script: (_d = (0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : ["yarn audit"],
121
130
  allow_failure: true
122
131
  })
123
- }, {
132
+ } : null;
133
+ var lintJob = buildConfig.lint !== false ? {
124
134
  name: "👮 lint",
125
135
  envMode: "none",
126
136
  job: __assign(__assign({}, base), {
127
- cache: (0, exports.getNodeCache)("pull-push"),
128
- script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ["yarn lint"], false)
137
+ cache: (0, exports.getNodeCache)(context),
138
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.lint) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["yarn lint"]), false)
129
139
  })
130
- }, {
140
+ } : null;
141
+ var testJob = buildConfig.test !== false ? {
131
142
  name: "🧪 test",
132
143
  envMode: "none",
133
144
  job: __assign(__assign({}, base), {
134
- cache: (0, exports.getNodeCache)("pull-push"),
135
- script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ["yarn test"], false)
145
+ cache: (0, exports.getNodeCache)(context),
146
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_h = (0, utils_1.ensureArray)((_g = buildConfig.test) === null || _g === void 0 ? void 0 : _g.command)) !== null && _h !== void 0 ? _h : ["yarn test"]), false)
136
147
  })
137
- }];
148
+ } : null;
149
+ return [auditJob, lintJob, testJob].filter(utils_1.notNil);
138
150
  };
139
151
 
140
152
  var createNodeBuildJobs = function (context) {
141
- var _a;
153
+ var _a, _b;
142
154
 
143
155
  var buildConfig = context.componentConfig.build;
144
156
 
@@ -154,12 +166,12 @@ var createNodeBuildJobs = function (context) {
154
166
  envMode: "jobPerEnv",
155
167
  job: {
156
168
  needs: [],
157
- cache: __spreadArray(__spreadArray([], __read((0, exports.getNodeCache)("pull")), false), __read(getNextCache(context)), false),
169
+ cache: __spreadArray(__spreadArray([], __read((0, exports.getNodeCache)(context)), false), __read(getNextCache(context)), false),
158
170
  variables: __assign(__assign(__assign({}, NODE_RUNNER_BUILD_VARIABLES), context.environment.envVars), (_a = context.componentConfig.build.extraVars) !== null && _a !== void 0 ? _a : {}),
159
171
  retry: baseRetry,
160
172
  interruptible: true,
161
173
  stage: "build",
162
- script: __spreadArray(__spreadArray(__spreadArray([], __read(buildInfo), false), __read(yarnInstall), false), __read(Array.isArray(buildConfig.buildCommand) ? buildConfig.buildCommand : [buildConfig.buildCommand]), false),
174
+ script: __spreadArray(__spreadArray(__spreadArray([], __read(buildInfo), false), __read(yarnInstall), false), __read((_b = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _b !== void 0 ? _b : []), false),
163
175
  artifacts: {
164
176
  paths: [context.componentConfig.dir + "/__build_info.json", context.componentConfig.dir + "/dist", context.componentConfig.dir + "/.next"]
165
177
  }
@@ -1,14 +1,42 @@
1
1
  export declare type BuildConfigBase = {
2
2
  startCommand?: string;
3
3
  extraVars?: Record<string, string>;
4
- };
5
- export declare type BuildConfigNodeBase = BuildConfigBase & {
4
+ /**
5
+ * define the build command
6
+ */
7
+
6
8
  buildCommand?: string | string[] | null;
9
+ /**
10
+ * customize docker build
11
+ */
12
+
7
13
  docker?: {
8
14
  additionsBegin?: string[];
9
15
  additionsEnd?: string[];
10
16
  };
17
+ /**
18
+ * customize lint, set false to disable
19
+ */
20
+
21
+ lint?: false | {
22
+ command?: string | string[];
23
+ };
24
+ /**
25
+ * customize test, set false to disable
26
+ */
27
+
28
+ test?: false | {
29
+ command?: string | string[];
30
+ };
31
+ /**
32
+ * customize audit, set false to disable
33
+ */
34
+
35
+ audit?: false | {
36
+ command?: string | string[];
37
+ };
11
38
  };
39
+ export declare type BuildConfigNodeBase = BuildConfigBase;
12
40
  export declare type BuildConfigNode = {
13
41
  type: "node";
14
42
  } & BuildConfigNodeBase;
package/dist/constants.js CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
5
- exports.PIPELINE_IMAGE_TAG = "main-ef2d95a2" || "";
5
+ exports.PIPELINE_IMAGE_TAG = "main-57e22cfd" || "";
6
6
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
@@ -1,4 +1,4 @@
1
1
  import { Config } from "../types/config";
2
- import { CommitInfo, Context, Environment } from "../types/context";
2
+ import { CommitInfo, Context, Environment, YarnInfo } from "../types/context";
3
3
  export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, skipReferences?: boolean) => Environment;
4
- export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined) => Context;
4
+ export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, yarnInfo?: YarnInfo | undefined) => Context;
@@ -107,13 +107,14 @@ var getEnvironment = function (config, componentName, env, commitInfo, skipRefer
107
107
  PORT: port.toString()
108
108
  };
109
109
  } else {
110
- var KUBE_APP_NAME = envType === "review" && commitInfo ? "".concat(componentName, "-").concat(commitInfo.refSlug) : componentName;
111
110
  var KUBE_NAMESPACE = "".concat(config.customerName, "-").concat(config.appName, "-").concat(env);
112
111
  var RELEASE_NAME = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
113
- var APP_SLUG = (0, slugify_1["default"])(KUBE_APP_NAME);
114
- var HOST_CANONICAL = "".concat(config.appName, "-").concat(APP_SLUG, ".").concat(env, ".").concat(config.customerName, ".panter.cloud");
112
+ var componentSlug = (0, slugify_1["default"])(componentName);
113
+ var envInUrl = envType === "review" && commitInfo ? "$".concat(commitInfo.refSlug, ".").concat(env) : env;
114
+ var HOST_CANONICAL = "".concat(config.appName, "-").concat(componentSlug, ".").concat(envInUrl, ".").concat(config.customerName, ".panter.cloud");
115
115
  hostname = (_e = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.hostname) !== null && _e !== void 0 ? _e : HOST_CANONICAL;
116
116
  var url_1 = "https://".concat(hostname);
117
+ var KUBE_APP_NAME = envType === "review" && commitInfo ? "".concat(componentName, "-").concat(commitInfo.refSlug) : componentName;
117
118
  predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
118
119
  HOST_CANONICAL: HOST_CANONICAL,
119
120
  ROOT_URL: url_1,
@@ -161,7 +162,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, skipRefer
161
162
 
162
163
  exports.getEnvironment = getEnvironment;
163
164
 
164
- var createContext = function (config, componentName, env, commitInfo) {
165
+ var createContext = function (config, componentName, env, commitInfo, yarnInfo) {
165
166
  var _a, _b;
166
167
 
167
168
  if (!/^[a-z0-9-]+$/.test(componentName)) {
@@ -191,7 +192,8 @@ var createContext = function (config, componentName, env, commitInfo) {
191
192
  componentConfig: componentConfig,
192
193
  componentName: componentName,
193
194
  environment: (0, exports.getEnvironment)(config, componentName, env, commitInfo),
194
- commitInfo: commitInfo
195
+ commitInfo: commitInfo,
196
+ yarnInfo: yarnInfo
195
197
  };
196
198
  };
197
199
 
@@ -207,27 +207,58 @@ var createChildPipeline = function (trigger, config) {
207
207
  return __awaiter(void 0, void 0, void 0, function () {
208
208
  var components, jobs, allEnvs, stages, childPipeline;
209
209
  return __generator(this, function (_a) {
210
- components = Object.keys(config.components);
211
- jobs = components.reduce(function (acc, componentName) {
212
- var envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
213
- return __assign(__assign({}, acc), (0, createJobs_1.createJobs)(envs, config, componentName, trigger));
214
- }, {});
215
- allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
216
- stages = baseStages.reduce(function (acc, baseStage) {
217
- return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
218
- return "".concat(baseStage, " ").concat(e);
219
- })), false);
220
- }, []);
221
- childPipeline = __assign({
222
- image: (0, runner_1.getRunnerImage)("jobs"),
223
- workflow: {
224
- rules: rules_1.RULES_ALWAYS
225
- },
226
- stages: stages
227
- }, jobs);
228
- return [2
229
- /*return*/
230
- , childPipeline];
210
+ switch (_a.label) {
211
+ case 0:
212
+ components = Object.keys(config.components);
213
+ return [4
214
+ /*yield*/
215
+ , components.reduce(function (acc, componentName) {
216
+ return __awaiter(void 0, void 0, void 0, function () {
217
+ var envs, _a, _b;
218
+
219
+ return __generator(this, function (_c) {
220
+ switch (_c.label) {
221
+ case 0:
222
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
223
+ _a = [{}];
224
+ return [4
225
+ /*yield*/
226
+ , acc];
227
+
228
+ case 1:
229
+ _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
230
+ return [4
231
+ /*yield*/
232
+ , (0, createJobs_1.createJobs)(envs, config, componentName, trigger)];
233
+
234
+ case 2:
235
+ return [2
236
+ /*return*/
237
+ , __assign.apply(void 0, _b.concat([_c.sent()]))];
238
+ }
239
+ });
240
+ });
241
+ }, Promise.resolve({}))];
242
+
243
+ case 1:
244
+ jobs = _a.sent();
245
+ allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
246
+ stages = baseStages.reduce(function (acc, baseStage) {
247
+ return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
248
+ return "".concat(baseStage, " ").concat(e);
249
+ })), false);
250
+ }, []);
251
+ childPipeline = __assign({
252
+ image: (0, runner_1.getRunnerImage)("jobs"),
253
+ workflow: {
254
+ rules: rules_1.RULES_ALWAYS
255
+ },
256
+ stages: stages
257
+ }, jobs);
258
+ return [2
259
+ /*return*/
260
+ , childPipeline];
261
+ }
231
262
  });
232
263
  });
233
264
  };
@@ -1,3 +1,3 @@
1
1
  import { Config, PipelineTrigger } from "../types/config";
2
2
  import { GitlabJobDef } from "../types/gitlab-types";
3
- export declare const createJobs: (envs: string[], config: Config, componentName: string, trigger: PipelineTrigger) => Record<string, GitlabJobDef>;
3
+ export declare const createJobs: (envs: string[], config: Config, componentName: string, trigger: PipelineTrigger) => Promise<Record<string, GitlabJobDef>>;
@@ -14,6 +14,147 @@ var __assign = this && this.__assign || function () {
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
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
+
17
158
  var __read = this && this.__read || function (o, n) {
18
159
  var m = typeof Symbol === "function" && o[Symbol.iterator];
19
160
  if (!m) return o;
@@ -60,6 +201,10 @@ var context_1 = require("../context");
60
201
 
61
202
  var deploy_1 = require("../deploy");
62
203
 
204
+ var utils_1 = require("../utils");
205
+
206
+ var yarnInfo_1 = require("./yarnInfo");
207
+
63
208
  var createRawJobs = function (context) {
64
209
  if (context.componentConfig.deploy === false) {
65
210
  return [];
@@ -113,11 +258,7 @@ var replaceReferences = function (job, componentName, env, allRawJobs) {
113
258
  return getFullReferencedJobName(n, componentName, env, allRawJobs);
114
259
  })
115
260
  });
116
- };
117
-
118
- function notNil(value) {
119
- return value !== null && value !== undefined;
120
- } // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
261
+ }; // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
121
262
 
122
263
 
123
264
  var addStageNeeds = function (jobs) {
@@ -142,7 +283,7 @@ var addStageNeeds = function (jobs) {
142
283
  artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
143
284
  };
144
285
  }
145
- }).filter(notNil);
286
+ }).filter(utils_1.notNil);
146
287
  return __assign(__assign({}, job), {
147
288
  job: __assign(__assign({}, job.job), {
148
289
  needs: __spreadArray(__spreadArray([], __read((_a = job.job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
@@ -152,22 +293,39 @@ var addStageNeeds = function (jobs) {
152
293
  };
153
294
 
154
295
  var createJobs = function (envs, config, componentName, trigger) {
155
- var _a, _b;
156
-
157
- var commitInfo = {
158
- refName: (_a = process.env.CI_COMMIT_REF_NAME) !== null && _a !== void 0 ? _a : "unknown",
159
- refSlug: (_b = process.env.CI_COMMIT_REF_SLUG) !== null && _b !== void 0 ? _b : "unknown",
160
- trigger: trigger
161
- };
162
- return envs.reduce(function (acc, env) {
163
- var context = (0, context_1.createContext)(config, componentName, env, commitInfo);
164
- var jobs = addStageNeeds(createRawJobs(context));
165
- return __assign(__assign({}, acc), jobs.reduce(function (acc, job) {
166
- var _a;
167
-
168
- return __assign(__assign({}, acc), (_a = {}, _a[getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined)] = replaceReferences(job, componentName, env, jobs), _a));
169
- }, {}));
170
- }, {});
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
+ });
171
329
  };
172
330
 
173
331
  exports.createJobs = createJobs;
@@ -0,0 +1,2 @@
1
+ import { Config, YarnInfo } from "../types";
2
+ export declare const getYarnInfo: (config: Config, componentName: string) => Promise<YarnInfo>;