@flit/cdk-pipeline 1.3.0 → 1.4.1
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 +44 -43
- 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.d.ts +1 -1
- package/dist/pipeline.js +32 -20
- 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 +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/pipeline.ts +46 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flit/cdk-pipeline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A highly customizable and extensible CI/CD pipeline intended as alternative to CDK's native CodePipeline",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/node": "^22.
|
|
56
|
+
"@types/node": "^22.13.5",
|
|
57
57
|
"aws-cdk-lib": "^2.174.0",
|
|
58
58
|
"constructs": "^10.4.0",
|
|
59
|
-
"jsii": "^5.7.
|
|
60
|
-
"jsii-pacmak": "^1.
|
|
61
|
-
"prettier": "^3.
|
|
59
|
+
"jsii": "^5.7.6",
|
|
60
|
+
"jsii-pacmak": "^1.108.0",
|
|
61
|
+
"prettier": "^3.5.2",
|
|
62
62
|
"prettier-plugin-packagejson": "^2.5.8",
|
|
63
63
|
"typescript": "^5.7.3"
|
|
64
64
|
},
|
package/src/pipeline.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "aws-cdk-lib/aws-codepipeline";
|
|
8
8
|
import * as path from "path";
|
|
9
9
|
|
|
10
|
-
import { Segment } from "./segment";
|
|
10
|
+
import { Segment, SegmentConstructed } from "./segment";
|
|
11
11
|
import { isSource } from "./source-segment";
|
|
12
12
|
import { isPipeline } from "./pipeline-segment";
|
|
13
13
|
|
|
@@ -26,7 +26,7 @@ export interface PipelineProps extends StackProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* The segments to populating the pipeline.
|
|
28
28
|
*/
|
|
29
|
-
readonly segments: Segment[];
|
|
29
|
+
readonly segments: (Segment | Segment[])[];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -50,32 +50,38 @@ export class Pipeline extends Stack {
|
|
|
50
50
|
|
|
51
51
|
if (!this.bundlingRequired) return;
|
|
52
52
|
|
|
53
|
-
props.segments.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const segments = props.segments.map((segment) =>
|
|
54
|
+
Array.isArray(segment) ? segment : [segment],
|
|
55
|
+
);
|
|
56
|
+
|
|
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
|
+
});
|
|
58
64
|
});
|
|
59
65
|
});
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
if (segments[0].filter(isSource).length !== segments[0].length) {
|
|
68
|
+
throw new Error("First segment must contain only source segments");
|
|
69
|
+
}
|
|
63
70
|
|
|
64
|
-
if (
|
|
65
|
-
throw new Error(
|
|
66
|
-
"Missing pipeline segment, one instance of the pipeline segment is required in the segments array.",
|
|
67
|
-
);
|
|
71
|
+
if (segments.slice(1).find((unit) => unit.filter(isSource).length)) {
|
|
72
|
+
throw new Error("Only the first segment can contain source segments");
|
|
68
73
|
}
|
|
69
74
|
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
if (
|
|
76
|
+
segments[0].length === 1 &&
|
|
77
|
+
segments[0].filter(isPipeline).length !== segments[0].length
|
|
78
|
+
) {
|
|
79
|
+
throw new Error("Second segment must be the pipeline segment");
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
(
|
|
78
|
-
|
|
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
|
+
}
|
|
79
85
|
|
|
80
86
|
new AwsPipeline(this, "Pipeline", {
|
|
81
87
|
pipelineName: props.pipelineName,
|
|
@@ -85,7 +91,7 @@ export class Pipeline extends Stack {
|
|
|
85
91
|
{
|
|
86
92
|
stageName: "Source",
|
|
87
93
|
actions: [
|
|
88
|
-
...
|
|
94
|
+
...segments[0].reduce(
|
|
89
95
|
(actions, segment) => [
|
|
90
96
|
...actions,
|
|
91
97
|
...segment.construct(this).actions,
|
|
@@ -96,13 +102,27 @@ export class Pipeline extends Stack {
|
|
|
96
102
|
},
|
|
97
103
|
{
|
|
98
104
|
stageName: "Pipeline",
|
|
99
|
-
actions: [
|
|
105
|
+
actions: [
|
|
106
|
+
...segments[1].reduce(
|
|
107
|
+
(actions, segment) => [
|
|
108
|
+
...actions,
|
|
109
|
+
...segment.construct(this).actions,
|
|
110
|
+
],
|
|
111
|
+
[] as IAction[],
|
|
112
|
+
),
|
|
113
|
+
],
|
|
100
114
|
},
|
|
101
|
-
...segments.map((
|
|
102
|
-
const
|
|
115
|
+
...segments.slice(2).map((unit) => {
|
|
116
|
+
const builds = unit.reduce(
|
|
117
|
+
(segments, segment) => [...segments, segment.construct(this)],
|
|
118
|
+
[] as SegmentConstructed[],
|
|
119
|
+
);
|
|
103
120
|
return {
|
|
104
|
-
stageName: build.name,
|
|
105
|
-
actions:
|
|
121
|
+
stageName: builds.map((build) => build.name).join(""),
|
|
122
|
+
actions: builds.reduce(
|
|
123
|
+
(actions, build) => [...actions, ...build.actions],
|
|
124
|
+
[] as IAction[],
|
|
125
|
+
),
|
|
106
126
|
};
|
|
107
127
|
}),
|
|
108
128
|
],
|