@catladder/pipeline 1.149.3 → 1.150.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.
package/dist/constants.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
7
- exports.PIPELINE_IMAGE_TAG = "v1-149-3-26c67bb0" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "v1-150-0-019658c9" || "latest";
8
8
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
@@ -72,6 +72,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
72
72
  "cpu-throttling": (customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling) !== true,
73
73
  cpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.cpu,
74
74
  memory: customConfig === null || customConfig === void 0 ? void 0 : customConfig.memory,
75
+ timeout: customConfig === null || customConfig === void 0 ? void 0 : customConfig.timeout,
75
76
  "allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
76
77
  ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
77
78
  "cpu-boost": true,
@@ -89,6 +89,14 @@ export type DeployConfigCloudRunService = {
89
89
  * memory limit. Defaults to 512MB
90
90
  */
91
91
  memory?: Memory;
92
+ /**
93
+ * timeout of the service, defaults to 5 minutes.
94
+ *
95
+ * you can specify something like 10m30s. if its just a number, it will be interpreted as seconds
96
+ *
97
+ * max supported is 60min
98
+ */
99
+ timeout?: string;
92
100
  /**
93
101
  *
94
102
  * set the execution environment.
@@ -1,5 +1,15 @@
1
1
  "use strict";
2
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
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
3
13
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
14
  function adopt(value) {
5
15
  return value instanceof P ? value : new P(function (resolve) {
@@ -120,54 +130,79 @@ Object.defineProperty(exports, "__esModule", {
120
130
  });
121
131
  exports.createAllJobs = void 0;
122
132
  var config_1 = require("../config");
133
+ var context_1 = require("../context");
123
134
  var createJobsForComponent_1 = require("./createJobsForComponent");
124
- var createAllJobs = function (_a) {
135
+ var createAllComponentContext = function (_a) {
125
136
  return __awaiter(void 0, [_a], void 0, function (_b) {
126
- var _c, _d;
127
137
  var config = _b.config,
128
138
  trigger = _b.trigger,
129
139
  pipelineType = _b.pipelineType;
130
- return __generator(this, function (_e) {
131
- switch (_e.label) {
140
+ return __generator(this, function (_c) {
141
+ switch (_c.label) {
132
142
  case 0:
133
- _d = (_c = Object).fromEntries;
134
- return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
135
- return __awaiter(void 0, void 0, void 0, function () {
136
- var envs, _a, _b, _c;
137
- return __generator(this, function (_d) {
138
- switch (_d.label) {
139
- case 0:
140
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
141
- _a = [componentName];
142
- _c = (_b = Object).fromEntries;
143
- return [4 /*yield*/, Promise.all(envs.map(function (env) {
144
- return __awaiter(void 0, void 0, void 0, function () {
145
- var _a;
146
- return __generator(this, function (_b) {
147
- switch (_b.label) {
148
- case 0:
149
- _a = [env];
150
- return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)({
151
- config: config,
152
- componentName: componentName,
153
- env: env,
154
- trigger: trigger,
155
- pipelineType: pipelineType
156
- })];
157
- case 1:
158
- return [2 /*return*/, _a.concat([_b.sent()])];
159
- }
160
- });
161
- });
162
- }))];
163
- case 1:
164
- return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
165
- }
143
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
144
+ var envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
145
+ return envs.map(function (env) {
146
+ return __awaiter(void 0, void 0, void 0, function () {
147
+ var context;
148
+ return __generator(this, function (_a) {
149
+ switch (_a.label) {
150
+ case 0:
151
+ return [4 /*yield*/, (0, context_1.createComponentContext)({
152
+ config: config,
153
+ componentName: componentName,
154
+ env: env,
155
+ trigger: trigger,
156
+ pipelineType: pipelineType
157
+ })];
158
+ case 1:
159
+ context = _a.sent();
160
+ return [2 /*return*/, {
161
+ env: env,
162
+ componentName: componentName,
163
+ context: context
164
+ }];
165
+ }
166
+ });
166
167
  });
167
168
  });
