@catladder/pipeline 1.75.4 → 1.76.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 (112) hide show
  1. package/dist/build/base/createBuildJob.js +5 -27
  2. package/dist/build/base/writeBuildInfo.js +0 -3
  3. package/dist/build/custom/buildJob.js +3 -23
  4. package/dist/build/custom/index.js +3 -10
  5. package/dist/build/docker.js +5 -40
  6. package/dist/build/index.js +0 -8
  7. package/dist/build/node/buildJob.js +3 -25
  8. package/dist/build/node/cache.js +3 -21
  9. package/dist/build/node/index.js +3 -16
  10. package/dist/build/node/meteor.js +3 -20
  11. package/dist/build/node/testJob.js +5 -22
  12. package/dist/build/node/yarn.js +5 -18
  13. package/dist/build/rails/build.js +2 -8
  14. package/dist/build/rails/index.js +3 -11
  15. package/dist/build/rails/test.js +5 -18
  16. package/dist/build/types.d.ts +0 -9
  17. package/dist/build/types.js +0 -4
  18. package/dist/bundles/catladder-gitlab/index.js +1 -1
  19. package/dist/catladder-gitlab.js +6 -24
  20. package/dist/config/{configruedEnvs.test.d.ts → __tests__/configruedEnvs.test.d.ts} +0 -0
  21. package/dist/config/{configruedEnvs.test.js → __tests__/configruedEnvs.test.js} +10 -12
  22. package/dist/config/configruedEnvs.js +7 -22
  23. package/dist/config/index.js +0 -4
  24. package/dist/config/readConfig.js +2 -13
  25. package/dist/constants.js +1 -1
  26. package/dist/context/{resolveReferences.test.d.ts → __tests__/resolveReferences.test.d.ts} +0 -0
  27. package/dist/context/{resolveReferences.test.js → __tests__/resolveReferences.test.js} +52 -103
  28. package/dist/context/getEnvConfig.js +0 -8
  29. package/dist/context/getEnvType.js +0 -5
  30. package/dist/context/getEnvironment.js +13 -49
  31. package/dist/context/getEnvironmentContext.js +0 -5
  32. package/dist/context/getEnvironmentVariables.js +20 -83
  33. package/dist/context/getLabels.js +2 -13
  34. package/dist/context/index.js +13 -58
  35. package/dist/context/resolveReferences.js +36 -126
  36. package/dist/deploy/base.js +4 -19
  37. package/dist/deploy/cloudRun/deployJob.js +19 -61
  38. package/dist/deploy/cloudRun/index.js +17 -39
  39. package/dist/deploy/cloudRun/utils/database.js +11 -29
  40. package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +0 -4
  41. package/dist/deploy/cloudRun/utils/jobName.js +0 -2
  42. package/dist/deploy/custom/deployJob.js +3 -18
  43. package/dist/deploy/custom/index.js +0 -2
  44. package/dist/deploy/dockerTag/deployJob.js +0 -9
  45. package/dist/deploy/dockerTag/index.js +0 -2
  46. package/dist/deploy/index.js +0 -11
  47. package/dist/deploy/kubernetes/additionalSecretKeys.js +0 -9
  48. package/dist/deploy/kubernetes/cloudSql/index.js +0 -12
  49. package/dist/deploy/kubernetes/deployJob.js +3 -24
  50. package/dist/deploy/kubernetes/index.js +7 -17
  51. package/dist/deploy/kubernetes/kubeEnv.d.ts +0 -1
  52. package/dist/deploy/kubernetes/kubeEnv.js +5 -23
  53. package/dist/deploy/kubernetes/kubeValues.js +6 -24
  54. package/dist/deploy/kubernetes/mongodb.js +0 -24
  55. package/dist/deploy/kubernetes/processSecretsAsFiles.js +2 -10
  56. package/dist/deploy/types/base.d.ts +0 -1
  57. package/dist/deploy/types/custom.d.ts +0 -6
  58. package/dist/deploy/types/googleCloudRun.d.ts +4 -12
  59. package/dist/deploy/types/index.js +0 -10
  60. package/dist/deploy/types/kubernetes.d.ts +0 -28
  61. package/dist/deploy/utils.js +0 -11
  62. package/dist/index.js +0 -10
  63. package/dist/pipeline/commitInfo/getBuildId.d.ts +1 -0
  64. package/dist/pipeline/{createChildPipeline.test.js → commitInfo/getBuildId.js} +25 -84
  65. package/dist/pipeline/commitInfo/getCommitInfo.d.ts +2 -0
  66. package/dist/{build/tests/storybook.test.js → pipeline/commitInfo/getCommitInfo.js} +30 -104
  67. package/dist/pipeline/createChildPipeline.js +19 -76
  68. package/dist/pipeline/createJobs.js +35 -135
  69. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +1 -0
  70. package/dist/pipeline/gitlab/makeGitlabJob.js +13 -15
  71. package/dist/pipeline/index.js +0 -4
  72. package/dist/pipeline/packageManager.js +20 -173
  73. package/dist/pipeline/yarn/yarnUtils.d.ts +4 -0
  74. package/dist/pipeline/yarn/yarnUtils.js +193 -0
  75. package/dist/runner/index.js +0 -3
  76. package/dist/tsconfig.tsbuildinfo +1 -1
  77. package/dist/types/config.d.ts +0 -13
  78. package/dist/types/config.js +5 -15
  79. package/dist/types/context.d.ts +0 -2
  80. package/dist/types/environmentContext.d.ts +0 -1
  81. package/dist/types/gitlab-types.d.ts +0 -1
  82. package/dist/types/index.js +0 -6
  83. package/dist/types/jobs.d.ts +5 -15
  84. package/dist/utils/gitlab.js +3 -13
  85. package/dist/utils/index.js +5 -15
  86. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1765 -0
  87. package/examples/__snapshots__/custom-build-job.ts.snap +1174 -0
  88. package/examples/__snapshots__/custom-envs.ts.snap +261 -0
  89. package/examples/__snapshots__/wait-for-other-deploy.ts.snap +1626 -0
  90. package/examples/__utils__/helpers.ts +14 -0
  91. package/examples/{cloud-sql.ts → cloud-run-with-sql.ts} +12 -15
  92. package/examples/custom-build-job.ts +4 -1
  93. package/examples/custom-envs.ts +31 -0
  94. package/examples/wait-for-other-deploy.ts +36 -0
  95. package/package.json +2 -2
  96. package/src/config/{configruedEnvs.test.ts → __tests__/configruedEnvs.test.ts} +3 -3
  97. package/src/context/{resolveReferences.test.ts → __tests__/resolveReferences.test.ts} +3 -3
  98. package/src/deploy/cloudRun/index.ts +2 -1
  99. package/src/deploy/types/googleCloudRun.ts +5 -0
  100. package/src/pipeline/commitInfo/getBuildId.ts +6 -0
  101. package/src/pipeline/commitInfo/getCommitInfo.ts +12 -0
  102. package/src/pipeline/createChildPipeline.ts +6 -1
  103. package/src/pipeline/createJobs.ts +3 -10
  104. package/src/pipeline/gitlab/makeGitlabJob.ts +7 -1
  105. package/src/pipeline/packageManager.ts +4 -38
  106. package/src/pipeline/yarn/yarnUtils.ts +37 -0
  107. package/src/types/jobs.ts +2 -1
  108. package/tsconfig.json +1 -1
  109. package/dist/build/tests/storybook.test.d.ts +0 -1
  110. package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
  111. package/src/build/tests/storybook.test.ts +0 -54
  112. package/src/pipeline/createChildPipeline.test.ts +0 -49
