@catladder/pipeline 1.41.2 → 1.41.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/bundles/catladder-gitlab/index.js +3 -3
- package/dist/constants.js +1 -1
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +310 -132
- package/dist/context/resolveReferences.d.ts +1 -3
- package/dist/context/resolveReferences.js +275 -26
- package/dist/context/resolveReferences.test.js +332 -81
- package/dist/deploy/cloudSql/index.d.ts +8 -0
- package/dist/deploy/cloudSql/index.js +30 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.js +2 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +5 -5
- package/dist/deploy/kubernetes/kubeValues.js +7 -5
- package/dist/pipeline/createJobs.js +45 -17
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/context/index.ts +8 -8
- package/src/context/resolveReferences.test.ts +15 -15
- package/src/context/resolveReferences.ts +37 -30
- package/src/deploy/cloudSql/index.ts +16 -0
- package/src/deploy/index.ts +1 -0
- package/src/deploy/kubernetes/kubeValues.ts +4 -4
- package/src/pipeline/createJobs.ts +4 -4
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 = "v1-41-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "v1-41-4-63707221" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
package/dist/context/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { Config } from "../types/config";
|
|
|
2
2
|
import type { CommitInfo, Context, Environment } from "../types/context";
|
|
3
3
|
export declare const getSecretVarName: (env: string, componentName: string, key: string) => string;
|
|
4
4
|
export declare const getSecretVarNameForContext: (context: Context, key: string) => string;
|
|
5
|
-
export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, alreadyVisited?: Record<string, Record<string, boolean>>) => Environment
|
|
6
|
-
export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, packageManagerInfo?: import("../types/context").YarnPackageManagerInfo | undefined) => Context
|
|
5
|
+
export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, alreadyVisited?: Record<string, Record<string, boolean>>) => Promise<Environment>;
|
|
6
|
+
export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, packageManagerInfo?: import("../types/context").YarnPackageManagerInfo | undefined) => Promise<Context>;
|
package/dist/context/index.js
CHANGED
|
@@ -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;
|
|
@@ -97,148 +238,185 @@ exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
|
97
238
|
|
|
98
239
|
var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
99
240
|
) {
|
|
100
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
101
|
-
|
|
102
241
|
if (alreadyVisited === void 0) {
|
|
103
242
|
alreadyVisited = {};
|
|
104
243
|
}
|
|
105
244
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
245
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
246
|
+
var defaultConfig, envConfig, mergedConfig, envType, basePredefinedVariables, environmentName, environmentSlug, predefinedVariables, host, url, devLocalConfig, port, RELEASE_NAME, componentSlug, envInUrl, domainCanonical, HOST_CANONICAL, url_1, KUBE_APP_NAME_PREFIX, KUBE_APP_NAME, KUBE_NAMESPACE, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
247
|
+
|
|
248
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
249
|
+
|
|
250
|
+
return __generator(this, function (_o) {
|
|
251
|
+
switch (_o.label) {
|
|
252
|
+
case 0:
|
|
253
|
+
defaultConfig = config.components[componentName];
|
|
254
|
+
|
|
255
|
+
if (!defaultConfig) {
|
|
256
|
+
throw new Error("unknown component " + componentName);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
envConfig = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
260
|
+
|
|
261
|
+
if (envConfig === false) {
|
|
262
|
+
throw new Error("env is disabled: " + env);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig);
|
|
266
|
+
envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
|
|
267
|
+
|
|
268
|
+
if (!envType) {
|
|
269
|
+
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
basePredefinedVariables = {
|
|
273
|
+
ENV_SHORT: env,
|
|
274
|
+
APP_DIR: mergedConfig.dir,
|
|
275
|
+
ENV_TYPE: envType
|
|
276
|
+
};
|
|
277
|
+
environmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
278
|
+
environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
279
|
+
|
|
280
|
+
if (envType === "local") {
|
|
281
|
+
devLocalConfig = mergedConfig;
|
|
282
|
+
port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
|
|
283
|
+
host = "localhost:" + port;
|
|
284
|
+
url = "http://" + host;
|
|
285
|
+
predefinedVariables = {
|
|
286
|
+
ENV_SHORT: "local",
|
|
287
|
+
ROOT_URL: url,
|
|
288
|
+
PORT: port.toString()
|
|
289
|
+
};
|
|
290
|
+
} else {
|
|
291
|
+
RELEASE_NAME = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
292
|
+
componentSlug = (0, slugify_1["default"])(componentName);
|
|
293
|
+
envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
|
|
294
|
+
domainCanonical = (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy) && (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy.type) === "kubernetes" && ((_e = mergedConfig.deploy.cluster) === null || _e === void 0 ? void 0 : _e.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
|
|
295
|
+
config.domainCanonical || "panter.cloud";
|
|
296
|
+
HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(config.appName, ".").concat(config.customerName, ".").concat(domainCanonical);
|
|
297
|
+
host = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.host) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
|
|
298
|
+
url_1 = "https://".concat(host);
|
|
299
|
+
KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
|
|
300
|
+
KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
|
|
301
|
+
KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
|
|
302
|
+
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
303
|
+
HOST_CANONICAL: HOST_CANONICAL,
|
|
304
|
+
HOST: host,
|
|
305
|
+
ROOT_URL: url_1,
|
|
306
|
+
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
307
|
+
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
308
|
+
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
309
|
+
RELEASE_NAME: RELEASE_NAME
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
|
|
314
|
+
additionalSecretKeys = mergedConfig.deploy ? deploy_1.DEPLOY_TYPES[mergedConfig.deploy.type].additionalSecretKeys( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
315
|
+
mergedConfig.deploy) : [];
|
|
316
|
+
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : []), false), __read(additionalSecretKeys), false);
|
|
317
|
+
secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
318
|
+
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
319
|
+
}));
|
|
320
|
+
legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
|
|
321
|
+
publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
322
|
+
publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
323
|
+
var _b = __read(_a, 2),
|
|
324
|
+
key = _b[0],
|
|
325
|
+
value = _b[1];
|
|
326
|
+
|
|
327
|
+
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
328
|
+
}));
|
|
329
|
+
envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
330
|
+
return [4
|
|
331
|
+
/*yield*/
|
|
332
|
+
, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName, alreadyVisited) {
|
|
333
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
334
|
+
var envVars;
|
|
335
|
+
return __generator(this, function (_a) {
|
|
336
|
+
switch (_a.label) {
|
|
337
|
+
case 0:
|
|
338
|
+
return [4
|
|
339
|
+
/*yield*/
|
|
340
|
+
, (0, exports.getEnvironment)(config, componentName, env, commitInfo, alreadyVisited)];
|
|
341
|
+
|
|
342
|
+
case 1:
|
|
343
|
+
envVars = _a.sent().envVars;
|
|
344
|
+
return [2
|
|
345
|
+
/*return*/
|
|
346
|
+
, envVars[variableName]];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}, alreadyVisited)];
|
|
351
|
+
|
|
352
|
+
case 1:
|
|
353
|
+
envVars = _o.sent();
|
|
354
|
+
return [2
|
|
355
|
+
/*return*/
|
|
356
|
+
, {
|
|
357
|
+
envType: envType,
|
|
358
|
+
host: host,
|
|
359
|
+
fullName: environmentName,
|
|
360
|
+
slug: environmentSlug,
|
|
361
|
+
shortName: env,
|
|
362
|
+
url: predefinedVariables.ROOT_URL,
|
|
363
|
+
envVars: envVars,
|
|
364
|
+
secretEnvVarKeys: secretEnvVarKeys
|
|
365
|
+
}];
|
|
366
|
+
}
|
|
168
367
|
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
var publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
|
|
172
|
-
var additionalSecretKeys = mergedConfig.deploy ? deploy_1.DEPLOY_TYPES[mergedConfig.deploy.type].additionalSecretKeys( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
-
mergedConfig.deploy) : [];
|
|
174
|
-
|
|
175
|
-
var secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : []), false), __read(additionalSecretKeys), false);
|
|
176
|
-
|
|
177
|
-
var secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
178
|
-
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
179
|
-
})); // this is deprecated, we now support: $componentname:FOO
|
|
180
|
-
|
|
181
|
-
var legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
|
|
182
|
-
var publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
183
|
-
var publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
184
|
-
var _b = __read(_a, 2),
|
|
185
|
-
key = _b[0],
|
|
186
|
-
value = _b[1];
|
|
187
|
-
|
|
188
|
-
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
189
|
-
}));
|
|
190
|
-
var envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
191
|
-
var envVars = (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName, alreadyVisited) {
|
|
192
|
-
var envVars = (0, exports.getEnvironment)(config, componentName, env, commitInfo, alreadyVisited).envVars;
|
|
193
|
-
return envVars[variableName];
|
|
194
|
-
}, alreadyVisited);
|
|
195
|
-
return {
|
|
196
|
-
envType: envType,
|
|
197
|
-
host: host,
|
|
198
|
-
fullName: environmentName,
|
|
199
|
-
slug: environmentSlug,
|
|
200
|
-
shortName: env,
|
|
201
|
-
url: predefinedVariables.ROOT_URL,
|
|
202
|
-
envVars: envVars,
|
|
203
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
204
|
-
};
|
|
368
|
+
});
|
|
205
369
|
};
|
|
206
370
|
|
|
207
371
|
exports.getEnvironment = getEnvironment;
|
|
208
372
|
|
|
209
373
|
var createContext = function (config, componentName, env, commitInfo, packageManagerInfo) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
374
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
375
|
+
var rawConfig, envConfig, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
376
|
+
|
|
377
|
+
var _a;
|
|
378
|
+
|
|
379
|
+
var _b, _c;
|
|
380
|
+
|
|
381
|
+
return __generator(this, function (_d) {
|
|
382
|
+
switch (_d.label) {
|
|
383
|
+
case 0:
|
|
384
|
+
if (!/^[a-z0-9-]+$/.test(componentName)) {
|
|
385
|
+
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
rawConfig = config.components[componentName];
|
|
389
|
+
|
|
390
|
+
if (!rawConfig) {
|
|
391
|
+
throw new Error("unknown component " + componentName);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
envConfig = (_c = (_b = rawConfig.env) === null || _b === void 0 ? void 0 : _b[env]) !== null && _c !== void 0 ? _c : {};
|
|
395
|
+
componentConfigWithoutDefaults = (0, utils_1.mergeWithMergingArrays)(rawConfig, envConfig);
|
|
396
|
+
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
397
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(),
|
|
398
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults()
|
|
399
|
+
} : {
|
|
400
|
+
build: {},
|
|
401
|
+
deploy: {}
|
|
402
|
+
};
|
|
403
|
+
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
404
|
+
_a = {
|
|
405
|
+
fullConfig: config,
|
|
406
|
+
componentConfig: componentConfig,
|
|
407
|
+
componentName: componentName
|
|
408
|
+
};
|
|
409
|
+
return [4
|
|
410
|
+
/*yield*/
|
|
411
|
+
, (0, exports.getEnvironment)(config, componentName, env, commitInfo)];
|
|
412
|
+
|
|
413
|
+
case 1:
|
|
414
|
+
return [2
|
|
415
|
+
/*return*/
|
|
416
|
+
, (_a.environment = _d.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
});
|
|
242
420
|
};
|
|
243
421
|
|
|
244
422
|
exports.createContext = createContext;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const resolveReferences: (vars: Record<string, string>, getOtherVariables?: ((componentName: string, variableName: string, alreadyVisited: Record<string, Record<string, boolean>>) => string | null) | undefined, alreadyVisitedBase?: Record<string, Record<string, boolean>>) =>
|
|
2
|
-
[k: string]: string;
|
|
3
|
-
};
|
|
1
|
+
export declare const resolveReferences: (vars: Record<string, string>, getOtherVariables?: ((componentName: string, variableName: string, alreadyVisited: Record<string, Record<string, boolean>>) => Promise<string | null>) | undefined, alreadyVisitedBase?: Record<string, Record<string, boolean>>) => Promise<Record<string, string>>;
|
|
4
2
|
export declare const translateLegacyFromComponents: (fromComponents: Record<string, Record<string, string>>) => {
|
|
5
3
|
[k: string]: string;
|
|
6
4
|
};
|