168
169
  }))];
169
170
  case 1:
170
- return [2 /*return*/, _d.apply(_c, [_e.sent()])];
171
+ return [2 /*return*/, _c.sent()];
172
+ }
173
+ });
174
+ });
175
+ };
176
+ var createAllJobs = function (_a) {
177
+ return __awaiter(void 0, [_a], void 0, function (_b) {
178
+ var allComponentContext;
179
+ var config = _b.config,
180
+ trigger = _b.trigger,
181
+ pipelineType = _b.pipelineType;
182
+ return __generator(this, function (_c) {
183
+ switch (_c.label) {
184
+ case 0:
185
+ return [4 /*yield*/, createAllComponentContext({
186
+ config: config,
187
+ trigger: trigger,
188
+ pipelineType: pipelineType
189
+ })];
190
+ case 1:
191
+ allComponentContext = _c.sent();
192
+ return [2 /*return*/, allComponentContext.reduce(function (acc, _a) {
193
+ var componentName = _a.componentName,
194
+ env = _a.env,
195
+ context = _a.context;
196
+ if (!acc[componentName]) {
197
+ acc[componentName] = {};
198
+ }
199
+ acc[componentName][env] = (0, createJobsForComponent_1.createJobsForComponentContext)(context).map(function (job) {
200
+ return __assign(__assign({}, job), {
201
+ context: context
202
+ });
203
+ });
204
+ return acc;
205
+ }, {})];
171
206
  }
172
207
  });
173
208
  });
@@ -1,3 +1,3 @@
1
- import type { CreateComponentContextContext } from "../context";
2
- import type { CatladderJobWithContext } from "../types/context";
3
- export declare const createJobsForComponent: (contextContext: CreateComponentContextContext) => Promise<Array<CatladderJobWithContext>>;
1
+ import type { ComponentContext } from "../types/context";
2
+ import type { CatladderJob } from "../types/jobs";
3
+ export declare const createJobsForComponentContext: (context: ComponentContext) => CatladderJob[];
@@ -10,121 +10,6 @@ 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
- };
128
13
  var __rest = this && this.__rest || function (s, e) {
129
14
  var t = {};
130
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -167,9 +52,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
167
52
  Object.defineProperty(exports, "__esModule", {
168
53
  value: true
169
54
  });
170
- exports.createJobsForComponent = void 0;
55
+ exports.createJobsForComponentContext = void 0;
171
56
  var build_1 = require("../build");
172
- var context_1 = require("../context");
173
57
  var deploy_1 = require("../deploy");
174
58
  var injectDefaultVarsInCustomJobs = function (context, jobs) {
175
59
  return jobs.map(function (_a) {
@@ -188,29 +72,11 @@ var getCustomJobs = function (context) {
188
72
  var rawJobs = context.customJobs;
189
73
  return injectDefaultVarsInCustomJobs(context, rawJobs);
190
74
  };
191
- var createRawJobs = function (context) {
75
+ var createJobsForComponentContext = function (context) {
192
76
  var _a, _b;
193
77
  var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
194
78
  var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config) ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context) : [];
195
79
  var customJobs = getCustomJobs(context);
196
80
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
197
81
  };
198
- var createJobsForComponent = function (contextContext) {
199
- return __awaiter(void 0, void 0, void 0, function () {
200
- var context;
201
- return __generator(this, function (_a) {
202
- switch (_a.label) {
203
- case 0:
204
- return [4 /*yield*/, (0, context_1.createComponentContext)(contextContext)];
205
- case 1:
206
- context = _a.sent();
207
- return [2 /*return*/, createRawJobs(context).map(function (job) {
208
- return __assign(__assign({}, job), {
209
- context: context
210
- });
211
- })];
212
- }
213
- });
214
- });
215
- };
216
- exports.createJobsForComponent = createJobsForComponent;
82
+ exports.createJobsForComponentContext = createJobsForComponentContext;