@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.
- package/dist/build/base/createBuildJob.js +5 -27
- package/dist/build/base/writeBuildInfo.js +0 -3
- package/dist/build/custom/buildJob.js +3 -23
- package/dist/build/custom/index.js +3 -10
- package/dist/build/docker.js +5 -40
- package/dist/build/index.js +0 -8
- package/dist/build/node/buildJob.js +3 -25
- package/dist/build/node/cache.js +3 -21
- package/dist/build/node/index.js +3 -16
- package/dist/build/node/meteor.js +3 -20
- package/dist/build/node/testJob.js +5 -22
- package/dist/build/node/yarn.js +5 -18
- package/dist/build/rails/build.js +2 -8
- package/dist/build/rails/index.js +3 -11
- package/dist/build/rails/test.js +5 -18
- package/dist/build/types.d.ts +0 -9
- package/dist/build/types.js +0 -4
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/catladder-gitlab.js +6 -24
- package/dist/config/{configruedEnvs.test.d.ts → __tests__/configruedEnvs.test.d.ts} +0 -0
- package/dist/config/{configruedEnvs.test.js → __tests__/configruedEnvs.test.js} +10 -12
- package/dist/config/configruedEnvs.js +7 -22
- package/dist/config/index.js +0 -4
- package/dist/config/readConfig.js +2 -13
- package/dist/constants.js +1 -1
- package/dist/context/{resolveReferences.test.d.ts → __tests__/resolveReferences.test.d.ts} +0 -0
- package/dist/context/{resolveReferences.test.js → __tests__/resolveReferences.test.js} +52 -103
- package/dist/context/getEnvConfig.js +0 -8
- package/dist/context/getEnvType.js +0 -5
- package/dist/context/getEnvironment.js +13 -49
- package/dist/context/getEnvironmentContext.js +0 -5
- package/dist/context/getEnvironmentVariables.js +20 -83
- package/dist/context/getLabels.js +2 -13
- package/dist/context/index.js +13 -58
- package/dist/context/resolveReferences.js +36 -126
- package/dist/deploy/base.js +4 -19
- package/dist/deploy/cloudRun/deployJob.js +19 -61
- package/dist/deploy/cloudRun/index.js +17 -39
- package/dist/deploy/cloudRun/utils/database.js +11 -29
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +0 -4
- package/dist/deploy/cloudRun/utils/jobName.js +0 -2
- package/dist/deploy/custom/deployJob.js +3 -18
- package/dist/deploy/custom/index.js +0 -2
- package/dist/deploy/dockerTag/deployJob.js +0 -9
- package/dist/deploy/dockerTag/index.js +0 -2
- package/dist/deploy/index.js +0 -11
- package/dist/deploy/kubernetes/additionalSecretKeys.js +0 -9
- package/dist/deploy/kubernetes/cloudSql/index.js +0 -12
- package/dist/deploy/kubernetes/deployJob.js +3 -24
- package/dist/deploy/kubernetes/index.js +7 -17
- package/dist/deploy/kubernetes/kubeEnv.d.ts +0 -1
- package/dist/deploy/kubernetes/kubeEnv.js +5 -23
- package/dist/deploy/kubernetes/kubeValues.js +6 -24
- package/dist/deploy/kubernetes/mongodb.js +0 -24
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +2 -10
- package/dist/deploy/types/base.d.ts +0 -1
- package/dist/deploy/types/custom.d.ts +0 -6
- package/dist/deploy/types/googleCloudRun.d.ts +4 -12
- package/dist/deploy/types/index.js +0 -10
- package/dist/deploy/types/kubernetes.d.ts +0 -28
- package/dist/deploy/utils.js +0 -11
- package/dist/index.js +0 -10
- package/dist/pipeline/commitInfo/getBuildId.d.ts +1 -0
- package/dist/pipeline/{createChildPipeline.test.js → commitInfo/getBuildId.js} +25 -84
- package/dist/pipeline/commitInfo/getCommitInfo.d.ts +2 -0
- package/dist/{build/tests/storybook.test.js → pipeline/commitInfo/getCommitInfo.js} +30 -104
- package/dist/pipeline/createChildPipeline.js +19 -76
- package/dist/pipeline/createJobs.js +35 -135
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +1 -0
- package/dist/pipeline/gitlab/makeGitlabJob.js +13 -15
- package/dist/pipeline/index.js +0 -4
- package/dist/pipeline/packageManager.js +20 -173
- package/dist/pipeline/yarn/yarnUtils.d.ts +4 -0
- package/dist/pipeline/yarn/yarnUtils.js +193 -0
- package/dist/runner/index.js +0 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +0 -13
- package/dist/types/config.js +5 -15
- package/dist/types/context.d.ts +0 -2
- package/dist/types/environmentContext.d.ts +0 -1
- package/dist/types/gitlab-types.d.ts +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/jobs.d.ts +5 -15
- package/dist/utils/gitlab.js +3 -13
- package/dist/utils/index.js +5 -15
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1765 -0
- package/examples/__snapshots__/custom-build-job.ts.snap +1174 -0
- package/examples/__snapshots__/custom-envs.ts.snap +261 -0
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +1626 -0
- package/examples/__utils__/helpers.ts +14 -0
- package/examples/{cloud-sql.ts → cloud-run-with-sql.ts} +12 -15
- package/examples/custom-build-job.ts +4 -1
- package/examples/custom-envs.ts +31 -0
- package/examples/wait-for-other-deploy.ts +36 -0
- package/package.json +2 -2
- package/src/config/{configruedEnvs.test.ts → __tests__/configruedEnvs.test.ts} +3 -3
- package/src/context/{resolveReferences.test.ts → __tests__/resolveReferences.test.ts} +3 -3
- package/src/deploy/cloudRun/index.ts +2 -1
- package/src/deploy/types/googleCloudRun.ts +5 -0
- package/src/pipeline/commitInfo/getBuildId.ts +6 -0
- package/src/pipeline/commitInfo/getCommitInfo.ts +12 -0
- package/src/pipeline/createChildPipeline.ts +6 -1
- package/src/pipeline/createJobs.ts +3 -10
- package/src/pipeline/gitlab/makeGitlabJob.ts +7 -1
- package/src/pipeline/packageManager.ts +4 -38
- package/src/pipeline/yarn/yarnUtils.ts +37 -0
- package/src/types/jobs.ts +2 -1
- package/tsconfig.json +1 -1
- package/dist/build/tests/storybook.test.d.ts +0 -1
- package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
- package/src/build/tests/storybook.test.ts +0 -54
- package/src/pipeline/createChildPipeline.test.ts +0 -49
|
@@ -2,25 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.getEnvConfig = void 0;
|
|
5
|
-
|
|
6
5
|
var utils_1 = require("../utils");
|
|
7
|
-
|
|
8
6
|
var getEnvConfig = function (config, componentName, env) {
|
|
9
7
|
var _a, _b;
|
|
10
|
-
|
|
11
8
|
var defaultConfig = config.components[componentName];
|
|
12
|
-
|
|
13
9
|
if (!defaultConfig) {
|
|
14
10
|
throw new Error("unknown component " + componentName);
|
|
15
11
|
}
|
|
16
|
-
|
|
17
12
|
var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
18
|
-
|
|
19
13
|
if (envCustomizations === false) {
|
|
20
14
|
throw new Error("env is disabled: " + env + ":" + componentName);
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
|
|
24
17
|
};
|
|
25
|
-
|
|
26
18
|
exports.getEnvConfig = getEnvConfig;
|
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.getEnvType = void 0;
|
|
5
|
-
|
|
6
5
|
var types_1 = require("../types");
|
|
7
|
-
|
|
8
6
|
var getEnvType = function (env, envConfig) {
|
|
9
7
|
if (envConfig.type) return envConfig.type;
|
|
10
|
-
|
|
11
8
|
if ((0, types_1.isKnowEnvType)(env)) {
|
|
12
9
|
return env;
|
|
13
10
|
}
|
|
14
|
-
|
|
15
11
|
throw new Error("unknown env type: " + env);
|
|
16
12
|
};
|
|
17
|
-
|
|
18
13
|
exports.getEnvType = getEnvType;
|
|
@@ -6,7 +6,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
6
6
|
resolve(value);
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
10
|
function fulfilled(value) {
|
|
12
11
|
try {
|
|
@@ -15,7 +14,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
15
14
|
reject(e);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
function rejected(value) {
|
|
20
18
|
try {
|
|
21
19
|
step(generator["throw"](value));
|
|
@@ -23,29 +21,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
23
21
|
reject(e);
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
function step(result) {
|
|
28
25
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
28
|
});
|
|
33
29
|
};
|
|
34
|
-
|
|
35
30
|
var __generator = this && this.__generator || function (thisArg, body) {
|
|
36
31
|
var _ = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function () {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
41
39
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
y,
|
|
47
|
-
t,
|
|
48
|
-
g;
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
49
44
|
return g = {
|
|
50
45
|
next: verb(0),
|
|
51
46
|
"throw": verb(1),
|
|
@@ -53,78 +48,59 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
53
48
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
54
49
|
return this;
|
|
55
50
|
}), g;
|
|
56
|
-
|
|
57
51
|
function verb(n) {
|
|
58
52
|
return function (v) {
|
|
59
53
|
return step([n, v]);
|
|
60
54
|
};
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
function step(op) {
|
|
64
57
|
if (f) throw new TypeError("Generator is already executing.");
|
|
65
|
-
|
|
66
58
|
while (_) try {
|
|
67
59
|
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;
|
|
68
60
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
69
|
-
|
|
70
61
|
switch (op[0]) {
|
|
71
62
|
case 0:
|
|
72
63
|
case 1:
|
|
73
64
|
t = op;
|
|
74
65
|
break;
|
|
75
|
-
|
|
76
66
|
case 4:
|
|
77
67
|
_.label++;
|
|
78
68
|
return {
|
|
79
69
|
value: op[1],
|
|
80
70
|
done: false
|
|
81
71
|
};
|
|
82
|
-
|
|
83
72
|
case 5:
|
|
84
73
|
_.label++;
|
|
85
74
|
y = op[1];
|
|
86
75
|
op = [0];
|
|
87
76
|
continue;
|
|
88
|
-
|
|
89
77
|
case 7:
|
|
90
78
|
op = _.ops.pop();
|
|
91
|
-
|
|
92
79
|
_.trys.pop();
|
|
93
|
-
|
|
94
80
|
continue;
|
|
95
|
-
|
|
96
81
|
default:
|
|
97
82
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
98
83
|
_ = 0;
|
|
99
84
|
continue;
|
|
100
85
|
}
|
|
101
|
-
|
|
102
86
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
103
87
|
_.label = op[1];
|
|
104
88
|
break;
|
|
105
89
|
}
|
|
106
|
-
|
|
107
90
|
if (op[0] === 6 && _.label < t[1]) {
|
|
108
91
|
_.label = t[1];
|
|
109
92
|
t = op;
|
|
110
93
|
break;
|
|
111
94
|
}
|
|
112
|
-
|
|
113
95
|
if (t && _.label < t[2]) {
|
|
114
96
|
_.label = t[2];
|
|
115
|
-
|
|
116
97
|
_.ops.push(op);
|
|
117
|
-
|
|
118
98
|
break;
|
|
119
99
|
}
|
|
120
|
-
|
|
121
100
|
if (t[2]) _.ops.pop();
|
|
122
|
-
|
|
123
101
|
_.trys.pop();
|
|
124
|
-
|
|
125
102
|
continue;
|
|
126
103
|
}
|
|
127
|
-
|
|
128
104
|
op = body.call(thisArg, _);
|
|
129
105
|
} catch (e) {
|
|
130
106
|
op = [6, e];
|
|
@@ -132,7 +108,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
132
108
|
} finally {
|
|
133
109
|
f = t = 0;
|
|
134
110
|
}
|
|
135
|
-
|
|
136
111
|
if (op[0] & 5) throw op[1];
|
|
137
112
|
return {
|
|
138
113
|
value: op[0] ? op[1] : void 0,
|
|
@@ -140,32 +115,22 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
140
115
|
};
|
|
141
116
|
}
|
|
142
117
|
};
|
|
143
|
-
|
|
144
118
|
exports.__esModule = true;
|
|
145
119
|
exports.getEnvironment = void 0;
|
|
146
|
-
|
|
147
120
|
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
148
|
-
|
|
149
121
|
var getEnvironmentVariables_1 = require("./getEnvironmentVariables");
|
|
150
|
-
|
|
151
122
|
var getEnvironment = function (config, componentName, env, commitInfo) {
|
|
152
123
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
153
124
|
var _a, envVars, secretEnvVarKeys, host, url, envContext, envType;
|
|
154
|
-
|
|
155
125
|
return __generator(this, function (_b) {
|
|
156
126
|
switch (_b.label) {
|
|
157
127
|
case 0:
|
|
158
|
-
return [4
|
|
159
|
-
/*yield*/
|
|
160
|
-
, (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
|
|
161
|
-
|
|
128
|
+
return [4 /*yield*/, (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
|
|
162
129
|
case 1:
|
|
163
130
|
_a = _b.sent(), envVars = _a.envVars, secretEnvVarKeys = _a.secretEnvVarKeys, host = _a.host, url = _a.url;
|
|
164
131
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
165
132
|
envType = envContext.envType;
|
|
166
|
-
return [2
|
|
167
|
-
/*return*/
|
|
168
|
-
, {
|
|
133
|
+
return [2 /*return*/, {
|
|
169
134
|
envType: envType,
|
|
170
135
|
host: host,
|
|
171
136
|
url: url,
|
|
@@ -183,5 +148,4 @@ var getEnvironment = function (config, componentName, env, commitInfo) {
|
|
|
183
148
|
});
|
|
184
149
|
});
|
|
185
150
|
};
|
|
186
|
-
|
|
187
151
|
exports.getEnvironment = getEnvironment;
|
|
@@ -2,16 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.getEnvironmentContext = void 0;
|
|
5
|
-
|
|
6
5
|
var getEnvConfig_1 = require("./getEnvConfig");
|
|
7
|
-
|
|
8
6
|
var getEnvType_1 = require("./getEnvType");
|
|
9
|
-
|
|
10
7
|
var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
|
|
11
8
|
var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
|
|
12
9
|
return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
13
10
|
};
|
|
14
|
-
|
|
15
11
|
var getEnvironmentContext = function (config, env, componentName, commitInfo) {
|
|
16
12
|
var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
|
|
17
13
|
var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
|
|
@@ -32,5 +28,4 @@ var getEnvironmentContext = function (config, env, componentName, commitInfo) {
|
|
|
32
28
|
fullConfig: config
|
|
33
29
|
};
|
|
34
30
|
};
|
|
35
|
-
|
|
36
31
|
exports.getEnvironmentContext = getEnvironmentContext;
|
|
@@ -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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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,15 +125,13 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
154
125
|
};
|
|
155
126
|
}
|
|
156
127
|
};
|
|
157
|
-
|
|
158
128
|
var __read = this && this.__read || function (o, n) {
|
|
159
129
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
160
130
|
if (!m) return o;
|
|
161
131
|
var i = m.call(o),
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
132
|
+
r,
|
|
133
|
+
ar = [],
|
|
134
|
+
e;
|
|
166
135
|
try {
|
|
167
136
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
168
137
|
} catch (error) {
|
|
@@ -176,10 +145,8 @@ var __read = this && this.__read || function (o, n) {
|
|
|
176
145
|
if (e) throw e.error;
|
|
177
146
|
}
|
|
178
147
|
}
|
|
179
|
-
|
|
180
148
|
return ar;
|
|
181
149
|
};
|
|
182
|
-
|
|
183
150
|
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
184
151
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
185
152
|
if (ar || !(i in from)) {
|
|
@@ -189,29 +156,20 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
189
156
|
}
|
|
190
157
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
191
158
|
};
|
|
192
|
-
|
|
193
159
|
exports.__esModule = true;
|
|
194
160
|
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
|
|
195
|
-
|
|
196
161
|
var lodash_1 = require("lodash");
|
|
197
|
-
|
|
198
162
|
var deploy_1 = require("../deploy");
|
|
199
|
-
|
|
200
163
|
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
201
|
-
|
|
202
164
|
var resolveReferences_1 = require("./resolveReferences");
|
|
203
|
-
|
|
204
165
|
var getEnvironmentVariables = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
205
166
|
) {
|
|
206
167
|
if (alreadyVisited === void 0) {
|
|
207
168
|
alreadyVisited = {};
|
|
208
169
|
}
|
|
209
|
-
|
|
210
170
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
211
171
|
var environmentContext, envConfigRaw, deployConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
212
|
-
|
|
213
172
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
214
|
-
|
|
215
173
|
return __generator(this, function (_k) {
|
|
216
174
|
switch (_k.label) {
|
|
217
175
|
case 0:
|
|
@@ -222,7 +180,6 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
222
180
|
APP_DIR: envConfigRaw.dir,
|
|
223
181
|
ENV_TYPE: envType
|
|
224
182
|
};
|
|
225
|
-
|
|
226
183
|
if (envType === "local") {
|
|
227
184
|
devLocalConfig = envConfigRaw;
|
|
228
185
|
port = (_a = devLocalConfig.port) !== null && _a !== void 0 ? _a : 3000;
|
|
@@ -243,7 +200,6 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
243
200
|
ROOT_URL: url
|
|
244
201
|
}), additionalEnvVars);
|
|
245
202
|
}
|
|
246
|
-
|
|
247
203
|
publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
|
|
248
204
|
additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
|
|
249
205
|
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []), false), __read(additionalSecretKeys), false);
|
|
@@ -254,39 +210,28 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
254
210
|
publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
255
211
|
publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
256
212
|
var _b = __read(_a, 2),
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
213
|
+
key = _b[0],
|
|
214
|
+
value = _b[1];
|
|
260
215
|
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
261
216
|
}));
|
|
262
217
|
envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
263
|
-
return [4
|
|
264
|
-
/*yield*/
|
|
265
|
-
, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, variableName, alreadyVisited) {
|
|
218
|
+
return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, variableName, alreadyVisited) {
|
|
266
219
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
267
220
|
var otherEnvVars;
|
|
268
221
|
return __generator(this, function (_a) {
|
|
269
222
|
switch (_a.label) {
|
|
270
223
|
case 0:
|
|
271
|
-
return [4
|
|
272
|
-
/*yield*/
|
|
273
|
-
, (0, exports.getEnvironmentVariables)(config, otherComponentName, env, commitInfo, alreadyVisited)];
|
|
274
|
-
|
|
224
|
+
return [4 /*yield*/, (0, exports.getEnvironmentVariables)(config, otherComponentName, env, commitInfo, alreadyVisited)];
|
|
275
225
|
case 1:
|
|
276
226
|
otherEnvVars = _a.sent().envVars;
|
|
277
|
-
return [2
|
|
278
|
-
/*return*/
|
|
279
|
-
, otherEnvVars[variableName]];
|
|
227
|
+
return [2 /*return*/, otherEnvVars[variableName]];
|
|
280
228
|
}
|
|
281
229
|
});
|
|
282
230
|
});
|
|
283
231
|
}, alreadyVisited)];
|
|
284
|
-
|
|
285
232
|
case 1:
|
|
286
233
|
envVars = _k.sent();
|
|
287
|
-
return [2
|
|
288
|
-
/*return*/
|
|
289
|
-
, {
|
|
234
|
+
return [2 /*return*/, {
|
|
290
235
|
envVars: envVars,
|
|
291
236
|
secretEnvVarKeys: secretEnvVarKeys,
|
|
292
237
|
host: host,
|
|
@@ -296,28 +241,20 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
296
241
|
});
|
|
297
242
|
});
|
|
298
243
|
};
|
|
299
|
-
|
|
300
244
|
exports.getEnvironmentVariables = getEnvironmentVariables;
|
|
301
|
-
|
|
302
245
|
var sanitizeForEnVar = function (s) {
|
|
303
246
|
return s.replace(/-/g, "_");
|
|
304
247
|
};
|
|
305
|
-
|
|
306
248
|
var getSecretVarName = function (env, componentName, key) {
|
|
307
249
|
return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
|
|
308
250
|
}; // remove dash from component name
|
|
309
|
-
|
|
310
|
-
|
|
311
251
|
exports.getSecretVarName = getSecretVarName;
|
|
312
|
-
|
|
313
252
|
var addIndexVar = function (vars) {
|
|
314
253
|
return __assign(__assign({}, vars), {
|
|
315
254
|
_ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
|
|
316
255
|
});
|
|
317
256
|
};
|
|
318
|
-
|
|
319
257
|
var getSecretVarNameForContext = function (context, key) {
|
|
320
258
|
return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
|
|
321
259
|
};
|
|
322
|
-
|
|
323
260
|
exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
@@ -4,37 +4,28 @@ 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 __importDefault = this && this.__importDefault || function (mod) {
|
|
18
14
|
return mod && mod.__esModule ? mod : {
|
|
19
15
|
"default": mod
|
|
20
16
|
};
|
|
21
17
|
};
|
|
22
|
-
|
|
23
18
|
exports.__esModule = true;
|
|
24
19
|
exports.getLabels = void 0;
|
|
25
|
-
|
|
26
20
|
var slugify_1 = __importDefault(require("slugify"));
|
|
27
|
-
|
|
28
21
|
var sanitize = function (value) {
|
|
29
|
-
if (!value) return value;
|
|
22
|
+
if (!value) return value;
|
|
23
|
+
//"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
24
|
// slugify should do the job
|
|
31
|
-
|
|
32
25
|
return (0, slugify_1["default"])(value).toLowerCase();
|
|
33
26
|
};
|
|
34
|
-
|
|
35
27
|
var getLabels = function (context) {
|
|
36
28
|
var _a, _b, _c;
|
|
37
|
-
|
|
38
29
|
var labels = __assign({
|
|
39
30
|
"customer-name": sanitize(context.fullConfig.customerName),
|
|
40
31
|
"app-name": sanitize(context.fullConfig.appName),
|
|
@@ -42,8 +33,6 @@ var getLabels = function (context) {
|
|
|
42
33
|
"env-name": sanitize(context.environment.shortName),
|
|
43
34
|
"build-type": sanitize((_a = context.componentConfig.build) === null || _a === void 0 ? void 0 : _a.type)
|
|
44
35
|
}, (_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {});
|
|
45
|
-
|
|
46
36
|
return labels;
|
|
47
37
|
};
|
|
48
|
-
|
|
49
38
|
exports.getLabels = getLabels;
|