@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
|
@@ -1,13 +1,127 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) {
|
|
5
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
+
resolve(value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.next(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function step(result) {
|
|
25
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
+
}
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
+
var _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function () {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
},
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function (v) {
|
|
53
|
+
return step([n, v]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (_) try {
|
|
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;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [6, e];
|
|
107
|
+
y = 0;
|
|
108
|
+
} finally {
|
|
109
|
+
f = t = 0;
|
|
110
|
+
}
|
|
111
|
+
if (op[0] & 5) throw op[1];
|
|
112
|
+
return {
|
|
113
|
+
value: op[0] ? op[1] : void 0,
|
|
114
|
+
done: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
3
118
|
var __read = this && this.__read || function (o, n) {
|
|
4
119
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
120
|
if (!m) return o;
|
|
6
121
|
var i = m.call(o),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
122
|
+
r,
|
|
123
|
+
ar = [],
|
|
124
|
+
e;
|
|
11
125
|
try {
|
|
12
126
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
13
127
|
} catch (error) {
|
|
@@ -21,73 +135,120 @@ var __read = this && this.__read || function (o, n) {
|
|
|
21
135
|
if (e) throw e.error;
|
|
22
136
|
}
|
|
23
137
|
}
|
|
24
|
-
|
|
25
138
|
return ar;
|
|
26
139
|
};
|
|
27
|
-
|
|
140
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
141
|
+
return mod && mod.__esModule ? mod : {
|
|
142
|
+
"default": mod
|
|
143
|
+
};
|
|
144
|
+
};
|
|
28
145
|
exports.__esModule = true;
|
|
29
146
|
exports.translateLegacyFromComponents = exports.resolveReferences = void 0;
|
|
30
|
-
|
|
31
147
|
var lodash_1 = require("lodash");
|
|
32
|
-
|
|
148
|
+
var string_replace_async_1 = __importDefault(require("string-replace-async"));
|
|
33
149
|
var REGEX = /\$\{(([^:]+):)?([^}]+)}/gm;
|
|
34
|
-
|
|
35
150
|
var resolveReferences = function (vars, getOtherVariables, alreadyVisitedBase) {
|
|
36
151
|
if (alreadyVisitedBase === void 0) {
|
|
37
152
|
alreadyVisitedBase = {};
|
|
38
153
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
154
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
155
|
+
var replaceSingleValue, _a, _b;
|
|
156
|
+
return __generator(this, function (_c) {
|
|
157
|
+
switch (_c.label) {
|
|
158
|
+
case 0:
|
|
159
|
+
replaceSingleValue = function (value, alreadyVisited) {
|
|
160
|
+
if (alreadyVisited === void 0) {
|
|
161
|
+
alreadyVisited = alreadyVisitedBase;
|
|
162
|
+
}
|
|
163
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
switch (_a.label) {
|
|
166
|
+
case 0:
|
|
167
|
+
if (!REGEX.test(value)) return [3 /*break*/, 2];
|
|
168
|
+
return [4 /*yield*/, (0, string_replace_async_1["default"])(value, REGEX, function (match, _, componentName, variableName) {
|
|
169
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
170
|
+
var newAlreadyVisited, result, _a, replaced, _b;
|
|
171
|
+
var _c, _d;
|
|
172
|
+
var _e, _f;
|
|
173
|
+
return __generator(this, function (_g) {
|
|
174
|
+
switch (_g.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
if ((_e = alreadyVisited[componentName]) === null || _e === void 0 ? void 0 : _e[variableName]) {
|
|
177
|
+
return [2 /*return*/, match]; // prevent endless loop
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
newAlreadyVisited = (0, lodash_1.merge)({}, alreadyVisited, (_c = {}, _c[componentName] = (_d = {}, _d[variableName] = true, _d), _c));
|
|
181
|
+
if (!componentName) return [3 /*break*/, 2];
|
|
182
|
+
return [4 /*yield*/, getOtherVariables === null || getOtherVariables === void 0 ? void 0 : getOtherVariables(componentName, newAlreadyVisited).then(function (r) {
|
|
183
|
+
return r === null || r === void 0 ? void 0 : r[variableName];
|
|
184
|
+
})];
|
|
185
|
+
case 1:
|
|
186
|
+
_a = (_f = _g.sent()) !== null && _f !== void 0 ? _f : null;
|
|
187
|
+
return [3 /*break*/, 3];
|
|
188
|
+
case 2:
|
|
189
|
+
_a = vars[variableName];
|
|
190
|
+
_g.label = 3;
|
|
191
|
+
case 3:
|
|
192
|
+
result = _a;
|
|
193
|
+
if (!(result !== null && result !== undefined)) return [3 /*break*/, 5];
|
|
194
|
+
return [4 /*yield*/, replaceSingleValue(result, newAlreadyVisited)];
|
|
195
|
+
case 4:
|
|
196
|
+
_b = _g.sent();
|
|
197
|
+
return [3 /*break*/, 6];
|
|
198
|
+
case 5:
|
|
199
|
+
_b = match;
|
|
200
|
+
_g.label = 6;
|
|
201
|
+
case 6:
|
|
202
|
+
replaced = _b;
|
|
203
|
+
return [2 /*return*/, replaced];
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
})];
|
|
208
|
+
case 1:
|
|
209
|
+
return [2 /*return*/, _a.sent()];
|
|
210
|
+
case 2:
|
|
211
|
+
return [2 /*return*/, value];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
_b = (_a = Object).fromEntries;
|
|
217
|
+
return [4 /*yield*/, Promise.all(Object.entries(vars).map(function (_a) {
|
|
218
|
+
var _b = __read(_a, 2),
|
|
219
|
+
key = _b[0],
|
|
220
|
+
value = _b[1];
|
|
221
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
222
|
+
var _c;
|
|
223
|
+
return __generator(this, function (_d) {
|
|
224
|
+
switch (_d.label) {
|
|
225
|
+
case 0:
|
|
226
|
+
_c = [key];
|
|
227
|
+
return [4 /*yield*/, replaceSingleValue(value)];
|
|
228
|
+
case 1:
|
|
229
|
+
return [2 /*return*/, _c.concat([_d.sent()])];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}))];
|
|
234
|
+
case 1:
|
|
235
|
+
return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
73
239
|
};
|
|
74
|
-
|
|
75
240
|
exports.resolveReferences = resolveReferences;
|
|
76
|
-
|
|
77
241
|
var translateLegacyFromComponents = function (fromComponents) {
|
|
78
242
|
return Object.fromEntries(Object.entries(fromComponents).flatMap(function (_a) {
|
|
79
243
|
var _b = __read(_a, 2),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
244
|
+
componentName = _b[0],
|
|
245
|
+
variables = _b[1];
|
|
83
246
|
return Object.entries(variables).map(function (_a) {
|
|
84
247
|
var _b = __read(_a, 2),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
248
|
+
ourName = _b[0],
|
|
249
|
+
otherName = _b[1];
|
|
88
250
|
return [ourName, "${" + componentName + ":" + otherName + "}"];
|
|
89
251
|
});
|
|
90
252
|
}));
|
|
91
253
|
};
|
|
92
|
-
|
|
93
254
|
exports.translateLegacyFromComponents = translateLegacyFromComponents;
|
package/dist/defaults/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Retry } from "../types";
|
|
1
|
+
import type { Retry } from "../types";
|
|
2
2
|
export declare const BASE_RETRY: Retry;
|
package/dist/deploy/base.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Context } from "../types";
|
|
2
|
-
import { CatladderJob } from "../types/jobs";
|
|
1
|
+
import type { Context } from "../types";
|
|
2
|
+
import type { CatladderJob } from "../types/jobs";
|
|
3
3
|
export declare const DEPLOY_JOB_NAME = "\uD83D\uDE80 Deploy";
|
|
4
4
|
export declare const STOP_JOB_NAME = "\uD83D\uDED1 Stop \u26A0\uFE0F";
|
|
5
|
+
export declare const ROLLBACK_JOB_NAME = "\u21A9\uFE0F Rollback \u26A0\uFE0F";
|
|
5
6
|
declare type JobWithoutScript = Omit<CatladderJob, "script">;
|
|
6
7
|
export declare const getBaseDeploymentJob: (context: Context) => JobWithoutScript;
|
|
7
8
|
export declare const getBaseDeploymentStopJob: (context: Context) => JobWithoutScript;
|
|
9
|
+
export declare const getBaseRollbackJob: (context: Context) => JobWithoutScript;
|
|
8
10
|
export {};
|
package/dist/deploy/base.js
CHANGED
|
@@ -4,54 +4,47 @@ 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
|
exports.__esModule = true;
|
|
18
|
-
exports.getBaseDeploymentStopJob = exports.getBaseDeploymentJob = exports.STOP_JOB_NAME = exports.DEPLOY_JOB_NAME = void 0;
|
|
19
|
-
|
|
14
|
+
exports.getBaseRollbackJob = exports.getBaseDeploymentStopJob = exports.getBaseDeploymentJob = exports.ROLLBACK_JOB_NAME = exports.STOP_JOB_NAME = exports.DEPLOY_JOB_NAME = void 0;
|
|
20
15
|
var docker_1 = require("../build/docker");
|
|
21
|
-
|
|
22
16
|
var utils_1 = require("./utils");
|
|
23
|
-
|
|
24
17
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
25
18
|
exports.STOP_JOB_NAME = "🛑 Stop ⚠️";
|
|
19
|
+
exports.ROLLBACK_JOB_NAME = "↩️ Rollback ⚠️";
|
|
26
20
|
var DEPLOY_RUNNER_VARIABLES = {
|
|
27
21
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
28
22
|
KUBERNETES_CPU_LIMIT: "1",
|
|
29
23
|
KUBERNETES_MEMORY_REQUEST: "200Mi",
|
|
30
24
|
KUBERNETES_MEMORY_LIMIT: "500Mi"
|
|
31
25
|
};
|
|
32
|
-
|
|
33
26
|
var getBaseDeploymentJob = function (context) {
|
|
34
|
-
var _a;
|
|
35
|
-
|
|
36
|
-
var environment = {
|
|
37
|
-
name: context.environment.fullName,
|
|
38
|
-
url: context.environment.url
|
|
39
|
-
};
|
|
27
|
+
var _a, _b, _c;
|
|
40
28
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
41
29
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
42
|
-
var autoStop = context.environment.envType === "review" ? "
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
var autoStop = context.environment.envType === "review" ? "2 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
31
|
+
// if auto or manual is configured explicitly, use that
|
|
32
|
+
var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when ? context.componentConfig.deploy.when : undefined;
|
|
33
|
+
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
47
34
|
var whenDeployDefault = context.environment.envType !== "prod" ? "auto" // is not stage, auto deploy
|
|
48
35
|
: ((_a = context.componentConfig.env) === null || _a === void 0 ? void 0 : _a.stage) === false ? "auto" // is prod, but no staging, auto deploy
|
|
49
36
|
: "manual"; // manually deploy
|
|
50
|
-
|
|
51
37
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
52
38
|
return {
|
|
53
39
|
name: exports.DEPLOY_JOB_NAME,
|
|
54
40
|
envMode: "stagePerEnv",
|
|
41
|
+
needs: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
|
|
42
|
+
return {
|
|
43
|
+
componentName: c,
|
|
44
|
+
job: exports.DEPLOY_JOB_NAME,
|
|
45
|
+
artifacts: false
|
|
46
|
+
};
|
|
47
|
+
})) !== null && _c !== void 0 ? _c : undefined : undefined,
|
|
55
48
|
// we don't want to deploy when there is a broken test
|
|
56
49
|
needsStages: [{
|
|
57
50
|
stage: "build",
|
|
@@ -67,25 +60,19 @@ var getBaseDeploymentJob = function (context) {
|
|
|
67
60
|
}],
|
|
68
61
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
69
62
|
stage: "deploy",
|
|
70
|
-
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars),
|
|
71
|
-
environment: __assign(__assign({}, environment), isStoppable ? {
|
|
63
|
+
variables: __assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}),
|
|
64
|
+
environment: __assign(__assign({}, context.environment.gitlabEnvironment), isStoppable ? {
|
|
72
65
|
on_stop: exports.STOP_JOB_NAME,
|
|
73
66
|
auto_stop_in: autoStop
|
|
74
67
|
} : {})
|
|
75
68
|
};
|
|
76
69
|
};
|
|
77
|
-
|
|
78
70
|
exports.getBaseDeploymentJob = getBaseDeploymentJob;
|
|
79
|
-
|
|
80
71
|
var getBaseDeploymentStopJob = function (context) {
|
|
81
|
-
var environment = {
|
|
82
|
-
name: context.environment.fullName,
|
|
83
|
-
url: context.environment.url
|
|
84
|
-
};
|
|
85
72
|
return {
|
|
86
73
|
name: exports.STOP_JOB_NAME,
|
|
87
74
|
envMode: "stagePerEnv",
|
|
88
|
-
needs: [
|
|
75
|
+
needs: [],
|
|
89
76
|
rules: [{
|
|
90
77
|
"if": "$CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/",
|
|
91
78
|
when: "on_success",
|
|
@@ -98,10 +85,28 @@ var getBaseDeploymentStopJob = function (context) {
|
|
|
98
85
|
GIT_STRATEGY: "none"
|
|
99
86
|
}),
|
|
100
87
|
stage: "stop",
|
|
101
|
-
environment: __assign(__assign({}, environment), {
|
|
88
|
+
environment: __assign(__assign({}, context.environment.gitlabEnvironment), {
|
|
102
89
|
action: "stop"
|
|
103
90
|
})
|
|
104
91
|
};
|
|
105
92
|
};
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
exports.getBaseDeploymentStopJob = getBaseDeploymentStopJob;
|
|
94
|
+
var getBaseRollbackJob = function (context) {
|
|
95
|
+
return {
|
|
96
|
+
name: exports.ROLLBACK_JOB_NAME,
|
|
97
|
+
envMode: "stagePerEnv",
|
|
98
|
+
needs: [],
|
|
99
|
+
rules: [{
|
|
100
|
+
when: "manual",
|
|
101
|
+
allow_failure: true
|
|
102
|
+
}],
|
|
103
|
+
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
|
|
104
|
+
GIT_STRATEGY: "none"
|
|
105
|
+
}),
|
|
106
|
+
stage: "rollback",
|
|
107
|
+
environment: __assign(__assign({}, context.environment.gitlabEnvironment), {
|
|
108
|
+
action: "access"
|
|
109
|
+
})
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
exports.getBaseRollbackJob = getBaseRollbackJob;
|