@@ -4,23 +4,18 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
18
14
  function adopt(value) {
19
15
  return value instanceof P ? value : new P(function (resolve) {
20
16
  resolve(value);
21
17
  });
22
18
  }
23
-
24
19
  return new (P || (P = Promise))(function (resolve, reject) {
25
20
  function fulfilled(value) {
26
21
  try {
@@ -29,7 +24,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
29
24
  reject(e);
30
25
  }
31
26
  }
32
-
33
27
  function rejected(value) {
34
28
  try {
35
29
  step(generator["throw"](value));
@@ -37,29 +31,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
37
31
  reject(e);
38
32
  }
39
33
  }
40
-
41
34
  function step(result) {
42
35
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
43
36
  }
44
-
45
37
  step((generator = generator.apply(thisArg, _arguments || [])).next());
46
38
  });
47
39
  };
48
-
49
40
  var __generator = this && this.__generator || function (thisArg, body) {
50
41
  var _ = {
51
- label: 0,
52
- sent: function () {
53
- if (t[0] & 1) throw t[1];
54
- return t[1];
42
+ label: 0,
43
+ sent: function () {
44
+ if (t[0] & 1) throw t[1];
45
+ return t[1];
46
+ },
47
+ trys: [],
48
+ ops: []
55
49
  },
56
- trys: [],
57
- ops: []
58
- },
59
- f,
60
- y,
61
- t,
62
- g;
50
+ f,
51
+ y,
52
+ t,
53
+ g;
63
54
  return g = {
64
55
  next: verb(0),
65
56
  "throw": verb(1),
@@ -67,78 +58,59 @@ var __generator = this && this.__generator || function (thisArg, body) {
67
58
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
68
59
  return this;
69
60
  }), g;
70
-
71
61
  function verb(n) {
72
62
  return function (v) {
73
63
  return step([n, v]);
74
64
  };
75
65
  }
76
-
77
66
  function step(op) {
78
67
  if (f) throw new TypeError("Generator is already executing.");
79
-
80
68
  while (_) try {
81
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;
82
70
  if (y = 0, t) op = [op[0] & 2, t.value];
83
-
84
71
  switch (op[0]) {
85
72
  case 0:
86
73
  case 1:
87
74
  t = op;
88
75
  break;
89
-
90
76
  case 4:
91
77
  _.label++;
92
78
  return {
93
79
  value: op[1],
94
80
  done: false
95
81
  };
96
-
97
82
  case 5:
98
83
  _.label++;
99
84
  y = op[1];
100
85
  op = [0];
101
86
  continue;
102
-
103
87
  case 7:
104
88
  op = _.ops.pop();
105
-
106
89
  _.trys.pop();
107
-
108
90
  continue;
109
-
110
91
  default:
111
92
  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
112
93
  _ = 0;
113
94
  continue;
114
95
  }
115
-
116
96
  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
117
97
  _.label = op[1];
118
98
  break;
119
99
  }
120
-
121
100
  if (op[0] === 6 && _.label < t[1]) {
122
101
  _.label = t[1];
123
102
  t = op;
124
103
  break;
125
104
  }
126
-
127
105
  if (t && _.label < t[2]) {
128
106
  _.label = t[2];
129
-
130
107
  _.ops.push(op);
131
-
132
108
  break;
133
109
  }
134
-
135
110
  if (t[2]) _.ops.pop();
136
-
137
111
  _.trys.pop();
138
-
139
112
  continue;
140
113
  }
141
-
142
114
  op = body.call(thisArg, _);
143
115
  } catch (e) {
144
116
  op = [6, e];
@@ -146,7 +118,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
146
118
  } finally {
147
119
  f = t = 0;
148
120
  }
