@catladder/pipeline 1.149.2 → 1.149.4
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/build/base/createAppBuildJob.js +1 -2
- package/dist/build/base/writeDotEnv.d.ts +2 -1
- package/dist/build/base/writeDotEnv.js +7 -2
- package/dist/build/node/buildJob.js +4 -4
- package/dist/build/node/cache.js +5 -6
- package/dist/build/node/testJob.js +9 -9
- package/dist/build/node/yarn.js +3 -6
- package/dist/build/sbom.js +4 -4
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.d.ts +1 -2
- package/dist/context/createComponentContext.js +8 -4
- package/dist/pipeline/createAllJobs.js +75 -7
- package/dist/pipeline/createJobsForComponent.d.ts +3 -3
- package/dist/pipeline/createJobsForComponent.js +3 -143
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/context.d.ts +2 -2
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +5 -2
- package/src/build/base/writeDotEnv.ts +6 -0
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +3 -3
- package/src/build/node/testJob.ts +1 -1
- package/src/build/node/yarn.ts +3 -3
- package/src/build/sbom.ts +1 -1
- package/src/context/createComponentContext.ts +9 -4
- package/src/pipeline/createAllJobs.ts +44 -9
- package/src/pipeline/createJobsForComponent.ts +4 -25
- package/src/types/context.ts +2 -2
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-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "v1-149-4-4fb763a0" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { PipelineType } from "../types";
|
|
2
2
|
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
|
-
import type { ComponentContext
|
|
3
|
+
import type { ComponentContext } from "../types/context";
|
|
4
4
|
export type CreateComponentContextContext = {
|
|
5
5
|
config: Config;
|
|
6
6
|
componentName: string;
|
|
7
7
|
env: string;
|
|
8
8
|
pipelineType?: PipelineType;
|
|
9
9
|
trigger?: PipelineTrigger;
|
|
10
|
-
packageManagerInfo?: PackageManagerInfo;
|
|
11
10
|
};
|
|
12
11
|
export declare const createComponentContext: (ctx: CreateComponentContextContext) => Promise<ComponentContext>;
|
|
13
12
|
/**
|
|
@@ -135,15 +135,19 @@ var deploy_1 = require("../deploy");
|
|
|
135
135
|
var utils_1 = require("../utils");
|
|
136
136
|
var getEnvironment_1 = require("./getEnvironment");
|
|
137
137
|
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
138
|
+
var packageManager_1 = require("../pipeline/packageManager");
|
|
138
139
|
var createComponentContext = function (ctx) {
|
|
139
140
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
141
|
+
var packageManagerInfo, envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
141
142
|
return __generator(this, function (_a) {
|
|
142
143
|
switch (_a.label) {
|
|
143
144
|
case 0:
|
|
144
145
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
145
146
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
146
147
|
}
|
|
148
|
+
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(ctx.config, ctx.componentName)];
|
|
149
|
+
case 1:
|
|
150
|
+
packageManagerInfo = _a.sent();
|
|
147
151
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
148
152
|
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
149
153
|
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
@@ -155,7 +159,7 @@ var createComponentContext = function (ctx) {
|
|
|
155
159
|
};
|
|
156
160
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
157
161
|
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
158
|
-
case
|
|
162
|
+
case 2:
|
|
159
163
|
environment = _a.sent();
|
|
160
164
|
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
161
165
|
context = {
|
|
@@ -163,7 +167,7 @@ var createComponentContext = function (ctx) {
|
|
|
163
167
|
componentConfig: componentConfig,
|
|
164
168
|
build: {
|
|
165
169
|
dir: dir,
|
|
166
|
-
packageManagerInfo:
|
|
170
|
+
packageManagerInfo: packageManagerInfo,
|
|
167
171
|
config: build
|
|
168
172
|
},
|
|
169
173
|
deploy: deploy ? {
|
|
@@ -171,7 +175,7 @@ var createComponentContext = function (ctx) {
|
|
|
171
175
|
} : null,
|
|
172
176
|
componentName: ctx.componentName,
|
|
173
177
|
environment: environment,
|
|
174
|
-
packageManagerInfo:
|
|
178
|
+
packageManagerInfo: packageManagerInfo,
|
|
175
179
|
pipelineType: ctx.pipelineType,
|
|
176
180
|
trigger: ctx.trigger
|
|
177
181
|
};
|
|
@@ -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) {
|
|
@@ -115,13 +125,36 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
115
125
|
};
|
|
116
126
|
}
|
|
117
127
|
};
|
|
128
|
+
var __read = this && this.__read || function (o, n) {
|
|
129
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
130
|
+
if (!m) return o;
|
|
131
|
+
var i = m.call(o),
|
|
132
|
+
r,
|
|
133
|
+
ar = [],
|
|
134
|
+
e;
|
|
135
|
+
try {
|
|
136
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
e = {
|
|
139
|
+
error: error
|
|
140
|
+
};
|
|
141
|
+
} finally {
|
|
142
|
+
try {
|
|
143
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
144
|
+
} finally {
|
|
145
|
+
if (e) throw e.error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return ar;
|
|
149
|
+
};
|
|
118
150
|
Object.defineProperty(exports, "__esModule", {
|
|
119
151
|
value: true
|
|
120
152
|
});
|
|
121
153
|
exports.createAllJobs = void 0;
|
|
122
154
|
var config_1 = require("../config");
|
|
155
|
+
var context_1 = require("../context");
|
|
123
156
|
var createJobsForComponent_1 = require("./createJobsForComponent");
|
|
124
|
-
var
|
|
157
|
+
var createAllComponentContext = function (_a) {
|
|
125
158
|
return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
126
159
|
var _c, _d;
|
|
127
160
|
var config = _b.config,
|
|
@@ -142,12 +175,11 @@ var createAllJobs = function (_a) {
|
|
|
142
175
|
_c = (_b = Object).fromEntries;
|
|
143
176
|
return [4 /*yield*/, Promise.all(envs.map(function (env) {
|
|
144
177
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
-
var
|
|
146
|
-
return __generator(this, function (
|
|
147
|
-
switch (
|
|
178
|
+
var context;
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
switch (_a.label) {
|
|
148
181
|
case 0:
|
|
149
|
-
|
|
150
|
-
return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)({
|
|
182
|
+
return [4 /*yield*/, (0, context_1.createComponentContext)({
|
|
151
183
|
config: config,
|
|
152
184
|
componentName: componentName,
|
|
153
185
|
env: env,
|
|
@@ -155,7 +187,8 @@ var createAllJobs = function (_a) {
|
|
|
155
187
|
pipelineType: pipelineType
|
|
156
188
|
})];
|
|
157
189
|
case 1:
|
|
158
|
-
|
|
190
|
+
context = _a.sent();
|
|
191
|
+
return [2 /*return*/, [env, context]];
|
|
159
192
|
}
|
|
160
193
|
});
|
|
161
194
|
});
|
|
@@ -172,4 +205,39 @@ var createAllJobs = function (_a) {
|
|
|
172
205
|
});
|
|
173
206
|
});
|
|
174
207
|
};
|
|
208
|
+
var createAllJobs = function (_a) {
|
|
209
|
+
return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
210
|
+
var allComponentContext;
|
|
211
|
+
var config = _b.config,
|
|
212
|
+
trigger = _b.trigger,
|
|
213
|
+
pipelineType = _b.pipelineType;
|
|
214
|
+
return __generator(this, function (_c) {
|
|
215
|
+
switch (_c.label) {
|
|
216
|
+
case 0:
|
|
217
|
+
return [4 /*yield*/, createAllComponentContext({
|
|
218
|
+
config: config,
|
|
219
|
+
trigger: trigger,
|
|
220
|
+
pipelineType: pipelineType
|
|
221
|
+
})];
|
|
222
|
+
case 1:
|
|
223
|
+
allComponentContext = _c.sent();
|
|
224
|
+
return [2 /*return*/, Object.fromEntries(Object.entries(allComponentContext).map(function (_a) {
|
|
225
|
+
var _b = __read(_a, 2),
|
|
226
|
+
componentName = _b[0],
|
|
227
|
+
envs = _b[1];
|
|
228
|
+
return [componentName, Object.fromEntries(Object.entries(envs).map(function (_a) {
|
|
229
|
+
var _b = __read(_a, 2),
|
|
230
|
+
env = _b[0],
|
|
231
|
+
context = _b[1];
|
|
232
|
+
return [env, (0, createJobsForComponent_1.createJobsForComponentContext)(context).map(function (job) {
|
|
233
|
+
return __assign(__assign({}, job), {
|
|
234
|
+
context: context
|
|
235
|
+
});
|
|
236
|
+
})];
|
|
237
|
+
}))];
|
|
238
|
+
}))];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
};
|
|
175
243
|
exports.createAllJobs = createAllJobs;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export declare const
|
|
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,11 +52,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
167
52
|
Object.defineProperty(exports, "__esModule", {
|
|
168
53
|
value: true
|
|
169
54
|
});
|
|
170
|
-
exports.
|
|
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
|
-
var packageManager_1 = require("./packageManager");
|
|
175
58
|
var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
176
59
|
return jobs.map(function (_a) {
|
|
177
60
|
var _b;
|
|
@@ -189,34 +72,11 @@ var getCustomJobs = function (context) {
|
|
|
189
72
|
var rawJobs = context.customJobs;
|
|
190
73
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
191
74
|
};
|
|
192
|
-
var
|
|
75
|
+
var createJobsForComponentContext = function (context) {
|
|
193
76
|
var _a, _b;
|
|
194
77
|
var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
|
|
195
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) : [];
|
|
196
79
|
var customJobs = getCustomJobs(context);
|
|
197
80
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
198
81
|
};
|
|
199
|
-
|
|
200
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
201
|
-
var packageManagerInfo, context;
|
|
202
|
-
return __generator(this, function (_a) {
|
|
203
|
-
switch (_a.label) {
|
|
204
|
-
case 0:
|
|
205
|
-
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(contextContext.config, contextContext.componentName)];
|
|
206
|
-
case 1:
|
|
207
|
-
packageManagerInfo = _a.sent();
|
|
208
|
-
return [4 /*yield*/, (0, context_1.createComponentContext)(__assign(__assign({}, contextContext), {
|
|
209
|
-
packageManagerInfo: packageManagerInfo
|
|
210
|
-
}))];
|
|
211
|
-
case 2:
|
|
212
|
-
context = _a.sent();
|
|
213
|
-
return [2 /*return*/, createRawJobs(context).map(function (job) {
|
|
214
|
-
return __assign(__assign({}, job), {
|
|
215
|
-
context: context
|
|
216
|
-
});
|
|
217
|
-
})];
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
exports.createJobsForComponent = createJobsForComponent;
|
|
82
|
+
exports.createJobsForComponentContext = createJobsForComponentContext;
|