@catladder/pipeline 0.0.0-node16-ddfae617 → 0.0.0-refactor-env-context-9e652b63
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/bin/catladder-gitlab.js +1 -1
- package/dist/build/base/createBuildJob.d.ts +2 -2
- package/dist/build/base/getBuildInfo.d.ts +1 -1
- package/dist/build/docker.d.ts +44 -6
- package/dist/build/docker.js +45 -19
- package/dist/build/index.d.ts +6 -5
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/cache.d.ts +2 -2
- package/dist/build/node/index.d.ts +1 -1
- package/dist/build/node/meteor.d.ts +1 -1
- package/dist/build/node/meteor.js +6 -0
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +3 -0
- package/dist/build/node/yarn.d.ts +1 -1
- package/dist/build/node/yarn.js +13 -1
- package/dist/build/types.d.ts +10 -0
- package/dist/bundles/catladder-gitlab/index.js +32457 -0
- package/dist/catladder-gitlab.js +1 -2
- package/dist/config/configruedEnvs.d.ts +1 -1
- package/dist/config/readConfig.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/context/getEnvConfig.d.ts +9 -0
- package/dist/context/getEnvConfig.js +26 -0
- package/dist/context/getEnvType.d.ts +4 -0
- package/dist/context/getEnvType.js +18 -0
- package/dist/context/getEnvironment.d.ts +3 -0
- package/dist/context/getEnvironment.js +187 -0
- package/dist/context/getEnvironmentContext.d.ts +4 -0
- package/dist/context/getEnvironmentContext.js +36 -0
- package/dist/context/getEnvironmentVariables.d.ts +10 -0
- package/dist/context/getEnvironmentVariables.js +322 -0
- package/dist/context/getLabels.d.ts +8 -0
- package/dist/context/getLabels.js +49 -0
- package/dist/context/index.d.ts +5 -6
- package/dist/context/index.js +176 -181
- 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/defaults/index.d.ts +1 -1
- package/dist/deploy/base.d.ts +4 -2
- package/dist/deploy/base.js +37 -17
- package/dist/deploy/cloudRun/deployJob.d.ts +3 -0
- package/dist/deploy/cloudRun/deployJob.js +139 -0
- package/dist/deploy/cloudRun/index.d.ts +9 -0
- package/dist/deploy/cloudRun/index.js +56 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +14 -0
- package/dist/deploy/cloudSql/index.d.ts +8 -0
- package/dist/deploy/cloudSql/index.js +30 -0
- package/dist/deploy/custom/deployJob.d.ts +2 -2
- package/dist/deploy/custom/deployJob.js +4 -1
- package/dist/deploy/custom/index.d.ts +2 -1
- package/dist/deploy/custom/index.js +15 -18
- package/dist/deploy/dockerTag/deployJob.d.ts +3 -0
- package/dist/deploy/dockerTag/deployJob.js +33 -0
- package/dist/deploy/dockerTag/index.d.ts +2 -0
- package/dist/deploy/dockerTag/index.js +19 -0
- package/dist/deploy/index.d.ts +12 -8
- package/dist/deploy/index.js +27 -14
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +4 -0
- package/dist/deploy/kubernetes/additionalSecretKeys.js +33 -0
- package/dist/deploy/kubernetes/cloudsql.d.ts +1 -1
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.js +13 -66
- package/dist/deploy/kubernetes/index.d.ts +2 -1
- package/dist/deploy/kubernetes/index.js +45 -16
- package/dist/deploy/kubernetes/kubeEnv.d.ts +10 -0
- package/dist/deploy/kubernetes/kubeEnv.js +90 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +90 -0
- package/dist/deploy/kubernetes/kubeValues.js +96 -0
- package/dist/deploy/kubernetes/mongodb.d.ts +18 -5
- package/dist/deploy/kubernetes/mongodb.js +118 -8
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +21 -21
- package/dist/deploy/types/base.d.ts +15 -0
- package/dist/deploy/types/base.js +3 -0
- package/dist/deploy/types/custom.d.ts +27 -0
- package/dist/deploy/types/custom.js +3 -0
- package/dist/deploy/types/dockerTag.d.ts +10 -0
- package/dist/deploy/types/dockerTag.js +3 -0
- package/dist/deploy/types/googleCloudRun.d.ts +39 -0
- package/dist/deploy/types/googleCloudRun.js +3 -0
- package/dist/deploy/types/index.d.ts +24 -0
- package/dist/deploy/types/index.js +41 -0
- package/dist/deploy/{types.d.ts → types/kubernetes.d.ts} +128 -36
- package/dist/deploy/types/kubernetes.js +3 -0
- package/dist/deploy/utils.d.ts +2 -2
- package/dist/deploy/utils.js +4 -0
- package/dist/pipeline/createChildPipeline.d.ts +2 -2
- package/dist/pipeline/createChildPipeline.js +3 -3
- package/dist/pipeline/createJobs.d.ts +2 -2
- package/dist/pipeline/createJobs.js +63 -25
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +3 -2
- package/dist/pipeline/gitlab/makeGitlabJob.js +2 -1
- package/dist/pipeline/packageManager.d.ts +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/runner/index.d.ts +2 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +7 -6
- package/dist/types/config.js +1 -1
- package/dist/types/context.d.ts +10 -2
- package/dist/types/environmentContext.d.ts +22 -0
- package/dist/types/environmentContext.js +3 -0
- package/dist/types/gitlab-types.d.ts +1 -1
- package/dist/types/jobs.d.ts +8 -3
- package/dist/types/jobs.js +1 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/package.json +15 -11
- package/scripts/bundle +2 -0
- package/src/build/base/createBuildJob.ts +3 -2
- package/src/build/base/getBuildInfo.ts +1 -1
- package/src/build/docker.ts +47 -29
- package/src/build/index.ts +8 -5
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +2 -2
- package/src/build/node/index.ts +1 -1
- package/src/build/node/meteor.ts +8 -2
- package/src/build/node/testJob.ts +4 -2
- package/src/build/node/yarn.ts +21 -10
- package/src/build/tests/storybook.test.ts +1 -1
- package/src/build/types.ts +13 -1
- package/src/catladder-gitlab.ts +4 -2
- package/src/config/configruedEnvs.test.ts +2 -2
- package/src/config/configruedEnvs.ts +5 -4
- package/src/config/readConfig.ts +1 -1
- package/src/context/getEnvConfig.ts +21 -0
- package/src/context/getEnvType.ts +17 -0
- package/src/context/getEnvironment.ts +40 -0
- package/src/context/getEnvironmentContext.ts +57 -0
- package/src/context/getEnvironmentVariables.ts +152 -0
- package/src/context/getLabels.ts +20 -0
- package/src/context/index.ts +25 -191
- package/src/context/resolveReferences.test.ts +15 -15
- package/src/context/resolveReferences.ts +37 -30
- package/src/defaults/index.ts +1 -1
- package/src/deploy/base.ts +43 -19
- package/src/deploy/cloudRun/deployJob.ts +104 -0
- package/src/deploy/cloudRun/index.ts +48 -0
- package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +14 -0
- package/src/deploy/cloudSql/index.ts +16 -0
- package/src/deploy/custom/deployJob.ts +10 -3
- package/src/deploy/custom/index.ts +9 -1
- package/src/deploy/dockerTag/deployJob.ts +31 -0
- package/src/deploy/dockerTag/index.ts +9 -0
- package/src/deploy/index.ts +26 -17
- package/src/deploy/kubernetes/additionalSecretKeys.ts +23 -0
- package/src/deploy/kubernetes/cloudsql.ts +2 -1
- package/src/deploy/kubernetes/deployJob.ts +19 -77
- package/src/deploy/kubernetes/index.ts +42 -1
- package/src/deploy/kubernetes/kubeEnv.ts +48 -0
- package/src/deploy/kubernetes/kubeValues.ts +82 -0
- package/src/deploy/kubernetes/mongodb.ts +104 -7
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +1 -1
- package/src/deploy/types/base.ts +17 -0
- package/src/deploy/types/custom.ts +24 -0
- package/src/deploy/types/dockerTag.ts +12 -0
- package/src/deploy/types/googleCloudRun.ts +79 -0
- package/src/deploy/types/index.ts +28 -0
- package/src/deploy/types/kubernetes.ts +281 -0
- package/src/deploy/utils.ts +6 -2
- package/src/pipeline/createChildPipeline.test.ts +1 -1
- package/src/pipeline/createChildPipeline.ts +4 -4
- package/src/pipeline/createJobs.ts +32 -21
- package/src/pipeline/gitlab/makeGitlabJob.ts +3 -2
- package/src/pipeline/packageManager.ts +1 -1
- package/src/rules/index.ts +1 -1
- package/src/runner/index.ts +2 -1
- package/src/types/config.ts +8 -6
- package/src/types/context.ts +14 -2
- package/src/types/environmentContext.ts +26 -0
- package/src/types/gitlab-types.ts +1 -1
- package/src/types/jobs.ts +9 -2
- package/src/types/pipeline.ts +1 -1
- package/tsconfig.json +2 -0
- package/dist/deploy/types.js +0 -16
- package/src/deploy/types.ts +0 -189
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
8
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
18
|
+
return mod && mod.__esModule ? mod : {
|
|
19
|
+
"default": mod
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.__esModule = true;
|
|
24
|
+
exports.getLabels = void 0;
|
|
25
|
+
|
|
26
|
+
var slugify_1 = __importDefault(require("slugify"));
|
|
27
|
+
|
|
28
|
+
var sanitize = function (value) {
|
|
29
|
+
if (!value) return value; //"The value can only contain lowercase letters, numeric characters, underscores and dashes. The value can be at most 63 characters long. International characters are allowed."
|
|
30
|
+
// slugify should do the job
|
|
31
|
+
|
|
32
|
+
return (0, slugify_1["default"])(value).toLowerCase();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var getLabels = function (context) {
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
|
|
38
|
+
var labels = __assign({
|
|
39
|
+
"customer-name": sanitize(context.fullConfig.customerName),
|
|
40
|
+
"app-name": sanitize(context.fullConfig.appName),
|
|
41
|
+
"env-type": sanitize(context.environment.envType),
|
|
42
|
+
"env-name": sanitize(context.environment.shortName),
|
|
43
|
+
"build-type": sanitize((_a = context.componentConfig.build) === null || _a === void 0 ? void 0 : _a.type)
|
|
44
|
+
}, (_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {});
|
|
45
|
+
|
|
46
|
+
return labels;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.getLabels = getLabels;
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Config } from "../types/config";
|
|
2
|
-
import { CommitInfo, Context
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, packageManagerInfo?: import("../types/context").YarnPackageManagerInfo | undefined) => Context;
|
|
1
|
+
import type { Config } from "../types/config";
|
|
2
|
+
import type { CommitInfo, Context } from "../types/context";
|
|
3
|
+
export * from "./getEnvironment";
|
|
4
|
+
export * from "./getEnvironmentVariables";
|
|
5
|
+
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
|
@@ -1,224 +1,219 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
Object.defineProperty(o, k2, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return m[k];
|
|
9
9
|
}
|
|
10
|
+
});
|
|
11
|
+
} : function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
21
|
+
function adopt(value) {
|
|
22
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
23
|
+
resolve(value);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
13
26
|
|
|
14
|
-
return
|
|
15
|
-
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) {
|
|
29
|
+
try {
|
|
30
|
+
step(generator.next(value));
|
|
31
|
+
} catch (e) {
|
|
32
|
+
reject(e);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
16
35
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
e;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
e = {
|
|
29
|
-
error: error
|
|
30
|
-
};
|
|
31
|
-
} finally {
|
|
32
|
-
try {
|
|
33
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
-
} finally {
|
|
35
|
-
if (e) throw e.error;
|
|
36
|
+
function rejected(value) {
|
|
37
|
+
try {
|
|
38
|
+
step(generator["throw"](value));
|
|
39
|
+
} catch (e) {
|
|
40
|
+
reject(e);
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
|
-
}
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
function step(result) {
|
|
45
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
46
|
+
}
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"default": mod
|
|
45
|
-
};
|
|
48
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
49
|
+
});
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
53
|
+
var _ = {
|
|
54
|
+
label: 0,
|
|
55
|
+
sent: function () {
|
|
56
|
+
if (t[0] & 1) throw t[1];
|
|
57
|
+
return t[1];
|
|
58
|
+
},
|
|
59
|
+
trys: [],
|
|
60
|
+
ops: []
|
|
61
|
+
},
|
|
62
|
+
f,
|
|
63
|
+
y,
|
|
64
|
+
t,
|
|
65
|
+
g;
|
|
66
|
+
return g = {
|
|
67
|
+
next: verb(0),
|
|
68
|
+
"throw": verb(1),
|
|
69
|
+
"return": verb(2)
|
|
70
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
71
|
+
return this;
|
|
72
|
+
}), g;
|
|
73
|
+
|
|
74
|
+
function verb(n) {
|
|
75
|
+
return function (v) {
|
|
76
|
+
return step([n, v]);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
50
79
|
|
|
51
|
-
|
|
80
|
+
function step(op) {
|
|
81
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
52
82
|
|
|
53
|
-
|
|
83
|
+
while (_) try {
|
|
84
|
+
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;
|
|
85
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
86
|
|
|
55
|
-
|
|
87
|
+
switch (op[0]) {
|
|
88
|
+
case 0:
|
|
89
|
+
case 1:
|
|
90
|
+
t = op;
|
|
91
|
+
break;
|
|
56
92
|
|
|
57
|
-
|
|
93
|
+
case 4:
|
|
94
|
+
_.label++;
|
|
95
|
+
return {
|
|
96
|
+
value: op[1],
|
|
97
|
+
done: false
|
|
98
|
+
};
|
|
58
99
|
|
|
59
|
-
|
|
100
|
+
case 5:
|
|
101
|
+
_.label++;
|
|
102
|
+
y = op[1];
|
|
103
|
+
op = [0];
|
|
104
|
+
continue;
|
|
60
105
|
|
|
61
|
-
|
|
106
|
+
case 7:
|
|
107
|
+
op = _.ops.pop();
|
|
62
108
|
|
|
63
|
-
|
|
109
|
+
_.trys.pop();
|
|
64
110
|
|
|
65
|
-
|
|
66
|
-
return s.replace(/-/g, "_");
|
|
67
|
-
};
|
|
111
|
+
continue;
|
|
68
112
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
113
|
+
default:
|
|
114
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
115
|
+
_ = 0;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
72
118
|
|
|
119
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
120
|
+
_.label = op[1];
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
73
123
|
|
|
74
|
-
|
|
124
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
125
|
+
_.label = t[1];
|
|
126
|
+
t = op;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
75
129
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
130
|
+
if (t && _.label < t[2]) {
|
|
131
|
+
_.label = t[2];
|
|
79
132
|
|
|
80
|
-
|
|
133
|
+
_.ops.push(op);
|
|
81
134
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
85
137
|
|
|
86
|
-
|
|
87
|
-
alreadyVisited = {};
|
|
88
|
-
}
|
|
138
|
+
if (t[2]) _.ops.pop();
|
|
89
139
|
|
|
90
|
-
|
|
140
|
+
_.trys.pop();
|
|
91
141
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
95
144
|
|
|
96
|
-
|
|
97
|
-
|
|
145
|
+
op = body.call(thisArg, _);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
op = [6, e];
|
|
148
|
+
y = 0;
|
|
149
|
+
} finally {
|
|
150
|
+
f = t = 0;
|
|
151
|
+
}
|
|
98
152
|
|
|
99
|
-
|
|
100
|
-
|
|
153
|
+
if (op[0] & 5) throw op[1];
|
|
154
|
+
return {
|
|
155
|
+
value: op[0] ? op[1] : void 0,
|
|
156
|
+
done: true
|
|
157
|
+
};
|
|
101
158
|
}
|
|
159
|
+
};
|
|
102
160
|
|
|
103
|
-
|
|
161
|
+
exports.__esModule = true;
|
|
162
|
+
exports.createContext = void 0;
|
|
104
163
|
|
|
105
|
-
|
|
164
|
+
var build_1 = require("../build");
|
|
106
165
|
|
|
107
|
-
|
|
108
|
-
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
109
|
-
}
|
|
166
|
+
var deploy_1 = require("../deploy");
|
|
110
167
|
|
|
111
|
-
|
|
112
|
-
ENV_SHORT: env,
|
|
113
|
-
APP_DIR: componentConfig.dir,
|
|
114
|
-
ENV_TYPE: envType
|
|
115
|
-
};
|
|
116
|
-
var environmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
117
|
-
var environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
118
|
-
var predefinedVariables;
|
|
119
|
-
var host;
|
|
120
|
-
var url;
|
|
121
|
-
|
|
122
|
-
if (envType === "local") {
|
|
123
|
-
var devLocalConfig = mergedConfig;
|
|
124
|
-
var port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
|
|
125
|
-
host = "localhost:" + port;
|
|
126
|
-
url = "http://" + host;
|
|
127
|
-
predefinedVariables = {
|
|
128
|
-
ENV_SHORT: "local",
|
|
129
|
-
ROOT_URL: url,
|
|
130
|
-
PORT: port.toString()
|
|
131
|
-
};
|
|
132
|
-
} else {
|
|
133
|
-
var RELEASE_NAME = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
134
|
-
var componentSlug = (0, slugify_1["default"])(componentName);
|
|
135
|
-
var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
|
|
136
|
-
var 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
|
|
137
|
-
config.domainCanonical || "panter.cloud";
|
|
138
|
-
var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(config.appName, ".").concat(config.customerName, ".").concat(domainCanonical);
|
|
139
|
-
host = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.host) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
|
|
140
|
-
var url_1 = "https://".concat(host); // FIXME: move to kube specific jobs
|
|
141
|
-
|
|
142
|
-
var KUBE_APP_NAME = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-").concat(componentName) : componentName;
|
|
143
|
-
var KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
|
|
144
|
-
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
145
|
-
HOST_CANONICAL: HOST_CANONICAL,
|
|
146
|
-
ROOT_URL: url_1,
|
|
147
|
-
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
148
|
-
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
149
|
-
RELEASE_NAME: RELEASE_NAME
|
|
150
|
-
});
|
|
151
|
-
}
|
|
168
|
+
var utils_1 = require("../utils");
|
|
152
169
|
|
|
153
|
-
|
|
154
|
-
var secretEnvVarKeys = (_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : [];
|
|
155
|
-
var secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
156
|
-
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
157
|
-
})); // this is deprecated, we now support: $componentname:FOO
|
|
158
|
-
|
|
159
|
-
var legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
|
|
160
|
-
var publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
161
|
-
var publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
162
|
-
var _b = __read(_a, 2),
|
|
163
|
-
key = _b[0],
|
|
164
|
-
value = _b[1];
|
|
165
|
-
|
|
166
|
-
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
167
|
-
}));
|
|
168
|
-
|
|
169
|
-
var envVarsRaw = __assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized);
|
|
170
|
-
|
|
171
|
-
var envVars = (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName, alreadyVisited) {
|
|
172
|
-
var envVars = (0, exports.getEnvironment)(config, componentName, env, commitInfo, alreadyVisited).envVars;
|
|
173
|
-
return envVars[variableName];
|
|
174
|
-
}, alreadyVisited);
|
|
175
|
-
return {
|
|
176
|
-
envType: envType,
|
|
177
|
-
host: host,
|
|
178
|
-
fullName: environmentName,
|
|
179
|
-
slug: environmentSlug,
|
|
180
|
-
shortName: env,
|
|
181
|
-
url: predefinedVariables.ROOT_URL,
|
|
182
|
-
envVars: envVars,
|
|
183
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
184
|
-
};
|
|
185
|
-
};
|
|
170
|
+
var getEnvironment_1 = require("./getEnvironment");
|
|
186
171
|
|
|
187
|
-
|
|
172
|
+
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
188
173
|
|
|
189
|
-
|
|
190
|
-
var _a, _b;
|
|
174
|
+
__exportStar(require("./getEnvironment"), exports);
|
|
191
175
|
|
|
192
|
-
|
|
193
|
-
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
194
|
-
}
|
|
176
|
+
__exportStar(require("./getEnvironmentVariables"), exports);
|
|
195
177
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
178
|
+
var createContext = function (config, componentName, env, commitInfo, packageManagerInfo) {
|
|
179
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
181
|
+
|
|
182
|
+
var _a;
|
|
183
|
+
|
|
184
|
+
return __generator(this, function (_b) {
|
|
185
|
+
switch (_b.label) {
|
|
186
|
+
case 0:
|
|
187
|
+
if (!/^[a-z0-9-]+$/.test(componentName)) {
|
|
188
|
+
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
192
|
+
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
193
|
+
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
194
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
195
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
196
|
+
} : {
|
|
197
|
+
build: {},
|
|
198
|
+
deploy: {}
|
|
199
|
+
};
|
|
200
|
+
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
201
|
+
_a = {
|
|
202
|
+
fullConfig: config,
|
|
203
|
+
componentConfig: componentConfig,
|
|
204
|
+
componentName: componentName
|
|
205
|
+
};
|
|
206
|
+
return [4
|
|
207
|
+
/*yield*/
|
|
208
|
+
, (0, getEnvironment_1.getEnvironment)(config, componentName, env, commitInfo)];
|
|
209
|
+
|
|
210
|
+
case 1:
|
|
211
|
+
return [2
|
|
212
|
+
/*return*/
|
|
213
|
+
, (_a.environment = _b.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
222
217
|
};
|
|
223
218
|
|
|
224
219
|
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
|
};
|