@catladder/pipeline 0.0.0-node16-ddfae617 → 0.0.0-prettier-cbceeed9
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-dev.js +3 -0
- package/bin/catladder-gitlab.js +1 -1
- package/dist/build/base/createBuildJob.d.ts +2 -2
- package/dist/build/base/createBuildJob.js +15 -30
- package/dist/build/base/writeBuildInfo.d.ts +2 -0
- package/dist/build/base/{getBuildInfo.js → writeBuildInfo.js} +3 -6
- package/dist/build/custom/buildJob.d.ts +3 -0
- package/dist/build/custom/buildJob.js +83 -0
- package/dist/build/custom/index.d.ts +3 -0
- package/dist/build/custom/index.js +40 -0
- package/dist/build/docker.d.ts +33 -9
- package/dist/build/docker.js +51 -54
- package/dist/build/index.d.ts +6 -5
- package/dist/build/index.js +20 -6
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/buildJob.js +3 -25
- package/dist/build/node/cache.d.ts +2 -2
- package/dist/build/node/cache.js +19 -22
- package/dist/build/node/index.d.ts +1 -1
- package/dist/build/node/index.js +3 -16
- package/dist/build/node/meteor.d.ts +1 -1
- package/dist/build/node/meteor.js +9 -20
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +7 -21
- package/dist/build/node/yarn.d.ts +1 -1
- package/dist/build/node/yarn.js +14 -15
- package/dist/build/rails/build.d.ts +3 -0
- package/dist/build/rails/build.js +51 -0
- package/dist/build/rails/index.d.ts +3 -0
- package/dist/build/rails/index.js +41 -0
- package/dist/build/rails/test.d.ts +3 -0
- package/dist/build/rails/test.js +94 -0
- package/dist/build/types.d.ts +84 -9
- package/dist/build/types.js +0 -4
- package/dist/bundles/catladder-gitlab/index.js +32979 -0
- package/dist/catladder-gitlab.js +7 -26
- 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.d.ts +1 -1
- package/dist/config/configruedEnvs.js +7 -22
- package/dist/config/index.js +0 -4
- package/dist/config/readConfig.d.ts +1 -1
- 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/__tests__/resolveReferences.test.js +336 -0
- package/dist/context/getEnvConfig.d.ts +2 -0
- package/dist/context/getEnvConfig.js +18 -0
- package/dist/context/getEnvType.d.ts +4 -0
- package/dist/context/getEnvType.js +13 -0
- package/dist/context/getEnvironment.d.ts +3 -0
- package/dist/{pipeline/createChildPipeline.test.js → context/getEnvironment.js} +42 -84
- package/dist/context/getEnvironmentContext.d.ts +4 -0
- package/dist/context/getEnvironmentContext.js +33 -0
- package/dist/context/getEnvironmentVariables.d.ts +10 -0
- package/dist/context/getEnvironmentVariables.js +260 -0
- package/dist/context/getLabels.d.ts +8 -0
- package/dist/context/getLabels.js +38 -0
- package/dist/context/index.d.ts +5 -6
- package/dist/context/index.js +158 -208
- package/dist/context/resolveReferences.d.ts +1 -3
- package/dist/context/resolveReferences.js +213 -52
- package/dist/defaults/index.d.ts +1 -1
- package/dist/deploy/base.d.ts +4 -2
- package/dist/deploy/base.js +38 -33
- package/dist/deploy/cloudRun/deployJob.d.ts +3 -0
- package/dist/deploy/cloudRun/deployJob.js +238 -0
- package/dist/deploy/cloudRun/index.d.ts +4 -0
- package/dist/deploy/cloudRun/index.js +112 -0
- package/dist/deploy/cloudRun/utils/createArgsString.d.ts +11 -0
- package/dist/deploy/cloudRun/utils/createArgsString.js +55 -0
- package/dist/deploy/cloudRun/utils/database.d.ts +4 -0
- package/dist/deploy/cloudRun/utils/database.js +64 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +10 -0
- package/dist/deploy/cloudRun/utils/jobName.d.ts +1 -0
- package/dist/deploy/cloudRun/utils/jobName.js +8 -0
- package/dist/deploy/custom/deployJob.d.ts +2 -2
- package/dist/deploy/custom/deployJob.js +10 -16
- package/dist/deploy/custom/index.d.ts +2 -1
- package/dist/deploy/custom/index.js +14 -19
- package/dist/deploy/dockerTag/deployJob.d.ts +3 -0
- package/dist/deploy/dockerTag/deployJob.js +24 -0
- package/dist/deploy/dockerTag/index.d.ts +2 -0
- package/dist/deploy/dockerTag/index.js +17 -0
- package/dist/deploy/index.d.ts +12 -8
- package/dist/deploy/index.js +7 -20
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +4 -0
- package/dist/deploy/kubernetes/additionalSecretKeys.js +24 -0
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +13 -0
- package/dist/deploy/kubernetes/cloudSql/index.js +30 -0
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.js +17 -91
- package/dist/deploy/kubernetes/index.d.ts +3 -1
- package/dist/deploy/kubernetes/index.js +42 -4
- package/dist/deploy/kubernetes/kubeEnv.d.ts +9 -0
- package/dist/deploy/kubernetes/kubeEnv.js +72 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +97 -0
- package/dist/deploy/kubernetes/kubeValues.js +124 -0
- package/dist/deploy/kubernetes/mongodb.d.ts +18 -5
- package/dist/deploy/kubernetes/mongodb.js +96 -10
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +25 -21
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +2 -10
- package/dist/deploy/types/base.d.ts +14 -0
- package/dist/deploy/types/base.js +3 -0
- package/dist/deploy/types/custom.d.ts +33 -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 +121 -0
- package/dist/deploy/types/googleCloudRun.js +3 -0
- package/dist/deploy/types/index.d.ts +22 -0
- package/dist/deploy/types/index.js +31 -0
- package/dist/deploy/types/kubernetes.d.ts +276 -0
- package/dist/deploy/types/kubernetes.js +3 -0
- package/dist/deploy/utils.d.ts +2 -2
- package/dist/deploy/utils.js +3 -10
- package/dist/index.js +0 -10
- package/dist/pipeline/commitInfo/getBuildId.d.ts +1 -0
- package/dist/pipeline/commitInfo/getBuildId.js +135 -0
- package/dist/pipeline/commitInfo/getCommitInfo.d.ts +2 -0
- package/dist/pipeline/commitInfo/getCommitInfo.js +140 -0
- package/dist/pipeline/createAllJobs.d.ts +8 -0
- package/dist/{build/tests/storybook.test.js → pipeline/createAllJobs.js} +54 -104
- package/dist/pipeline/createChildPipeline.d.ts +2 -2
- package/dist/pipeline/createChildPipeline.js +40 -121
- package/dist/pipeline/createJobsForComponent.d.ts +3 -0
- package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +33 -192
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -5
- package/dist/pipeline/packageManager.d.ts +1 -1
- 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/rules/index.d.ts +3 -1
- package/dist/rules/index.js +7 -6
- package/dist/runner/index.d.ts +2 -3
- package/dist/runner/index.js +0 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +19 -25
- package/dist/types/config.js +6 -16
- package/dist/types/context.d.ts +16 -3
- package/dist/types/environmentContext.d.ts +28 -0
- package/dist/types/environmentContext.js +3 -0
- package/dist/types/gitlab-types.d.ts +39 -7
- package/dist/types/index.js +0 -6
- package/dist/types/jobs.d.ts +25 -17
- package/dist/types/jobs.js +1 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.js +3 -0
- package/dist/utils/gitlab.d.ts +5 -0
- package/dist/utils/gitlab.js +48 -0
- package/dist/utils/index.js +5 -15
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +1560 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +1560 -0
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +1560 -0
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3092 -0
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +3103 -0
- package/examples/__snapshots__/custom-build-job.ts.snap +1162 -0
- package/examples/__snapshots__/custom-envs.ts.snap +261 -0
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +4077 -0
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +1626 -0
- package/examples/__utils__/helpers.ts +14 -0
- package/examples/cloud-run-memory-limit.ts +28 -0
- package/examples/cloud-run-no-cpu-throttling.ts +33 -0
- package/examples/cloud-run-non-public.ts +27 -0
- package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
- package/examples/cloud-run-with-sql.ts +61 -0
- package/examples/custom-build-job.ts +28 -0
- package/examples/custom-envs.ts +31 -0
- package/examples/kubernetes-application-customization.ts +57 -0
- package/examples/kubernetes-with-jobs.ts +68 -0
- package/examples/rails-k8s-with-worker.ts +95 -0
- package/examples/wait-for-other-deploy.ts +36 -0
- package/package.json +16 -13
- package/scripts/bundle +2 -0
- package/src/build/base/createBuildJob.ts +12 -5
- package/src/build/base/{getBuildInfo.ts → writeBuildInfo.ts} +2 -2
- package/src/build/custom/buildJob.ts +64 -0
- package/src/build/custom/index.ts +7 -0
- package/src/build/docker.ts +58 -33
- package/src/build/index.ts +24 -5
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +19 -8
- 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/rails/build.ts +38 -0
- package/src/build/rails/index.ts +8 -0
- package/src/build/rails/test.ts +86 -0
- package/src/build/types.ts +97 -2
- package/src/catladder-gitlab.ts +4 -2
- package/src/config/{configruedEnvs.test.ts → __tests__/configruedEnvs.test.ts} +3 -3
- package/src/config/configruedEnvs.ts +2 -7
- package/src/config/readConfig.ts +1 -1
- package/src/context/{resolveReferences.test.ts → __tests__/resolveReferences.test.ts} +23 -38
- 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 +155 -0
- package/src/context/getLabels.ts +20 -0
- package/src/context/index.ts +28 -193
- package/src/context/resolveReferences.ts +35 -31
- package/src/defaults/index.ts +1 -1
- package/src/deploy/base.ts +43 -19
- package/src/deploy/cloudRun/deployJob.ts +276 -0
- package/src/deploy/cloudRun/index.ts +95 -0
- package/src/deploy/cloudRun/utils/createArgsString.ts +26 -0
- package/src/deploy/cloudRun/utils/database.ts +55 -0
- package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +14 -0
- package/src/deploy/cloudRun/utils/jobName.ts +2 -0
- package/src/deploy/custom/deployJob.ts +13 -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/index.ts +28 -0
- package/src/deploy/kubernetes/deployJob.ts +21 -78
- package/src/deploy/kubernetes/index.ts +42 -1
- package/src/deploy/kubernetes/kubeEnv.ts +48 -0
- package/src/deploy/kubernetes/kubeValues.ts +96 -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 +36 -0
- package/src/deploy/types/dockerTag.ts +12 -0
- package/src/deploy/types/googleCloudRun.ts +179 -0
- package/src/deploy/types/index.ts +28 -0
- package/src/deploy/types/kubernetes.ts +301 -0
- package/src/deploy/utils.ts +6 -2
- package/src/pipeline/commitInfo/getBuildId.ts +6 -0
- package/src/pipeline/commitInfo/getCommitInfo.ts +12 -0
- package/src/pipeline/createAllJobs.ts +38 -0
- package/src/pipeline/createChildPipeline.ts +9 -20
- package/src/pipeline/createJobsForComponent.ts +64 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
- package/src/pipeline/index.ts +1 -1
- package/src/pipeline/packageManager.ts +4 -38
- package/src/pipeline/yarn/yarnUtils.ts +37 -0
- package/src/rules/index.ts +9 -6
- package/src/runner/index.ts +2 -1
- package/src/types/config.ts +26 -13
- package/src/types/context.ts +23 -2
- package/src/types/environmentContext.ts +33 -0
- package/src/types/gitlab-types.ts +36 -6
- package/src/types/jobs.ts +30 -6
- package/src/types/pipeline.ts +1 -1
- package/src/types/utils.ts +7 -0
- package/src/utils/gitlab.ts +23 -0
- package/tsconfig.json +3 -1
- package/dist/build/base/getBuildInfo.d.ts +0 -2
- package/dist/build/tests/storybook.test.d.ts +0 -1
- package/dist/context/resolveReferences.test.js +0 -141
- package/dist/deploy/kubernetes/cloudsql.d.ts +0 -6
- package/dist/deploy/kubernetes/cloudsql.js +0 -16
- package/dist/deploy/types.d.ts +0 -196
- package/dist/deploy/types.js +0 -16
- package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
- package/dist/pipeline/createJobs.d.ts +0 -3
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -8
- package/dist/pipeline/gitlab/makeGitlabJob.js +0 -45
- package/src/build/tests/storybook.test.ts +0 -54
- package/src/deploy/kubernetes/cloudsql.ts +0 -12
- package/src/deploy/types.ts +0 -189
- package/src/pipeline/createChildPipeline.test.ts +0 -49
- package/src/pipeline/createJobs.ts +0 -195
- package/src/pipeline/gitlab/makeGitlabJob.ts +0 -16
package/dist/context/index.js
CHANGED
|
@@ -1,224 +1,174 @@
|
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
});
|
|
11
|
+
} : function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
});
|
|
15
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
17
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
19
|
+
function adopt(value) {
|
|
20
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
21
|
+
resolve(value);
|
|
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
|
+
function rejected(value) {
|
|
33
|
+
try {
|
|
34
|
+
step(generator["throw"](value));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
reject(e);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function step(result) {
|
|
40
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
41
|
+
}
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
46
|
+
var _ = {
|
|
47
|
+
label: 0,
|
|
48
|
+
sent: function () {
|
|
49
|
+
if (t[0] & 1) throw t[1];
|
|
50
|
+
return t[1];
|
|
51
|
+
},
|
|
52
|
+
trys: [],
|
|
53
|
+
ops: []
|
|
54
|
+
},
|
|
55
|
+
f,
|
|
56
|
+
y,
|
|
57
|
+
t,
|
|
58
|
+
g;
|
|
59
|
+
return g = {
|
|
60
|
+
next: verb(0),
|
|
61
|
+
"throw": verb(1),
|
|
62
|
+
"return": verb(2)
|
|
63
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
64
|
+
return this;
|
|
65
|
+
}), g;
|
|
66
|
+
function verb(n) {
|
|
67
|
+
return function (v) {
|
|
68
|
+
return step([n, v]);
|
|
30
69
|
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
70
|
+
}
|
|
71
|
+
function step(op) {
|
|
72
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
73
|
+
while (_) try {
|
|
74
|
+
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;
|
|
75
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
76
|
+
switch (op[0]) {
|
|
77
|
+
case 0:
|
|
78
|
+
case 1:
|
|
79
|
+
t = op;
|
|
80
|
+
break;
|
|
81
|
+
case 4:
|
|
82
|
+
_.label++;
|
|
83
|
+
return {
|
|
84
|
+
value: op[1],
|
|
85
|
+
done: false
|
|
86
|
+
};
|
|
87
|
+
case 5:
|
|
88
|
+
_.label++;
|
|
89
|
+
y = op[1];
|
|
90
|
+
op = [0];
|
|
91
|
+
continue;
|
|
92
|
+
case 7:
|
|
93
|
+
op = _.ops.pop();
|
|
94
|
+
_.trys.pop();
|
|
95
|
+
continue;
|
|
96
|
+
default:
|
|
97
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
98
|
+
_ = 0;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
102
|
+
_.label = op[1];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
106
|
+
_.label = t[1];
|
|
107
|
+
t = op;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (t && _.label < t[2]) {
|
|
111
|
+
_.label = t[2];
|
|
112
|
+
_.ops.push(op);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (t[2]) _.ops.pop();
|
|
116
|
+
_.trys.pop();
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
op = body.call(thisArg, _);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
op = [6, e];
|
|
122
|
+
y = 0;
|
|
34
123
|
} finally {
|
|
35
|
-
|
|
124
|
+
f = t = 0;
|
|
36
125
|
}
|
|
126
|
+
if (op[0] & 5) throw op[1];
|
|
127
|
+
return {
|
|
128
|
+
value: op[0] ? op[1] : void 0,
|
|
129
|
+
done: true
|
|
130
|
+
};
|
|
37
131
|
}
|
|
38
|
-
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var __importDefault = this && this.__importDefault || function (mod) {
|
|
43
|
-
return mod && mod.__esModule ? mod : {
|
|
44
|
-
"default": mod
|
|
45
|
-
};
|
|
46
132
|
};
|
|
47
|
-
|
|
48
133
|
exports.__esModule = true;
|
|
49
|
-
exports.createContext =
|
|
50
|
-
|
|
51
|
-
var lodash_1 = require("lodash");
|
|
52
|
-
|
|
53
|
-
var slugify_1 = __importDefault(require("slugify"));
|
|
54
|
-
|
|
134
|
+
exports.createContext = void 0;
|
|
55
135
|
var build_1 = require("../build");
|
|
56
|
-
|
|
57
136
|
var deploy_1 = require("../deploy");
|
|
58
|
-
|
|
59
|
-
var config_1 = require("../types/config");
|
|
60
|
-
|
|
61
137
|
var utils_1 = require("../utils");
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return s.replace(/-/g, "_");
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var getSecretVarName = function (env, componentName, key) {
|
|
70
|
-
return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
|
|
71
|
-
}; // remove dash from component name
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
exports.getSecretVarName = getSecretVarName;
|
|
75
|
-
|
|
76
|
-
var getSecretVarNameForContext = function (context, key) {
|
|
77
|
-
return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
81
|
-
|
|
82
|
-
var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
83
|
-
) {
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
85
|
-
|
|
86
|
-
if (alreadyVisited === void 0) {
|
|
87
|
-
alreadyVisited = {};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var componentConfig = config.components[componentName];
|
|
91
|
-
|
|
92
|
-
if (!componentConfig) {
|
|
93
|
-
throw new Error("unknown component " + componentName);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
var defaultConfig = componentConfig;
|
|
97
|
-
var envConfig = (_b = (_a = componentConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
98
|
-
|
|
99
|
-
if (envConfig === false) {
|
|
100
|
-
throw new Error("env is disabled: " + env);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
var mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig); // env type: if its set manually, use that, otherwise use the known env types
|
|
104
|
-
|
|
105
|
-
var envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
|
|
106
|
-
|
|
107
|
-
if (!envType) {
|
|
108
|
-
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var basePredefinedVariables = {
|
|
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
|
-
}
|
|
152
|
-
|
|
153
|
-
var publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
|
|
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
|
-
};
|
|
186
|
-
|
|
187
|
-
exports.getEnvironment = getEnvironment;
|
|
188
|
-
|
|
138
|
+
var getEnvironment_1 = require("./getEnvironment");
|
|
139
|
+
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
140
|
+
__exportStar(require("./getEnvironment"), exports);
|
|
141
|
+
__exportStar(require("./getEnvironmentVariables"), exports);
|
|
189
142
|
var createContext = function (config, componentName, env, commitInfo, packageManagerInfo) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
packageManagerInfo: packageManagerInfo
|
|
221
|
-
};
|
|
143
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
145
|
+
var _a;
|
|
146
|
+
return __generator(this, function (_b) {
|
|
147
|
+
switch (_b.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
if (!/^[a-z0-9-]+$/.test(componentName)) {
|
|
150
|
+
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
151
|
+
}
|
|
152
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
153
|
+
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
154
|
+
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
155
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
156
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
157
|
+
} : {
|
|
158
|
+
build: {},
|
|
159
|
+
deploy: {}
|
|
160
|
+
};
|
|
161
|
+
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
162
|
+
_a = {
|
|
163
|
+
fullConfig: config,
|
|
164
|
+
componentConfig: componentConfig,
|
|
165
|
+
componentName: componentName
|
|
166
|
+
};
|
|
167
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(config, componentName, env, commitInfo)];
|
|
168
|
+
case 1:
|
|
169
|
+
return [2 /*return*/, (_a.environment = _b.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
222
173
|
};
|
|
223
|
-
|
|
224
174
|
exports.createContext = createContext;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const resolveReferences: (vars: Record<string, string>, getOtherVariables?: ((componentName: string,
|
|
2
|
-
[k: string]: string;
|
|
3
|
-
};
|
|
1
|
+
export declare const resolveReferences: (vars: Record<string, string>, getOtherVariables?: ((componentName: string, alreadyVisited: Record<string, Record<string, boolean>>) => Promise<Record<string, 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
|
};
|