@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
|
@@ -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,26 +125,21 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
154
125
|
};
|
|
155
126
|
}
|
|
156
127
|
};
|
|
157
|
-
|
|
158
128
|
var __rest = this && this.__rest || function (s, e) {
|
|
159
129
|
var t = {};
|
|
160
|
-
|
|
161
130
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
162
|
-
|
|
163
131
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
164
132
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
165
133
|
}
|
|
166
134
|
return t;
|
|
167
135
|
};
|
|
168
|
-
|
|
169
136
|
var __read = this && this.__read || function (o, n) {
|
|
170
137
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
171
138
|
if (!m) return o;
|
|
172
139
|
var i = m.call(o),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
140
|
+
r,
|
|
141
|
+
ar = [],
|
|
142
|
+
e;
|
|
177
143
|
try {
|
|
178
144
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
179
145
|
} catch (error) {
|
|
@@ -187,10 +153,8 @@ var __read = this && this.__read || function (o, n) {
|
|
|
187
153
|
if (e) throw e.error;
|
|
188
154
|
}
|
|
189
155
|
}
|
|
190
|
-
|
|
191
156
|
return ar;
|
|
192
157
|
};
|
|
193
|
-
|
|
194
158
|
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
195
159
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
196
160
|
if (ar || !(i in from)) {
|
|
@@ -200,184 +164,61 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
200
164
|
}
|
|
201
165
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
202
166
|
};
|
|
203
|
-
|
|
204
167
|
exports.__esModule = true;
|
|
205
|
-
exports.
|
|
206
|
-
|
|
207
|
-
var child_process_promise_1 = require("child-process-promise");
|
|
208
|
-
|
|
168
|
+
exports.createJobsForComponent = void 0;
|
|
209
169
|
var lodash_1 = require("lodash");
|
|
210
|
-
|
|
211
170
|
var build_1 = require("../build");
|
|
212
|
-
|
|
213
171
|
var context_1 = require("../context");
|
|
214
|
-
|
|
215
172
|
var deploy_1 = require("../deploy");
|
|
216
|
-
|
|
217
|
-
var utils_1 = require("../utils");
|
|
218
|
-
|
|
219
|
-
var makeGitlabJob_1 = require("./gitlab/makeGitlabJob");
|
|
220
|
-
|
|
173
|
+
var getCommitInfo_1 = require("./commitInfo/getCommitInfo");
|
|
221
174
|
var packageManager_1 = require("./packageManager");
|
|
222
|
-
|
|
223
175
|
var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
224
176
|
return jobs.map(function (_a) {
|
|
225
177
|
var _b;
|
|
226
|
-
|
|
227
178
|
var variables = _a.variables,
|
|
228
|
-
|
|
229
|
-
|
|
179
|
+
job = __rest(_a, ["variables"]);
|
|
230
180
|
return __assign({
|
|
231
181
|
variables: __assign(__assign({}, (_b = context.environment.envVars) !== null && _b !== void 0 ? _b : {}), variables !== null && variables !== void 0 ? variables : {})
|
|
232
182
|
}, job);
|
|
233
183
|
});
|
|
234
184
|
};
|
|
235
|
-
|
|
236
185
|
var getCustomJobs = function (context) {
|
|
237
186
|
if (!context.componentConfig.customJobs) {
|
|
238
187
|
return [];
|
|
239
188
|
}
|
|
240
|
-
|
|
241
189
|
var rawJobs = (0, lodash_1.isFunction)(context.componentConfig.customJobs) ? context.componentConfig.customJobs(context) : context.componentConfig.customJobs;
|
|
242
190
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
243
191
|
};
|
|
244
|
-
|
|
245
192
|
var createRawJobs = function (context) {
|
|
246
193
|
if (context.componentConfig.deploy === false) {
|
|
247
194
|
return [];
|
|
248
195
|
}
|
|
249
|
-
|
|
250
196
|
var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
|
|
251
197
|
var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
|
|
252
198
|
var customJobs = getCustomJobs(context);
|
|
253
199
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
254
200
|
};
|
|
255
|
-
|
|
256
|
-
var getFullJobName = function (name, componentName, env) {
|
|
257
|
-
if (env) {
|
|
258
|
-
return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return "".concat(componentName, " ").concat(name);
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
|
|
265
|
-
var referencedJob = allRawJobs.find(function (j) {
|
|
266
|
-
return j.name === referencedJobName;
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
if (!referencedJob) {
|
|
270
|
-
throw new Error("unknown job referenced: " + referencedJobName);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
var envToSet = referencedJob.envMode !== "none" ? env : null;
|
|
274
|
-
return getFullJobName(referencedJobName, componentName, envToSet);
|
|
275
|
-
}; // replaces references to other jobs with the full name
|
|
276
|
-
// the full name contains the componentname and the env name (if any)
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
var replaceReferences = function (job, componentName, env, allRawJobs) {
|
|
280
|
-
var _a, _b;
|
|
281
|
-
|
|
282
|
-
var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
283
|
-
return __assign(__assign({}, job), {
|
|
284
|
-
stage: stage,
|
|
285
|
-
needs: (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
|
|
286
|
-
return (0, lodash_1.isObject)(n) ? {
|
|
287
|
-
job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
|
|
288
|
-
artifacts: n.artifacts
|
|
289
|
-
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
290
|
-
}),
|
|
291
|
-
environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
|
|
292
|
-
on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
|
|
293
|
-
}) : job.environment
|
|
294
|
-
});
|
|
295
|
-
}; // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
var addStageNeeds = function (jobs) {
|
|
299
|
-
// when a job defines needsStages, we add these as needs
|
|
300
|
-
return jobs.map(function (job) {
|
|
301
|
-
var _a;
|
|
302
|
-
|
|
303
|
-
if (!job.needsStages || job.needsStages.length === 0) {
|
|
304
|
-
return job;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
var neededJobs = jobs.map(function (j) {
|
|
308
|
-
var _a, _b;
|
|
309
|
-
|
|
310
|
-
var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
|
|
311
|
-
return j.stage === s.stage;
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
if (neededStage) {
|
|
315
|
-
return {
|
|
316
|
-
job: j.name,
|
|
317
|
-
artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}).filter(utils_1.notNil);
|
|
321
|
-
return __assign(__assign({}, job), {
|
|
322
|
-
needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
var createJobs = function (type, envs, config, componentName, trigger) {
|
|
201
|
+
var createJobsForComponent = function (config, componentName, env, trigger) {
|
|
328
202
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
329
|
-
var commitInfo, packageManagerInfo;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var _b;
|
|
334
|
-
|
|
335
|
-
return __generator(this, function (_c) {
|
|
336
|
-
switch (_c.label) {
|
|
203
|
+
var commitInfo, _a, packageManagerInfo, context;
|
|
204
|
+
return __generator(this, function (_b) {
|
|
205
|
+
switch (_b.label) {
|
|
337
206
|
case 0:
|
|
338
|
-
_a = {
|
|
339
|
-
|
|
340
|
-
reviewSlug: process.env.CI_MERGE_REQUEST_IID ? "mr".concat(process.env.CI_MERGE_REQUEST_IID) : "unknown",
|
|
341
|
-
buildTime: new Date().toISOString()
|
|
342
|
-
};
|
|
343
|
-
return [4
|
|
344
|
-
/*yield*/
|
|
345
|
-
, (0, child_process_promise_1.exec)("git describe --tags || git rev-parse HEAD").then(function (s) {
|
|
346
|
-
return s.stdout.trim();
|
|
347
|
-
})];
|
|
348
|
-
|
|
207
|
+
_a = [{}];
|
|
208
|
+
return [4 /*yield*/, (0, getCommitInfo_1.getBaseCommitInfo)()];
|
|
349
209
|
case 1:
|
|
350
|
-
commitInfo = (
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
210
|
+
commitInfo = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), {
|
|
211
|
+
trigger: trigger
|
|
212
|
+
}]);
|
|
213
|
+
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
|
|
355
214
|
case 2:
|
|
356
|
-
packageManagerInfo =
|
|
357
|
-
return [
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
var jobs = addStageNeeds(createRawJobs(context));
|
|
362
|
-
|
|
363
|
-
var result = __assign(__assign({}, acc), jobs.reduce(function (acc, job) {
|
|
364
|
-
var _a;
|
|
365
|
-
|
|
366
|
-
var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
|
|
367
|
-
var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
|
|
368
|
-
|
|
369
|
-
if (type === "gitlab") {
|
|
370
|
-
return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
throw new Error("not supported");
|
|
374
|
-
}, {}));
|
|
375
|
-
|
|
376
|
-
return result;
|
|
377
|
-
}, {})];
|
|
215
|
+
packageManagerInfo = _b.sent();
|
|
216
|
+
return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
|
|
217
|
+
case 3:
|
|
218
|
+
context = _b.sent();
|
|
219
|
+
return [2 /*return*/, createRawJobs(context)];
|
|
378
220
|
}
|
|
379
221
|
});
|
|
380
222
|
});
|
|
381
223
|
};
|
|
382
|
-
|
|
383
|
-
exports.createJobs = createJobs;
|
|
224
|
+
exports.createJobsForComponent = createJobsForComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GitlabJobDef } from "../../types";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
+
import type { AllCatladderJobs } from "../createAllJobs";
|
|
4
|
+
declare type AllGitlabJobs = Record<string, GitlabJobDef>;
|
|
5
|
+
export declare const makeGitlabJob: (componentName: string, env: string, {
|
|
6
|
+
envMode,
|
|
7
|
+
needsStages,
|
|
8
|
+
needsOtherComponent,
|
|
9
|
+
name,
|
|
10
|
+
needs,
|
|
11
|
+
...job
|
|
12
|
+
}: CatladderJob<string>, allJobs: AllCatladderJobs) => [fullName: string, job: GitlabJobDef];
|
|
13
|
+
export declare const createGitlabJobs: (allJobs: AllCatladderJobs) => Promise<AllGitlabJobs>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,260 @@
|
|
|
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
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) {
|
|
15
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
16
|
+
resolve(value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function rejected(value) {
|
|
28
|
+
try {
|
|
29
|
+
step(generator["throw"](value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function step(result) {
|
|
35
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
36
|
+
}
|
|
37
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
41
|
+
var _ = {
|
|
42
|
+
label: 0,
|
|
43
|
+
sent: function () {
|
|
44
|
+
if (t[0] & 1) throw t[1];
|
|
45
|
+
return t[1];
|
|
46
|
+
},
|
|
47
|
+
trys: [],
|
|
48
|
+
ops: []
|
|
49
|
+
},
|
|
50
|
+
f,
|
|
51
|
+
y,
|
|
52
|
+
t,
|
|
53
|
+
g;
|
|
54
|
+
return g = {
|
|
55
|
+
next: verb(0),
|
|
56
|
+
"throw": verb(1),
|
|
57
|
+
"return": verb(2)
|
|
58
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
59
|
+
return this;
|
|
60
|
+
}), g;
|
|
61
|
+
function verb(n) {
|
|
62
|
+
return function (v) {
|
|
63
|
+
return step([n, v]);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function step(op) {
|
|
67
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
68
|
+
while (_) try {
|
|
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;
|
|
70
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
71
|
+
switch (op[0]) {
|
|
72
|
+
case 0:
|
|
73
|
+
case 1:
|
|
74
|
+
t = op;
|
|
75
|
+
break;
|
|
76
|
+
case 4:
|
|
77
|
+
_.label++;
|
|
78
|
+
return {
|
|
79
|
+
value: op[1],
|
|
80
|
+
done: false
|
|
81
|
+
};
|
|
82
|
+
case 5:
|
|
83
|
+
_.label++;
|
|
84
|
+
y = op[1];
|
|
85
|
+
op = [0];
|
|
86
|
+
continue;
|
|
87
|
+
case 7:
|
|
88
|
+
op = _.ops.pop();
|
|
89
|
+
_.trys.pop();
|
|
90
|
+
continue;
|
|
91
|
+
default:
|
|
92
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
93
|
+
_ = 0;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
97
|
+
_.label = op[1];
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
101
|
+
_.label = t[1];
|
|
102
|
+
t = op;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (t && _.label < t[2]) {
|
|
106
|
+
_.label = t[2];
|
|
107
|
+
_.ops.push(op);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (t[2]) _.ops.pop();
|
|
111
|
+
_.trys.pop();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
op = body.call(thisArg, _);
|
|
115
|
+
} catch (e) {
|
|
116
|
+
op = [6, e];
|
|
117
|
+
y = 0;
|
|
118
|
+
} finally {
|
|
119
|
+
f = t = 0;
|
|
120
|
+
}
|
|
121
|
+
if (op[0] & 5) throw op[1];
|
|
122
|
+
return {
|
|
123
|
+
value: op[0] ? op[1] : void 0,
|
|
124
|
+
done: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
129
|
+
var t = {};
|
|
130
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
131
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
132
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
133
|
+
}
|
|
134
|
+
return t;
|
|
135
|
+
};
|
|
136
|
+
var __read = this && this.__read || function (o, n) {
|
|
137
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
138
|
+
if (!m) return o;
|
|
139
|
+
var i = m.call(o),
|
|
140
|
+
r,
|
|
141
|
+
ar = [],
|
|
142
|
+
e;
|
|
143
|
+
try {
|
|
144
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
e = {
|
|
147
|
+
error: error
|
|
148
|
+
};
|
|
149
|
+
} finally {
|
|
150
|
+
try {
|
|
151
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
152
|
+
} finally {
|
|
153
|
+
if (e) throw e.error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return ar;
|
|
157
|
+
};
|
|
158
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
159
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
160
|
+
if (ar || !(i in from)) {
|
|
161
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
162
|
+
ar[i] = from[i];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
166
|
+
};
|
|
167
|
+
exports.__esModule = true;
|
|
168
|
+
exports.createGitlabJobs = exports.makeGitlabJob = void 0;
|
|
169
|
+
var lodash_1 = require("lodash");
|
|
170
|
+
var defaults_1 = require("../../defaults");
|
|
171
|
+
var getFullJobName = function (name, componentName, env) {
|
|
172
|
+
if (env) {
|
|
173
|
+
return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
|
|
174
|
+
}
|
|
175
|
+
return "".concat(componentName, " ").concat(name);
|
|
176
|
+
};
|
|
177
|
+
var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
|
|
180
|
+
return j.name === referencedJobName;
|
|
181
|
+
});
|
|
182
|
+
if (!referencedJob) {
|
|
183
|
+
throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
|
|
184
|
+
}
|
|
185
|
+
var envToSet = referencedJob.envMode !== "none" ? env : null;
|
|
186
|
+
return getFullJobName(referencedJobName, componentName, envToSet);
|
|
187
|
+
};
|
|
188
|
+
var getJobName = function (need) {
|
|
189
|
+
return (0, lodash_1.isObject)(need) ? need.job : need;
|
|
190
|
+
};
|
|
191
|
+
var makeGitlabJob = function (componentName, env, _a, allJobs) {
|
|
192
|
+
var _b;
|
|
193
|
+
var envMode = _a.envMode,
|
|
194
|
+
needsStages = _a.needsStages,
|
|
195
|
+
needsOtherComponent = _a.needsOtherComponent,
|
|
196
|
+
name = _a.name,
|
|
197
|
+
needs = _a.needs,
|
|
198
|
+
job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
|
|
199
|
+
var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
200
|
+
var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
|
|
201
|
+
var _a, _b, _c, _d;
|
|
202
|
+
var referencedComponentName = componentName;
|
|
203
|
+
var allJobNamesFromThatStage = (_d = (_c = (_b = (_a = allJobs[referencedComponentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.filter(function (j) {
|
|
204
|
+
return j.stage === n.stage;
|
|
205
|
+
})) === null || _c === void 0 ? void 0 : _c.map(function (j) {
|
|
206
|
+
return j.name;
|
|
207
|
+
})) !== null && _d !== void 0 ? _d : [];
|
|
208
|
+
return allJobNamesFromThatStage.map(function (job) {
|
|
209
|
+
var _a;
|
|
210
|
+
return {
|
|
211
|
+
job: job,
|
|
212
|
+
artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
|
|
213
|
+
componentName: referencedComponentName
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read(needs !== null && needs !== void 0 ? needs : []), false), __read(needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : []), false), __read(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []), false);
|
|
218
|
+
var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
|
|
219
|
+
var _a;
|
|
220
|
+
return (0, lodash_1.isObject)(n) ? {
|
|
221
|
+
job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
|
|
222
|
+
artifacts: n.artifacts
|
|
223
|
+
} : getFullReferencedJobName(n, componentName, env, allJobs);
|
|
224
|
+
}).sort(function (a, b) {
|
|
225
|
+
return getJobName(a).localeCompare(getJobName(b));
|
|
226
|
+
});
|
|
227
|
+
var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
|
|
228
|
+
var gitlabJob = __assign(__assign({}, job), {
|
|
229
|
+
stage: stage,
|
|
230
|
+
environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
|
|
231
|
+
on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
|
|
232
|
+
}) : job.environment,
|
|
233
|
+
// sort in a predictable manner for snapshot tests
|
|
234
|
+
needs: gitlabNeeds,
|
|
235
|
+
retry: defaults_1.BASE_RETRY,
|
|
236
|
+
interruptible: true
|
|
237
|
+
});
|
|
238
|
+
return [fullJobName, gitlabJob];
|
|
239
|
+
};
|
|
240
|
+
exports.makeGitlabJob = makeGitlabJob;
|
|
241
|
+
var createGitlabJobs = function (allJobs) {
|
|
242
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
243
|
+
return __generator(this, function (_a) {
|
|
244
|
+
return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
|
|
245
|
+
var componentJobs = allJobs[componentName];
|
|
246
|
+
return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
|
|
247
|
+
var jobs = componentJobs[env];
|
|
248
|
+
return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
|
|
249
|
+
var _a;
|
|
250
|
+
var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
|
|
251
|
+
fullJobName = _b[0],
|
|
252
|
+
gitlabJob = _b[1];
|
|
253
|
+
return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
|
|
254
|
+
}, {}));
|
|
255
|
+
}, {}));
|
|
256
|
+
}, {})];
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
exports.createGitlabJobs = createGitlabJobs;
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./createChildPipeline";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./createJobsForComponent";
|
package/dist/pipeline/index.js
CHANGED
|
@@ -12,13 +12,9 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
12
12
|
if (k2 === undefined) k2 = k;
|
|
13
13
|
o[k2] = m[k];
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
17
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
exports.__esModule = true;
|
|
21
|
-
|
|
22
19
|
__exportStar(require("./createChildPipeline"), exports);
|
|
23
|
-
|
|
24
|
-
__exportStar(require("./createJobs"), exports);
|
|
20
|
+
__exportStar(require("./createJobsForComponent"), exports);
|