@flit/cdk-pipeline 1.4.3 → 1.5.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/.jsii +176 -37
- package/dist/artifact.js +1 -1
- package/dist/code-commit-source-segment.js +2 -2
- package/dist/code-star-source-segment.js +2 -2
- package/dist/git-hub-source-segment.js +2 -2
- package/dist/pipeline-segment.js +2 -2
- package/dist/pipeline.js +4 -4
- package/dist/publish-assets-action.js +1 -1
- package/dist/s3-source-segment.js +2 -2
- package/dist/segment.js +2 -2
- package/dist/source-segment.js +1 -1
- package/dist/stack-segment.js +47 -17
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +105 -99
- package/src/pipeline.ts +103 -103
- package/src/stack-segment.ts +204 -173
package/package.json
CHANGED
|
@@ -1,101 +1,107 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
2
|
+
"name": "@flit/cdk-pipeline",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "A highly customizable and extensible CI/CD pipeline intended as alternative to CDK's native CodePipeline",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"aws",
|
|
7
|
+
"cdk",
|
|
8
|
+
"awscdk",
|
|
9
|
+
"aws-cdk",
|
|
10
|
+
"pipeline",
|
|
11
|
+
"codepipeline",
|
|
12
|
+
"cicd"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/vierroth/cdk-pipeline",
|
|
15
|
+
"bugs": "https://github.com/vierroth/cdk-pipeline/issues",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/vierroth/cdk-pipeline.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Vierroth GmbH",
|
|
23
|
+
"url": "https://github.com/vierroth"
|
|
24
|
+
},
|
|
25
|
+
"contributors": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Luis Vierroth",
|
|
28
|
+
"url": "https://github.com/p-mercury"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"files": [
|
|
34
|
+
"./dist",
|
|
35
|
+
"./src",
|
|
36
|
+
"./.jsii",
|
|
37
|
+
"./LICENSE.txt",
|
|
38
|
+
"./README.md"
|
|
39
|
+
],
|
|
40
|
+
"workspaces": [
|
|
41
|
+
"./example"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "jsii && (cd example && npm run build)",
|
|
45
|
+
"prepack": "jsii"
|
|
46
|
+
},
|
|
47
|
+
"prettier": {
|
|
48
|
+
"plugins": [
|
|
49
|
+
"prettier-plugin-packagejson"
|
|
50
|
+
],
|
|
51
|
+
"tabWidth": 2,
|
|
52
|
+
"overrides": [
|
|
53
|
+
{
|
|
54
|
+
"files": "*.sublime-project",
|
|
55
|
+
"options": {
|
|
56
|
+
"parser": "json"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^24.2.1",
|
|
63
|
+
"aws-cdk-lib": "^2.210.0",
|
|
64
|
+
"constructs": "^10.4.2",
|
|
65
|
+
"jsii": "^5.9.1",
|
|
66
|
+
"jsii-pacmak": "^1.113.0",
|
|
67
|
+
"prettier": "^3.6.2",
|
|
68
|
+
"prettier-plugin-packagejson": "^2.5.19",
|
|
69
|
+
"typescript": "^5.9.2"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"aws-cdk-lib": "^2.210.0",
|
|
73
|
+
"constructs": "^10.4.2"
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
},
|
|
78
|
+
"jsii": {
|
|
79
|
+
"outdir": "./dist",
|
|
80
|
+
"tsc": {
|
|
81
|
+
"rootDir": "./src",
|
|
82
|
+
"outDir": "./dist"
|
|
83
|
+
},
|
|
84
|
+
"targets": {
|
|
85
|
+
"java": {
|
|
86
|
+
"package": "flit.cdk-pipeline",
|
|
87
|
+
"maven": {
|
|
88
|
+
"groupId": "flit",
|
|
89
|
+
"artifactId": "cdk-pipeline"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"dotnet": {
|
|
93
|
+
"namespace": "Flit.CDK.Pipeline",
|
|
94
|
+
"packageId": "Flit.CDK.Pipeline"
|
|
95
|
+
},
|
|
96
|
+
"python": {
|
|
97
|
+
"libName": "flit.cdk-pipeline",
|
|
98
|
+
"module": "flit.cdk-pipeline",
|
|
99
|
+
"classifiers": [
|
|
100
|
+
"Framework :: AWS CDK",
|
|
101
|
+
"Framework :: AWS CDK :: 2"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"stability": "stable"
|
|
101
107
|
}
|
package/src/pipeline.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { App, Stack, StackProps } from "aws-cdk-lib";
|
|
2
2
|
import { Construct } from "constructs";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Pipeline as AwsPipeline,
|
|
5
|
+
IAction,
|
|
6
|
+
PipelineType,
|
|
7
7
|
} from "aws-cdk-lib/aws-codepipeline";
|
|
8
8
|
import * as path from "path";
|
|
9
9
|
|
|
@@ -12,120 +12,120 @@ import { isSource } from "./source-segment";
|
|
|
12
12
|
import { isPipeline } from "./pipeline-segment";
|
|
13
13
|
|
|
14
14
|
export interface PipelineProps extends StackProps {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The name of the generated pipeline.
|
|
17
|
+
* @default Stack ID
|
|
18
|
+
*/
|
|
19
|
+
readonly pipelineName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The path to the cdk projects root directory containing the cdk.json file
|
|
22
|
+
* relative to the asset root
|
|
23
|
+
* @default "."
|
|
24
|
+
*/
|
|
25
|
+
readonly rootDir?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The segments to populating the pipeline.
|
|
28
|
+
*/
|
|
29
|
+
readonly segments: (Segment | Segment[])[];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @category Constructs
|
|
34
34
|
*/
|
|
35
35
|
export class Pipeline extends Stack {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
readonly pipelineName: string;
|
|
37
|
+
readonly rootDir: string;
|
|
38
|
+
readonly buildDir: string;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
constructor(
|
|
41
|
+
scope: Construct,
|
|
42
|
+
id: string,
|
|
43
|
+
readonly props: PipelineProps,
|
|
44
|
+
) {
|
|
45
|
+
super(scope, id, props);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
this.pipelineName = props.pipelineName || id;
|
|
48
|
+
this.rootDir = props.rootDir || ".";
|
|
49
|
+
this.buildDir = path.join(this.rootDir, (this.node.root as App).outdir);
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
if (!this.bundlingRequired) return;
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const segments = props.segments.map((segment) =>
|
|
54
|
+
Array.isArray(segment) ? segment : [segment],
|
|
55
|
+
);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
segments.forEach((unit) => {
|
|
58
|
+
unit.forEach((segment) => {
|
|
59
|
+
segment.inputs.forEach((artifact) => {
|
|
60
|
+
if (!artifact.producer) {
|
|
61
|
+
throw new Error("Artifact consumed but never produced.");
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
if (segments[0].filter(isSource).length !== segments[0].length) {
|
|
68
|
+
throw new Error("First segment must contain only source segments");
|
|
69
|
+
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
if (segments.slice(1).find((unit) => unit.filter(isSource).length)) {
|
|
72
|
+
throw new Error("Only the first segment can contain source segments");
|
|
73
|
+
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
if (
|
|
76
|
+
segments[1].length === 1 &&
|
|
77
|
+
segments[1].filter(isPipeline).length !== segments[1].length
|
|
78
|
+
) {
|
|
79
|
+
throw new Error("Second segment must be the pipeline segment");
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (segments.slice(2).find((unit) => unit.filter(isPipeline).length)) {
|
|
83
|
+
throw new Error("Only the second segment can be the pipeline segment");
|
|
84
|
+
}
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
86
|
+
new AwsPipeline(this, "Pipeline", {
|
|
87
|
+
pipelineName: props.pipelineName,
|
|
88
|
+
restartExecutionOnUpdate: true,
|
|
89
|
+
pipelineType: PipelineType.V2,
|
|
90
|
+
stages: [
|
|
91
|
+
{
|
|
92
|
+
stageName: "Source",
|
|
93
|
+
actions: [
|
|
94
|
+
...segments[0].reduce(
|
|
95
|
+
(actions, segment) => [
|
|
96
|
+
...actions,
|
|
97
|
+
...segment.construct(this).actions,
|
|
98
|
+
],
|
|
99
|
+
[] as IAction[],
|
|
100
|
+
),
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
stageName: "Pipeline",
|
|
105
|
+
actions: [
|
|
106
|
+
...segments[1].reduce(
|
|
107
|
+
(actions, segment) => [
|
|
108
|
+
...actions,
|
|
109
|
+
...segment.construct(this).actions,
|
|
110
|
+
],
|
|
111
|
+
[] as IAction[],
|
|
112
|
+
),
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
...segments.slice(2).map((unit) => {
|
|
116
|
+
const builds = unit.reduce(
|
|
117
|
+
(segments, segment) => [...segments, segment.construct(this)],
|
|
118
|
+
[] as SegmentConstructed[],
|
|
119
|
+
);
|
|
120
|
+
return {
|
|
121
|
+
stageName: builds.map((build) => build.name).join("-"),
|
|
122
|
+
actions: builds.reduce(
|
|
123
|
+
(actions, build) => [...actions, ...build.actions],
|
|
124
|
+
[] as IAction[],
|
|
125
|
+
),
|
|
126
|
+
};
|
|
127
|
+
}),
|
|
128
|
+
],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
131
|
}
|