149
-
150
121
  if (op[0] & 5) throw op[1];
151
122
  return {
152
123
  value: op[0] ? op[1] : void 0,
@@ -154,26 +125,21 @@ var __generator = this && this.__generator || function (thisArg, body) {
154
125
  };
155
126
  }
156
127
  };
157
-
158
128
  var __rest = this && this.__rest || function (s, e) {
159
129
  var t = {};
160
-
161
130
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
162
-
163
131
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
164
132
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
165
133
  }
166
134
  return t;
167
135
  };
168
-
169
136
  var __read = this && this.__read || function (o, n) {
170
137
  var m = typeof Symbol === "function" && o[Symbol.iterator];
171
138
  if (!m) return o;
172
139
  var i = m.call(o),
173
- r,
174
- ar = [],
175
- e;
176
-
140
+ r,
141
+ ar = [],
142
+ e;
177
143
  try {
178
144
  while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
179
145
  } catch (error) {
@@ -187,10 +153,8 @@ var __read = this && this.__read || function (o, n) {
187
153
  if (e) throw e.error;
188
154
  }
189
155
  }
190
-
191
156
  return ar;
192
157
  };
193
-
194
158
  var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
195
159
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
196
160
  if (ar || !(i in from)) {
@@ -200,85 +164,62 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
200
164
  }
201
165
  return to.concat(ar || Array.prototype.slice.call(from));
202
166
  };
203
-
204
167
  exports.__esModule = true;
205
168
  exports.createJobs = void 0;
206
-
207
- var child_process_promise_1 = require("child-process-promise");
208
-
209
169
  var lodash_1 = require("lodash");
210
-
211
170
  var build_1 = require("../build");
212
-
213
171
  var context_1 = require("../context");
214
-
215
172
  var deploy_1 = require("../deploy");
216
-
217
173
  var utils_1 = require("../utils");
218
-
174
+ var getCommitInfo_1 = require("./commitInfo/getCommitInfo");
219
175
  var makeGitlabJob_1 = require("./gitlab/makeGitlabJob");
220
-
221
176
  var packageManager_1 = require("./packageManager");
