@catladder/cli 5.1.3 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/cli/src/commands/project/commandPortForward.js +1 -1
- package/dist/apps/cli/src/commands/project/commandPortForward.js.map +1 -1
- package/dist/apps/cli/src/commands/project/secrets/scope.js +25 -2
- package/dist/apps/cli/src/commands/project/secrets/scope.js.map +1 -1
- package/dist/apps/cli/src/config/getProjectConfig.js +4 -1
- package/dist/apps/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/apps/cli/src/secrets/github.js +4 -2
- package/dist/apps/cli/src/secrets/github.js.map +1 -1
- package/dist/bundles/catenv/index.js +419 -106
- package/dist/bundles/cli/index.js +449 -111
- package/dist/bundles/skills/catladder-config/SKILL.md +34 -2
- package/dist/bundles/skills/catladder-deploys/SKILL.md +5 -0
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +42 -1
- package/dist/bundles/skills/catladder-secrets/SKILL.md +6 -0
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +23 -3
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/createGithubJobs.js +2 -2
- package/dist/packages/pipeline/src/backends/github/createGithubJobs.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +18 -2
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabJobs.js +2 -2
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.d.ts +6 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js +24 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.d.ts +17 -0
- package/dist/packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.js +13 -0
- package/dist/packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.js.map +1 -1
- package/dist/packages/pipeline/src/config/configruedEnvs.d.ts +9 -2
- package/dist/packages/pipeline/src/config/configruedEnvs.js +54 -5
- package/dist/packages/pipeline/src/config/configruedEnvs.js.map +1 -1
- package/dist/packages/pipeline/src/context/createAllComponentsContext.d.ts +2 -2
- package/dist/packages/pipeline/src/context/createComponentContext.d.ts +2 -2
- package/dist/packages/pipeline/src/context/createWorkspaceContext.d.ts +2 -2
- package/dist/packages/pipeline/src/context/getEnvConfig.js +35 -19
- package/dist/packages/pipeline/src/context/getEnvConfig.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvInherit.d.ts +20 -0
- package/dist/packages/pipeline/src/context/getEnvInherit.js +72 -0
- package/dist/packages/pipeline/src/context/getEnvInherit.js.map +1 -0
- package/dist/packages/pipeline/src/context/getEnvInstance.d.ts +4 -0
- package/dist/packages/pipeline/src/context/{getReviewSlug.js → getEnvInstance.js} +13 -9
- package/dist/packages/pipeline/src/context/getEnvInstance.js.map +1 -0
- package/dist/packages/pipeline/src/context/getEnvOn.d.ts +13 -0
- package/dist/packages/pipeline/src/context/getEnvOn.js +28 -0
- package/dist/packages/pipeline/src/context/getEnvOn.js.map +1 -0
- package/dist/packages/pipeline/src/context/getEnvType.d.ts +8 -2
- package/dist/packages/pipeline/src/context/getEnvType.js +27 -5
- package/dist/packages/pipeline/src/context/getEnvType.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvironment.js +3 -0
- package/dist/packages/pipeline/src/context/getEnvironment.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvironmentContext.js +18 -8
- package/dist/packages/pipeline/src/context/getEnvironmentContext.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
- package/dist/packages/pipeline/src/context/getEnvironmentVariables.js +4 -4
- package/dist/packages/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/packages/pipeline/src/context/index.d.ts +1 -0
- package/dist/packages/pipeline/src/context/index.js +1 -0
- package/dist/packages/pipeline/src/context/index.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/base/deploy.js +11 -1
- package/dist/packages/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/artifactsRegistry.js +5 -4
- package/dist/packages/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/cleanup.js +8 -2
- package/dist/packages/pipeline/src/deploy/cloudRun/cleanup.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/index.js +2 -2
- package/dist/packages/pipeline/src/deploy/cloudRun/index.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/utils/getServiceName.js +2 -2
- package/dist/packages/pipeline/src/deploy/cloudRun/utils/getServiceName.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/kubernetes/index.js +3 -3
- package/dist/packages/pipeline/src/deploy/kubernetes/index.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/pages/deployJob.js +3 -2
- package/dist/packages/pipeline/src/deploy/pages/deployJob.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/types/googleCloudRun.d.ts +9 -0
- package/dist/packages/pipeline/src/types/config.d.ts +126 -9
- package/dist/packages/pipeline/src/types/config.js +11 -10
- package/dist/packages/pipeline/src/types/config.js.map +1 -1
- package/dist/packages/pipeline/src/types/context.d.ts +22 -3
- package/dist/packages/pipeline/src/types/context.js.map +1 -1
- package/dist/packages/pipeline/src/types/environmentContext.d.ts +29 -0
- package/dist/packages/pipeline/src/types/gitlab-types.d.ts +29 -1
- package/dist/skills/catladder-config/SKILL.md +34 -2
- package/dist/skills/catladder-deploys/SKILL.md +5 -0
- package/dist/skills/catladder-pipelines/SKILL.md +42 -1
- package/dist/skills/catladder-secrets/SKILL.md +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/commands/project/commandPortForward.ts +1 -1
- package/src/commands/project/secrets/scope.ts +38 -2
- package/src/config/getProjectConfig.ts +9 -1
- package/src/secrets/github.ts +8 -5
- package/dist/packages/pipeline/src/context/getReviewSlug.d.ts +0 -4
- package/dist/packages/pipeline/src/context/getReviewSlug.js.map +0 -1
|
@@ -7,6 +7,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
7
7
|
stage: string;
|
|
8
8
|
image: string;
|
|
9
9
|
script: string[];
|
|
10
|
+
interruptible: true;
|
|
10
11
|
allow_failure: true;
|
|
11
12
|
artifacts: {
|
|
12
13
|
paths: string[];
|
|
@@ -42,6 +43,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
42
43
|
image: string;
|
|
43
44
|
script: string[];
|
|
44
45
|
after_script: string[];
|
|
46
|
+
interruptible: false;
|
|
45
47
|
};
|
|
46
48
|
"create release": {
|
|
47
49
|
rules: {
|
|
@@ -58,6 +60,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
58
60
|
image: string;
|
|
59
61
|
script: string[];
|
|
60
62
|
after_script: string[];
|
|
63
|
+
interruptible: false;
|
|
61
64
|
needs?: undefined;
|
|
62
65
|
allow_failure?: undefined;
|
|
63
66
|
};
|
|
@@ -81,6 +84,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
81
84
|
image: string;
|
|
82
85
|
script: string[];
|
|
83
86
|
after_script: string[];
|
|
87
|
+
interruptible: false;
|
|
84
88
|
};
|
|
85
89
|
"create release": {
|
|
86
90
|
rules: {
|
|
@@ -97,6 +101,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
97
101
|
image: string;
|
|
98
102
|
script: string[];
|
|
99
103
|
after_script: string[];
|
|
104
|
+
interruptible: false;
|
|
100
105
|
needs?: undefined;
|
|
101
106
|
allow_failure?: undefined;
|
|
102
107
|
};
|
|
@@ -105,6 +110,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
105
110
|
stage: string;
|
|
106
111
|
image: string;
|
|
107
112
|
script: string[];
|
|
113
|
+
interruptible: true;
|
|
108
114
|
allow_failure: true;
|
|
109
115
|
artifacts: {
|
|
110
116
|
paths: string[];
|
|
@@ -140,6 +146,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
140
146
|
image: string;
|
|
141
147
|
script: string[];
|
|
142
148
|
after_script: string[];
|
|
149
|
+
interruptible: false;
|
|
143
150
|
};
|
|
144
151
|
"create release": {
|
|
145
152
|
allow_failure: true;
|
|
@@ -157,6 +164,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
157
164
|
image: string;
|
|
158
165
|
script: string[];
|
|
159
166
|
after_script: string[];
|
|
167
|
+
interruptible: false;
|
|
160
168
|
needs?: undefined;
|
|
161
169
|
};
|
|
162
170
|
} | {
|
|
@@ -179,6 +187,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
179
187
|
image: string;
|
|
180
188
|
script: string[];
|
|
181
189
|
after_script: string[];
|
|
190
|
+
interruptible: false;
|
|
182
191
|
};
|
|
183
192
|
"create release": {
|
|
184
193
|
allow_failure: true;
|
|
@@ -196,6 +205,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
196
205
|
image: string;
|
|
197
206
|
script: string[];
|
|
198
207
|
after_script: string[];
|
|
208
|
+
interruptible: false;
|
|
199
209
|
needs?: undefined;
|
|
200
210
|
};
|
|
201
211
|
} | {
|
|
@@ -203,6 +213,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
203
213
|
stage: string;
|
|
204
214
|
image: string;
|
|
205
215
|
script: string[];
|
|
216
|
+
interruptible: true;
|
|
206
217
|
allow_failure: true;
|
|
207
218
|
artifacts: {
|
|
208
219
|
paths: string[];
|
|
@@ -238,11 +249,13 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
238
249
|
image: string;
|
|
239
250
|
script: string[];
|
|
240
251
|
after_script: string[];
|
|
252
|
+
interruptible: false;
|
|
241
253
|
};
|
|
242
254
|
"create release": {
|
|
243
255
|
stage: string;
|
|
244
256
|
image: string;
|
|
245
257
|
script: string[];
|
|
258
|
+
interruptible: false;
|
|
246
259
|
needs: any[];
|
|
247
260
|
allow_failure: true;
|
|
248
261
|
rules: {
|
|
@@ -277,6 +290,7 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
277
290
|
image: string;
|
|
278
291
|
script: string[];
|
|
279
292
|
after_script: string[];
|
|
293
|
+
interruptible: false;
|
|
280
294
|
};
|
|
281
295
|
} | {
|
|
282
296
|
"\uD83E\uDD8B changeset check"?: undefined;
|
|
@@ -298,11 +312,13 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
298
312
|
image: string;
|
|
299
313
|
script: string[];
|
|
300
314
|
after_script: string[];
|
|
315
|
+
interruptible: false;
|
|
301
316
|
};
|
|
302
317
|
"create release": {
|
|
303
318
|
stage: string;
|
|
304
319
|
image: string;
|
|
305
320
|
script: string[];
|
|
321
|
+
interruptible: false;
|
|
306
322
|
needs: any[];
|
|
307
323
|
allow_failure: true;
|
|
308
324
|
rules: {
|
|
@@ -337,5 +353,6 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
337
353
|
image: string;
|
|
338
354
|
script: string[];
|
|
339
355
|
after_script: string[];
|
|
356
|
+
interruptible: false;
|
|
340
357
|
};
|
|
341
358
|
};
|
|
@@ -53,6 +53,12 @@ mainBranchJobNames) => {
|
|
|
53
53
|
image: releaseImage,
|
|
54
54
|
script: [method.script],
|
|
55
55
|
after_script: [EXPIRED_TOKEN_HELP],
|
|
56
|
+
// a release in flight must never be killed by a new commit — a
|
|
57
|
+
// half-published version (tag pushed, npm publish missing) is not
|
|
58
|
+
// recoverable by re-running. Under gitlab's default "conservative"
|
|
59
|
+
// auto-cancel this also shields the rest of the pipeline, but only
|
|
60
|
+
// once the release actually started, which is late by construction.
|
|
61
|
+
interruptible: false,
|
|
56
62
|
};
|
|
57
63
|
const forceReleaseJob = {
|
|
58
64
|
["⚠️ force create release"]: {
|
|
@@ -76,6 +82,10 @@ mainBranchJobNames) => {
|
|
|
76
82
|
stage: "test",
|
|
77
83
|
image: releaseImage,
|
|
78
84
|
script: [method.checkScript],
|
|
85
|
+
// a redundant report is worthless: without this the job
|
|
86
|
+
// defaults to interruptible: false and, once started, stops
|
|
87
|
+
// gitlab from auto-cancelling the superseded MR pipeline
|
|
88
|
+
interruptible: true,
|
|
79
89
|
allow_failure: true,
|
|
80
90
|
artifacts: {
|
|
81
91
|
paths: ["changeset-report.md"],
|
|
@@ -145,6 +155,9 @@ mainBranchJobNames) => {
|
|
|
145
155
|
script: [
|
|
146
156
|
`echo "release queued — '${exports.RELEASE_EXECUTOR_JOB_NAME}' runs it as soon as every other job in this pipeline succeeded"`,
|
|
147
157
|
],
|
|
158
|
+
// the recorded intent must survive a new commit: cancelling it
|
|
159
|
+
// would silently drop the queued release
|
|
160
|
+
interruptible: false,
|
|
148
161
|
needs: [],
|
|
149
162
|
// allow_failure keeps the unclicked button from blocking the
|
|
150
163
|
// pipeline AND makes the executor's needs treat it as optional
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlabReleaseJobs.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.ts"],"names":[],"mappings":";;;AAAA,uCAOqB;AAErB,2CAAiD;AAIjD,MAAM,kBAAkB,GACtB,gJAAgJ,CAAC;AAEnJ;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEf,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AAC3C,QAAA,yBAAyB,GAAG,mCAAmC,CAAC;AAE7E,MAAM,gBAAgB,GAAG;IACvB,oCAA4B;IAC5B,mCAA2B;IAC3B,8BAAsB;CACvB,CAAC;AAEF,sEAAsE;AACtE,mEAAmE;AACnE,uEAAuE;AACvE,oCAAoC;AACpC,MAAM,kBAAkB,GAAG;IACzB,GAAG,gBAAgB;IACnB;QACE,EAAE,EAAE,kCAA0B;QAC9B,IAAI,EAAE,QAAQ;KACf;IACD;QACE,EAAE,EAAE,oCAA4B;QAChC,IAAI,EAAE,QAAQ;KACf;CACqB,CAAC;AAElB,MAAM,oBAAoB,GAAG,CAClC,MAAc,EACd,MAAqB;AACrB;;;;GAIG;AACH,kBAA4B,EAC5B,EAAE;;IACF,MAAM,MAAM,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC;IACxC,qEAAqE;IACrE,qEAAqE;IACrE,kEAAkE;IAClE,uCAAuC;IACvC,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,cAAc,EAAE,MAAM,CAAC,KAAK;KAC7B,CAAC,CAAC,KAAK,CAAC;IAET,MAAM,cAAc,GAAG;QACrB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;QACvB,YAAY,EAAE,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"gitlabReleaseJobs.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.ts"],"names":[],"mappings":";;;AAAA,uCAOqB;AAErB,2CAAiD;AAIjD,MAAM,kBAAkB,GACtB,gJAAgJ,CAAC;AAEnJ;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEf,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AAC3C,QAAA,yBAAyB,GAAG,mCAAmC,CAAC;AAE7E,MAAM,gBAAgB,GAAG;IACvB,oCAA4B;IAC5B,mCAA2B;IAC3B,8BAAsB;CACvB,CAAC;AAEF,sEAAsE;AACtE,mEAAmE;AACnE,uEAA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OAAO,CAAC,IAAI,CACV,6CAA6C,gBAAgB,UAAU;YACrE,QAAQ,+BAAuB,qCAAqC;YACpE,0DAA0D,gBAAgB,GAAG,CAChF,CAAC;QACF,OAAO;YACL,CAAC,+BAAuB,CAAC,EAAE;gBACzB,GAAG,cAAc;gBACjB,aAAa,EAAE,IAAI;gBACnB,KAAK,EAAE,kBAAkB;aACH;YACxB,GAAG,eAAe;YAClB,GAAG,QAAQ;SACZ,CAAC;IACJ,CAAC;IAED,OAAO;QACL,oEAAoE;QACpE,kEAAkE;QAClE,qEAAqE;QACrE,qEAAqE;QACrE,CAAC,+BAAuB,CAAC,EAAE;YACzB,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE;gBACN,2BAA2B,iCAAyB,kEAAkE;aACvH;YACD,+DAA+D;YAC/D,yCAAyC;YACzC,aAAa,EAAE,KAAK;YACpB,KAAK,EAAE,EAAE;YACT,6DAA6D;YAC7D,+DAA+D;YAC/D,2DAA2D;YAC3D,aAAa,EAAE,IAAI;YACnB,KAAK,EAAE,kBAAkB;SACH;QACxB,mEAAmE;QACnE,oEAAoE;QACpE,kEAAkE;QAClE,sCAAsC;QACtC,CAAC,iCAAyB,CAAC,EAAE;YAC3B,GAAG,cAAc;YACjB,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE;gBACL,GAAG,gBAAgB;gBACnB;oBACE,EAAE,EAAE,kCAA0B;oBAC9B,IAAI,EAAE,YAAY;iBACnB;gBACD;oBACE,EAAE,EAAE,oCAA4B;oBAChC,IAAI,EAAE,YAAY;iBACnB;aACqB;SACF;QACxB,GAAG,eAAe;QAClB,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AAtKW,QAAA,oBAAoB,wBAsK/B"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type { Config,
|
|
1
|
+
import type { BranchPipelineTrigger, Config, EnvPipelineTrigger } from "../types";
|
|
2
2
|
export declare const getAllEnvs: (config: Config, componentName: string) => string[];
|
|
3
3
|
export declare const getAllEnvsInAllComponents: (config: Config) => string[];
|
|
4
|
-
export declare const getAllEnvsByTrigger: (config: Config, componentName: string, trigger:
|
|
4
|
+
export declare const getAllEnvsByTrigger: (config: Config, componentName: string, trigger: EnvPipelineTrigger) => string[];
|
|
5
|
+
/**
|
|
6
|
+
* all branch triggers declared by any env of any component (via
|
|
7
|
+
* `on: { branch: "..." }`), deduplicated and sorted for deterministic
|
|
8
|
+
* pipeline generation. Each gets its own pipeline next to the built-in
|
|
9
|
+
* triggers.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getConfiguredBranchTriggers: (config: Config) => BranchPipelineTrigger[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllEnvsByTrigger = exports.getAllEnvsInAllComponents = exports.getAllEnvs = void 0;
|
|
3
|
+
exports.getConfiguredBranchTriggers = exports.getAllEnvsByTrigger = exports.getAllEnvsInAllComponents = exports.getAllEnvs = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
+
const getEnvOn_1 = require("../context/getEnvOn");
|
|
6
|
+
const getEnvType_1 = require("../context/getEnvType");
|
|
5
7
|
const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
6
8
|
var _a, _b;
|
|
7
9
|
const configuredEnvs = (_a = config.components[componentName].env) !== null && _a !== void 0 ? _a : {};
|
|
@@ -9,13 +11,33 @@ const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
|
9
11
|
// these can be disabled with settimg them to `false`
|
|
10
12
|
// this is the list of all not disabled envs. These are always returned
|
|
11
13
|
const enabledDefaultEnvs = envTypes.filter((e) => configuredEnvs[e] !== false);
|
|
12
|
-
|
|
14
|
+
// envs declared project-wide (top-level `environments`): every
|
|
15
|
+
// component deploys to them unless it opts out with `env.<name>: false`
|
|
16
|
+
const declaredEnvs = Object.keys((_b = config.environments) !== null && _b !== void 0 ? _b : {})
|
|
17
|
+
.filter((envName) => !(0, types_1.isKnowEnvType)(envName)) // default envs are already handled above
|
|
18
|
+
.map((envName) => {
|
|
19
|
+
const envType = (0, getEnvType_1.getDeclaredEnvType)(config.environments, envName);
|
|
20
|
+
if (!envType) {
|
|
21
|
+
throw new Error(`environment "${envName}" needs a type (dev, review, stage, prod) or an inherit`);
|
|
22
|
+
}
|
|
23
|
+
return [envName, envType];
|
|
24
|
+
})
|
|
25
|
+
.filter(([envName, envType]) => envTypes.includes(envType) && configuredEnvs[envName] !== false)
|
|
26
|
+
.map(([envName]) => envName);
|
|
27
|
+
// legacy: custom envs declared per component via their `type`
|
|
28
|
+
const configuredCustomEnvs = Object.entries(configuredEnvs)
|
|
13
29
|
.filter(([, config]) => config &&
|
|
14
30
|
"type" in config &&
|
|
15
31
|
config.type &&
|
|
16
32
|
envTypes.includes(config.type))
|
|
17
33
|
.map(([envName]) => envName);
|
|
18
|
-
return [
|
|
34
|
+
return [
|
|
35
|
+
...new Set([
|
|
36
|
+
...enabledDefaultEnvs,
|
|
37
|
+
...declaredEnvs,
|
|
38
|
+
...configuredCustomEnvs,
|
|
39
|
+
]),
|
|
40
|
+
];
|
|
19
41
|
};
|
|
20
42
|
const getAllEnvs = (config, componentName) => {
|
|
21
43
|
return getConfiguredAndDefaultEnvs(config, componentName, types_1.DEFAULT_ENV_TYPES);
|
|
@@ -27,9 +49,36 @@ const getAllEnvsInAllComponents = (config) => {
|
|
|
27
49
|
];
|
|
28
50
|
};
|
|
29
51
|
exports.getAllEnvsInAllComponents = getAllEnvsInAllComponents;
|
|
52
|
+
/**
|
|
53
|
+
* the resolved `on` of one env of a component (the project-wide `on`
|
|
54
|
+
* of the env, falling back to the env type's default trigger)
|
|
55
|
+
*/
|
|
56
|
+
const getEnvOnForComponentEnv = (config, componentName, env) => {
|
|
57
|
+
var _a;
|
|
58
|
+
const entry = (_a = config.components[componentName].env) === null || _a === void 0 ? void 0 : _a[env];
|
|
59
|
+
return (0, getEnvOn_1.getEnvOn)(env, entry && entry !== false ? entry : {}, config.environments);
|
|
60
|
+
};
|
|
30
61
|
const getAllEnvsByTrigger = (config, componentName, trigger) => {
|
|
31
|
-
|
|
32
|
-
return getConfiguredAndDefaultEnvs(config, componentName, envTypesByTrigger);
|
|
62
|
+
return (0, exports.getAllEnvs)(config, componentName).filter((env) => (0, types_1.envTriggerEquals)(getEnvOnForComponentEnv(config, componentName, env), trigger));
|
|
33
63
|
};
|
|
34
64
|
exports.getAllEnvsByTrigger = getAllEnvsByTrigger;
|
|
65
|
+
/**
|
|
66
|
+
* all branch triggers declared by any env of any component (via
|
|
67
|
+
* `on: { branch: "..." }`), deduplicated and sorted for deterministic
|
|
68
|
+
* pipeline generation. Each gets its own pipeline next to the built-in
|
|
69
|
+
* triggers.
|
|
70
|
+
*/
|
|
71
|
+
const getConfiguredBranchTriggers = (config) => {
|
|
72
|
+
const branches = new Set();
|
|
73
|
+
for (const componentName of Object.keys(config.components)) {
|
|
74
|
+
for (const env of (0, exports.getAllEnvs)(config, componentName)) {
|
|
75
|
+
const on = getEnvOnForComponentEnv(config, componentName, env);
|
|
76
|
+
if (on && (0, types_1.isBranchTrigger)(on)) {
|
|
77
|
+
branches.add(on.branch);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return [...branches].sort().map((branch) => ({ branch }));
|
|
82
|
+
};
|
|
83
|
+
exports.getConfiguredBranchTriggers = getConfiguredBranchTriggers;
|
|
35
84
|
//# sourceMappingURL=configruedEnvs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configruedEnvs.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/config/configruedEnvs.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"configruedEnvs.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/config/configruedEnvs.ts"],"names":[],"mappings":";;;AAMA,oCAKkB;AAClB,kDAA+C;AAC/C,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ACjC,MAAc,EACd,aAAqB,EACrB,OAA2B,EAC3B,EAAE;IACF,OAAO,IAAA,kBAAU,EAAC,MAAM,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CACtD,IAAA,wBAAgB,EACd,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,EACnD,OAAO,CACR,CACF,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B;AAEF;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,CACzC,MAAc,EACW,EAAE;IAC3B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,KAAK,MAAM,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3D,KAAK,MAAM,GAAG,IAAI,IAAA,kBAAU,EAAC,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC;YACpD,MAAM,EAAE,GAAG,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;YAC/D,IAAI,EAAE,IAAI,IAAA,uBAAe,EAAC,EAAE,CAAC,EAAE,CAAC;gBAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentContext, PipelineType } from "../types";
|
|
2
|
-
import type { Config,
|
|
2
|
+
import type { Config, EnvPipelineTrigger } from "../types/config";
|
|
3
3
|
export type CreateAllComponentsContextProps = {
|
|
4
4
|
config: Config;
|
|
5
|
-
trigger:
|
|
5
|
+
trigger: EnvPipelineTrigger;
|
|
6
6
|
pipelineType: PipelineType;
|
|
7
7
|
};
|
|
8
8
|
export declare const createAllComponentsContext: ({ config, trigger, pipelineType, }: CreateAllComponentsContextProps) => Promise<Array<ComponentContext>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PipelineType } from "../types";
|
|
2
|
-
import type { Config,
|
|
2
|
+
import type { Config, EnvPipelineTrigger } from "../types/config";
|
|
3
3
|
import type { ComponentContext } from "../types/context";
|
|
4
4
|
export type CreateComponentContextContext = {
|
|
5
5
|
config: Config;
|
|
6
6
|
componentName: string;
|
|
7
7
|
env: string;
|
|
8
8
|
pipelineType?: PipelineType;
|
|
9
|
-
trigger?:
|
|
9
|
+
trigger?: EnvPipelineTrigger;
|
|
10
10
|
};
|
|
11
11
|
export declare const createComponentContext: (ctx: CreateComponentContextContext) => Promise<ComponentContext>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type Config, type
|
|
1
|
+
import { type Config, type EnvPipelineTrigger, type PipelineType, type WorkspaceContext } from "..";
|
|
2
2
|
export declare function createWorkspaceContext({ env, components, workspaceName, config, pipelineType, trigger, }: {
|
|
3
3
|
env: string;
|
|
4
4
|
components: WorkspaceContext["components"];
|
|
5
5
|
workspaceName: string;
|
|
6
6
|
config: Config;
|
|
7
7
|
pipelineType: PipelineType;
|
|
8
|
-
trigger:
|
|
8
|
+
trigger: EnvPipelineTrigger;
|
|
9
9
|
}): Promise<WorkspaceContext>;
|
|
@@ -2,33 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEnvConfig = void 0;
|
|
4
4
|
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
const getEnvInherit_1 = require("./getEnvInherit");
|
|
5
6
|
const getEnvConfig = (config, componentName, env) => {
|
|
6
|
-
var _a
|
|
7
|
+
var _a;
|
|
7
8
|
const defaultConfig = config.components[componentName];
|
|
8
9
|
if (!defaultConfig) {
|
|
9
10
|
throw new Error("unknown component " + componentName);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* env config is merged with default. Arrays are not merged.
|
|
18
|
-
* you can customize this by providing a function that takes the default value as argument
|
|
19
|
-
*/
|
|
20
|
-
return (0, lodash_es_1.mergeWith)(
|
|
12
|
+
// env config is layered onto the component config: the per-component
|
|
13
|
+
// overrides of inherited envs first (oldest ancestor first, see
|
|
14
|
+
// `environments.<name>.inherit`), the env's own overrides last
|
|
15
|
+
const chain = [...(0, getEnvInherit_1.getInheritedConfigChain)(config.environments, env), env];
|
|
21
16
|
// mergeWith unfortunatly mutates the first object, so we need to clone it.
|
|
22
17
|
// Passing empty object also doesn't work for us, because that will mess with the customizer function (second argument isn't nessecary the customized value)
|
|
23
|
-
(0, lodash_es_1.cloneDeep)(defaultConfig)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
const result = (0, lodash_es_1.cloneDeep)(defaultConfig);
|
|
19
|
+
for (const chainEnv of chain) {
|
|
20
|
+
const envCustomizations = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[chainEnv];
|
|
21
|
+
if (!envCustomizations || envCustomizations === false) {
|
|
22
|
+
if (chainEnv === env && envCustomizations === false) {
|
|
23
|
+
// env is disabled, still return the default config
|
|
24
|
+
return defaultConfig;
|
|
25
|
+
}
|
|
26
|
+
continue;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* env config is merged with default. Arrays are not merged.
|
|
30
|
+
* you can customize this by providing a function that takes the default value as argument
|
|
31
|
+
*/
|
|
32
|
+
(0, lodash_es_1.mergeWith)(result,
|
|
33
|
+
// `host` must stay unique per env and `type` is the inherited
|
|
34
|
+
// env's identity — neither is inherited
|
|
35
|
+
chainEnv === env
|
|
36
|
+
? envCustomizations
|
|
37
|
+
: (0, lodash_es_1.omit)(envCustomizations, ["host", "type"]), (defaultValue, customValue, key, obj, source) => {
|
|
38
|
+
// check if custom value is a function (and default is not),
|
|
39
|
+
// we currently don't have config options, that are functions, but we might in the future (customJobs is an exception)
|
|
40
|
+
if (typeof customValue === "function" &&
|
|
41
|
+
typeof defaultValue !== "function") {
|
|
42
|
+
return customValue(defaultValue);
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
32
48
|
};
|
|
33
49
|
exports.getEnvConfig = getEnvConfig;
|
|
34
50
|
//# sourceMappingURL=getEnvConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEnvConfig.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/context/getEnvConfig.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"getEnvConfig.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/context/getEnvConfig.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAEvD,mDAA0D;AAEnD,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,aAAqB,EACrB,GAAW,EACa,EAAE;;IAC1B,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,aAAa,CAAC,CAAC;IACxD,CAAC;IAED,qEAAqE;IACrE,gEAAgE;IAChE,+DAA+D;IAC/D,MAAM,KAAK,GAAG,CAAC,GAAG,IAAA,uCAAuB,EAAC,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAE1E,2EAA2E;IAC3E,4JAA4J;IAC5J,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,aAAa,CAAC,CAAC;IAExC,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;QAC7B,MAAM,iBAAiB,GAAG,MAAA,aAAa,CAAC,GAAG,0CAAG,QAAQ,CAAC,CAAC;QACxD,IAAI,CAAC,iBAAiB,IAAI,iBAAiB,KAAK,KAAK,EAAE,CAAC;YACtD,IAAI,QAAQ,KAAK,GAAG,IAAI,iBAAiB,KAAK,KAAK,EAAE,CAAC;gBACpD,mDAAmD;gBACnD,OAAO,aAAa,CAAC;YACvB,CAAC;YACD,SAAS;QACX,CAAC;QACD;;;WAGG;QACH,IAAA,qBAAS,EACP,MAAM;QACN,8DAA8D;QAC9D,wCAAwC;QACxC,QAAQ,KAAK,GAAG;YACd,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,IAAA,gBAAI,EAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC7C,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;YAC9C,4DAA4D;YAC5D,sHAAsH;YACtH,IACE,OAAO,WAAW,KAAK,UAAU;gBACjC,OAAO,YAAY,KAAK,UAAU,EAClC,CAAC;gBACD,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC;YACnC,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAvDW,QAAA,YAAY,gBAuDvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EnvironmentConfig } from "../types/config";
|
|
2
|
+
type Environments = Record<string, EnvironmentConfig> | undefined;
|
|
3
|
+
export type NormalizedEnvInherit = {
|
|
4
|
+
config?: string;
|
|
5
|
+
secrets?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const normalizeEnvInherit: (inherit: EnvironmentConfig["inherit"]) => NormalizedEnvInherit;
|
|
8
|
+
/**
|
|
9
|
+
* the chain of envs whose per-component config overrides feed into
|
|
10
|
+
* `env`, oldest ancestor first (env itself not included). Cycles and
|
|
11
|
+
* unknown/`local` targets are an error.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getInheritedConfigChain: (environments: Environments, env: string) => string[];
|
|
14
|
+
/**
|
|
15
|
+
* the env whose secret values `env` uses (follows `inherit` secret
|
|
16
|
+
* sharing transitively; the env itself when it has its own secrets).
|
|
17
|
+
* All secret variable names must be built with this env.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getSecretsEnv: (environments: Environments, env: string) => string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSecretsEnv = exports.getInheritedConfigChain = exports.normalizeEnvInherit = void 0;
|
|
4
|
+
const config_1 = require("../types/config");
|
|
5
|
+
const normalizeEnvInherit = (inherit) => {
|
|
6
|
+
if (!inherit)
|
|
7
|
+
return {};
|
|
8
|
+
if (typeof inherit === "string") {
|
|
9
|
+
return { config: inherit, secrets: inherit };
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
config: inherit.config,
|
|
13
|
+
secrets: inherit.secrets === false ? undefined : inherit.secrets,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.normalizeEnvInherit = normalizeEnvInherit;
|
|
17
|
+
const assertValidInheritTarget = (environments, env, target) => {
|
|
18
|
+
if (target === "local") {
|
|
19
|
+
throw new Error(`environment "${env}" cannot inherit from "local" — local is not a deployment environment`);
|
|
20
|
+
}
|
|
21
|
+
if (!(0, config_1.isKnowEnvType)(target) && !(environments === null || environments === void 0 ? void 0 : environments[target])) {
|
|
22
|
+
throw new Error(`environment "${env}" inherits from unknown environment "${target}"`);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* the chain of envs whose per-component config overrides feed into
|
|
27
|
+
* `env`, oldest ancestor first (env itself not included). Cycles and
|
|
28
|
+
* unknown/`local` targets are an error.
|
|
29
|
+
*/
|
|
30
|
+
const getInheritedConfigChain = (environments, env) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const chain = [];
|
|
33
|
+
const seen = new Set([env]);
|
|
34
|
+
let current = env;
|
|
35
|
+
for (;;) {
|
|
36
|
+
const target = (0, exports.normalizeEnvInherit)((_a = environments === null || environments === void 0 ? void 0 : environments[current]) === null || _a === void 0 ? void 0 : _a.inherit).config;
|
|
37
|
+
if (!target)
|
|
38
|
+
break;
|
|
39
|
+
assertValidInheritTarget(environments, current, target);
|
|
40
|
+
if (seen.has(target)) {
|
|
41
|
+
throw new Error(`environment "${env}" has a cyclic config inheritance via "${target}"`);
|
|
42
|
+
}
|
|
43
|
+
seen.add(target);
|
|
44
|
+
chain.unshift(target);
|
|
45
|
+
current = target;
|
|
46
|
+
}
|
|
47
|
+
return chain;
|
|
48
|
+
};
|
|
49
|
+
exports.getInheritedConfigChain = getInheritedConfigChain;
|
|
50
|
+
/**
|
|
51
|
+
* the env whose secret values `env` uses (follows `inherit` secret
|
|
52
|
+
* sharing transitively; the env itself when it has its own secrets).
|
|
53
|
+
* All secret variable names must be built with this env.
|
|
54
|
+
*/
|
|
55
|
+
const getSecretsEnv = (environments, env) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const seen = new Set([env]);
|
|
58
|
+
let current = env;
|
|
59
|
+
for (;;) {
|
|
60
|
+
const target = (0, exports.normalizeEnvInherit)((_a = environments === null || environments === void 0 ? void 0 : environments[current]) === null || _a === void 0 ? void 0 : _a.inherit).secrets;
|
|
61
|
+
if (!target)
|
|
62
|
+
return current;
|
|
63
|
+
assertValidInheritTarget(environments, current, target);
|
|
64
|
+
if (seen.has(target)) {
|
|
65
|
+
throw new Error(`environment "${env}" has a cyclic secrets inheritance via "${target}"`);
|
|
66
|
+
}
|
|
67
|
+
seen.add(target);
|
|
68
|
+
current = target;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.getSecretsEnv = getSecretsEnv;
|
|
72
|
+
//# sourceMappingURL=getEnvInherit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEnvInherit.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/context/getEnvInherit.ts"],"names":[],"mappings":";;;AACA,4CAAgD;AASzC,MAAM,mBAAmB,GAAG,CACjC,OAAqC,EACf,EAAE;IACxB,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO;KACjE,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B;AAEF,MAAM,wBAAwB,GAAG,CAC/B,YAA0B,EAC1B,GAAW,EACX,MAAc,EACd,EAAE;IACF,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,gBAAgB,GAAG,uEAAuE,CAC3F,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAA,sBAAa,EAAC,MAAM,CAAC,IAAI,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,MAAM,CAAC,CAAA,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CACb,gBAAgB,GAAG,wCAAwC,MAAM,GAAG,CACrE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACI,MAAM,uBAAuB,GAAG,CACrC,YAA0B,EAC1B,GAAW,EACD,EAAE;;IACZ,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,IAAI,OA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C;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjB,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AApBW,QAAA,aAAa,iBAoBxB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PipelineType } from "../types";
|
|
2
|
+
import type { EnvConfigWithComponent, EnvironmentConfig } from "../types/config";
|
|
3
|
+
import type { EnvironmentInstance } from "../types/environmentContext";
|
|
4
|
+
export declare const getEnvInstance: (envConfig: EnvConfigWithComponent, env: string, pipelineType?: PipelineType, environments?: Record<string, EnvironmentConfig>) => EnvironmentInstance;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getEnvInstance = void 0;
|
|
4
4
|
const bash_1 = require("../../../bash/src/index.js");
|
|
5
5
|
const bashExpressionPerPipelineType_1 = require("../bash/bashExpressionPerPipelineType");
|
|
6
|
-
const
|
|
6
|
+
const getEnvOn_1 = require("./getEnvOn");
|
|
7
7
|
const REVIEW_SLUG = {
|
|
8
8
|
default: "unknown-review-slug",
|
|
9
9
|
gitlab: new bash_1.BashExpression(`$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })`),
|
|
10
10
|
// CL_PR_NUMBER is injected by the github backend at the workflow level
|
|
11
11
|
github: new bash_1.BashExpression(`$([ -n "$CL_PR_NUMBER" ] && echo "pr$CL_PR_NUMBER" || echo "unknown")`),
|
|
12
12
|
};
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const getEnvInstance = (envConfig, env, pipelineType, environments) => {
|
|
14
|
+
// an env deploying per merge request is a review app — one dynamic
|
|
15
|
+
// instance per MR, identified by the review slug
|
|
16
|
+
if ((0, getEnvOn_1.getEnvOn)(env, envConfig, environments) === "mr") {
|
|
17
|
+
return {
|
|
18
|
+
type: "review",
|
|
19
|
+
reviewSlug: (0, bashExpressionPerPipelineType_1.getBashExpressionPerPipelineType)(REVIEW_SLUG, pipelineType),
|
|
20
|
+
};
|
|
17
21
|
}
|
|
18
|
-
return
|
|
22
|
+
return { type: "stable" };
|
|
19
23
|
};
|
|
20
|
-
exports.
|
|
21
|
-
//# sourceMappingURL=
|
|
24
|
+
exports.getEnvInstance = getEnvInstance;
|
|
25
|
+
//# sourceMappingURL=getEnvInstance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEnvInstance.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/context/getEnvInstance.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEjD,yFAAyF;AAOzF,yCAAsC;AACtC,MAAM,WAAW,GAAkC;IACjD,OAAO,EAAE,qBAAqB;IAC9B,MAAM,EAAE,IAAI,qBAAc,CACxB,0JAA0J,CAC3J;IACD,uEAAuE;IACvE,MAAM,EAAE,IAAI,qBAAc,CACxB,uEAAuE,CACxE;CACF,CAAC;AAEK,MAAM,cAAc,GAAG,CAC5B,SAAiC,EACjC,GAAW,EACX,YAA2B,EAC3B,YAAgD,EAC3B,EAAE;IACvB,mEAAmE;IACnE,iDAAiD;IACjD,IAAI,IAAA,mBAAQ,EAAC,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC;QACpD,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAA,gEAAgC,EAAC,WAAW,EAAE,YAAY,CAAC;SACxE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC,CAAC;AAfW,QAAA,cAAc,kBAezB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EnvironmentConfig, EnvOnConfig, EnvType } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* resolves when an env deploys: the project-wide `on` config of the env
|
|
4
|
+
* (top-level `environments`), falling back to the default of its env
|
|
5
|
+
* type (dev → mainBranch, review → mr, stage/prod → taggedRelease,
|
|
6
|
+
* local → false).
|
|
7
|
+
*
|
|
8
|
+
* `on` is deliberately not configurable per component — an environment
|
|
9
|
+
* deploys at one point in time for the whole project.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getEnvOn: (env: string, envConfig: {
|
|
12
|
+
type?: EnvType;
|
|
13
|
+
}, environments?: Record<string, EnvironmentConfig>) => EnvOnConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEnvOn = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const getEnvType_1 = require("./getEnvType");
|
|
6
|
+
const getDefaultOnForType = (envType) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const triggers = types_1.ENV_TYPES[envType].triggers;
|
|
9
|
+
return (_a = triggers[0]) !== null && _a !== void 0 ? _a : false;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* resolves when an env deploys: the project-wide `on` config of the env
|
|
13
|
+
* (top-level `environments`), falling back to the default of its env
|
|
14
|
+
* type (dev → mainBranch, review → mr, stage/prod → taggedRelease,
|
|
15
|
+
* local → false).
|
|
16
|
+
*
|
|
17
|
+
* `on` is deliberately not configurable per component — an environment
|
|
18
|
+
* deploys at one point in time for the whole project.
|
|
19
|
+
*/
|
|
20
|
+
const getEnvOn = (env, envConfig, environments) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const on = (_a = environments === null || environments === void 0 ? void 0 : environments[env]) === null || _a === void 0 ? void 0 : _a.on;
|
|
23
|
+
if (on !== undefined)
|
|
24
|
+
return on;
|
|
25
|
+
return getDefaultOnForType((0, getEnvType_1.getEnvType)(env, envConfig, environments));
|
|
26
|
+
};
|
|
27
|
+
exports.getEnvOn = getEnvOn;
|
|
28
|
+
//# sourceMappingURL=getEnvOn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEnvOn.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/context/getEnvOn.ts"],"names":[],"mappings":";;;AACA,oCAAqC;AACrC,6CAA0C;AAE1C,MAAM,mBAAmB,GAAG,CAAC,OAAgB,EAAe,EAAE;;IAC5D,MAAM,QAAQ,GAAG,iBAAS,CAAC,OAAO,CAAC,CAAC,QAAkC,CAAC;IACvE,OAAO,MAAA,QAAQ,CAAC,CAAC,CAAC,mCAAI,KAAK,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACI,MAAM,QAAQ,GAAG,CACtB,GAAW,EACX,SAEC,EACD,YAAgD,EACnC,EAAE;;IACf,MAAM,EAAE,GAAG,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,CAAC,0CAAE,EAAE,CAAC;IACnC,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,mBAAmB,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { EnvType } from "../types";
|
|
1
|
+
import type { EnvironmentConfig, EnvType } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* the type of a project-wide declared env: its explicit `type`, its
|
|
4
|
+
* name (when it is itself an env type), or — for envs that inherit —
|
|
5
|
+
* the type of the env they inherit their config from
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDeclaredEnvType: (environments: Record<string, EnvironmentConfig> | undefined, env: string, seen?: Set<string>) => EnvType | undefined;
|
|
2
8
|
export declare const getEnvType: (env: string, envConfig: {
|
|
3
9
|
type?: EnvType;
|
|
4
|
-
}) => EnvType;
|
|
10
|
+
}, environments?: Record<string, EnvironmentConfig>) => EnvType;
|