222
-
223
177
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
224
178
  return jobs.map(function (_a) {
225
179
  var _b;
226
-
227
180
  var variables = _a.variables,
228
- job = __rest(_a, ["variables"]);
229
-
181
+ job = __rest(_a, ["variables"]);
230
182
  return __assign({
231
183
  variables: __assign(__assign({}, (_b = context.environment.envVars) !== null && _b !== void 0 ? _b : {}), variables !== null && variables !== void 0 ? variables : {})
232
184
  }, job);
233
185
  });
234
186
  };
235
-
236
187
  var getCustomJobs = function (context) {
237
188
  if (!context.componentConfig.customJobs) {
238
189
  return [];
239
190
  }
240
-
241
191
  var rawJobs = (0, lodash_1.isFunction)(context.componentConfig.customJobs) ? context.componentConfig.customJobs(context) : context.componentConfig.customJobs;
242
192
  return injectDefaultVarsInCustomJobs(context, rawJobs);
243
193
  };
244
-
245
194
  var createRawJobs = function (context) {
246
195
  if (context.componentConfig.deploy === false) {
247
196
  return [];
248
197
  }
249
-
250
198
  var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
251
199
  var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
252
200
  var customJobs = getCustomJobs(context);
253
201
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
254
202
  };
255
-
256
203
  var getFullJobName = function (name, componentName, env) {
257
204
  if (env) {
258
205
  return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
259
206
  }
260
-
261
207
  return "".concat(componentName, " ").concat(name);
262
208
  };
263
-
264
209
  var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
265
210
  var referencedJob = allRawJobs.find(function (j) {
266
211
  return j.name === referencedJobName;
267
212
  });
268
-
269
213
  if (!referencedJob) {
270
214
  throw new Error("unknown job referenced: " + referencedJobName);
271
215
  }
272
-
273
216
  var envToSet = referencedJob.envMode !== "none" ? env : null;
274
217
  return getFullJobName(referencedJobName, componentName, envToSet);
275
- }; // replaces references to other jobs with the full name
218
+ };
219
+ // replaces references to other jobs with the full name
276
220
  // the full name contains the componentname and the env name (if any)
277
-
278
-
279
221
  var replaceReferences = function (job, componentName, env, allRawJobs) {
280
222
  var _a, _b, _c;
281
-
282
223
  var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
283
224
  var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
284
225
  return (0, lodash_1.isObject)(n) ? {
@@ -292,9 +233,7 @@ var replaceReferences = function (job, componentName, env, allRawJobs) {
292
233
  job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
293
234
  };
294
235
  });
295
-
296
236
  var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
297
-
298
237
  return __assign(__assign({}, job), {
299
238
  stage: stage,
300
239
  needs: needs,
@@ -302,25 +241,20 @@ var replaceReferences = function (job, componentName, env, allRawJobs) {
302
241
  on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
303
242
  }) : job.environment
304
243
  });
305
- }; // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
306
-
307
-
244
+ };
245
+ // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
308
246
  var addStageNeeds = function (jobs) {
309
247
  // when a job defines needsStages, we add these as needs
310
248
  return jobs.map(function (job) {
311
249
  var _a;
312
-
313
250
  if (!job.needsStages || job.needsStages.length === 0) {
314
251
  return job;
315
252
  }
316
-
317
253
  var neededJobs = jobs.map(function (j) {
318
254
  var _a, _b;
319
-
320
255
  var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
321
256
  return j.stage === s.stage;
322
257
  });
323
-
324
258
  if (neededStage) {
325
259
  return {
326
260
  job: j.name,
@@ -333,82 +267,49 @@ var addStageNeeds = function (jobs) {
333
267
  });
334
268
  });
335
269
  };
336
-
337
270
  var createJobs = function (type, envs, config, componentName, trigger) {
338
271
  return __awaiter(void 0, void 0, void 0, function () {
339
- var commitInfo, packageManagerInfo;
340
-
341
- var _a;
342
-
343
- var _b;
344
-
345
- return __generator(this, function (_c) {
346
- switch (_c.label) {
272
+ var commitInfo, _a, packageManagerInfo;
273
+ return __generator(this, function (_b) {
274
+ switch (_b.label) {
347
275
  case 0:
348
- _a = {
349
- refName: (_b = process.env.CI_COMMIT_REF_NAME) !== null && _b !== void 0 ? _b : "unknown",
350
- reviewSlug: process.env.CI_MERGE_REQUEST_IID ? "mr".concat(process.env.CI_MERGE_REQUEST_IID) : "unknown",
351
- buildTime: new Date().toISOString()
352
- };
353
- return [4
354
- /*yield*/
355
- , (0, child_process_promise_1.exec)("git describe --tags || git rev-parse HEAD").then(function (s) {
356
- return s.stdout.trim();
357
- })];
358
-
276
+ _a = [{}];
277
+ return [4 /*yield*/, (0, getCommitInfo_1.getBaseCommitInfo)()];
359
278
  case 1:
360
- commitInfo = (_a.buildId = _c.sent(), _a.trigger = trigger, _a);
361
- return [4
362
- /*yield*/
363
- , (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
364
-
279
+ commitInfo = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), {
280
+ trigger: trigger
281
+ }]);
282
+ return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
365
283
  case 2:
366
- packageManagerInfo = _c.sent();
367
- return [2
368
- /*return*/
369
- , envs.reduce(function (acc, env) {
284
+ packageManagerInfo = _b.sent();
285
+ return [2 /*return*/, envs.reduce(function (acc, env) {
370
286
  return __awaiter(void 0, void 0, void 0, function () {
371
287
  var context, jobs, result, _a, _b, _c, _d, _e;
372
-
373
288
  return __generator(this, function (_f) {
374
289
  switch (_f.label) {
375
290
  case 0:
376
- return [4
377
- /*yield*/
378
- , (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
379
-
291
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
380
292
  case 1:
381
293
  context = _f.sent();
382
294
  jobs = addStageNeeds(createRawJobs(context));
383
295
  _a = [{}];
384
- return [4
385
- /*yield*/
386
- , acc];
387
-
296
+ return [4 /*yield*/, acc];
388
297
  case 2:
389
298
  _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
390
299
  _d = (_c = jobs).reduce;
391
300
  _e = [function (acc, job) {
392
301
  var _a;
393
-
394
302
  var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
395
303
  var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
396
-
397
304
  if (type === "gitlab") {
398
305
  return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
399
306
  }
400
-
401
307
  throw new Error("not supported");
402
308
  }];
403
- return [4
404
- /*yield*/
405
- , Promise.resolve({})];
406
-
309
+ return [4 /*yield*/, Promise.resolve({})];
407
310
  case 3:
408
311
  result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
409
- return [2
410
- /*return*/
411
- , result];
312
+ return [2 /*return*/, result];
412
313
  }
413
314
  });
414
315
  });
@@ -417,5 +318,4 @@ var createJobs = function (type, envs, config, componentName, trigger) {
417
318
  });
418
319
  });
419
320
  };
420
-
421
321
  exports.createJobs = createJobs;
@@ -5,5 +5,6 @@ export declare const makeGitlabJob: ({
5
5
  needsStages,
6
6
  needsOtherComponent,
7
7
  name,
8
+ needs,
8
9
  ...rest
9
10
  }: CatladderJob<string>) => GitlabJobDef;
@@ -4,43 +4,41 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  var __rest = this && this.__rest || function (s, e) {
18
14
  var t = {};
19
-
20
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
21
-
22
16
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
17
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
24
18
  }
25
19
  return t;
26
20
  };
27
-
28
21
  exports.__esModule = true;
29
22
  exports.makeGitlabJob = void 0;
30
-
23
+ var lodash_1 = require("lodash");
31
24
  var defaults_1 = require("../../defaults");
32
-
25
+ var getJobName = function (need) {
26
+ return (0, lodash_1.isObject)(need) ? need.job : need;
27
+ };
33
28
  var makeGitlabJob = function (_a) {
34
29
  var envMode = _a.envMode,
35
- needsStages = _a.needsStages,
36
- needsOtherComponent = _a.needsOtherComponent,
37
- name = _a.name,
38
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name"]);
39
-
30
+ needsStages = _a.needsStages,
31
+ needsOtherComponent = _a.needsOtherComponent,
32
+ name = _a.name,
33
+ needs = _a.needs,
34
+ rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
40
35
  return __assign(__assign({}, rest), {
36
+ // sort in a predictable manner for snapshot tests
37
+ needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
38
+ return getJobName(a).localeCompare(getJobName(b));
39
+ }),
41
40
  retry: defaults_1.BASE_RETRY,
42
41
  interruptible: true
43
42
  });
44
43
  };
45
-
46
44
  exports.makeGitlabJob = makeGitlabJob;
@@ -12,13 +12,9 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
12
12
  if (k2 === undefined) k2 = k;
13
13
  o[k2] = m[k];
14
14
  });
15
-
16
15
  var __exportStar = this && this.__exportStar || function (m, exports) {
17
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
17
  };
19
-
20
18
  exports.__esModule = true;
21
-
22
19
  __exportStar(require("./createChildPipeline"), exports);
23
-
24
20
  __exportStar(require("./createJobs"), exports);