@flit/cdk-pipeline 1.0.22 → 1.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flit/cdk-pipeline",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
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",
@@ -35,29 +35,23 @@
35
35
  "build": "jsii",
36
36
  "prepack": "jsii"
37
37
  },
38
- "dependencies": {
39
- "path": "^0.12.7"
40
- },
41
38
  "devDependencies": {
42
- "@types/node": "^20.4.4",
43
- "aws-cdk": "^2.88.0",
44
- "aws-cdk-lib": "2.88.0",
45
- "cdk-aws-lambda-powertools-layer": "^3.6.0",
46
- "constructs": "10.2.69",
47
- "jest": "^29.6.1",
48
- "jsii": "^5.1.9",
49
- "jsii-pacmak": "^1.85.0",
39
+ "@types/node": "^20.10.1",
40
+ "aws-cdk": "^2.111.0",
41
+ "aws-cdk-lib": "2.111.0",
42
+ "cdk-aws-lambda-powertools-layer": "^3.7.0",
43
+ "constructs": "10.3.0",
44
+ "jest": "^29.7.0",
45
+ "jsii": "^5.2.35",
46
+ "jsii-pacmak": "^1.92.0",
50
47
  "ts-jest": "^29.1.1",
51
48
  "ts-node": "^10.9.1",
52
- "typescript": "^5.1.6"
49
+ "typescript": "^5.3.2"
53
50
  },
54
51
  "peerDependencies": {
55
- "aws-cdk-lib": "^2.88.0",
56
- "constructs": "^10.2.69"
52
+ "aws-cdk-lib": "^2.111.0",
53
+ "constructs": "^10.3.0"
57
54
  },
58
- "bundledDependencies": [
59
- "path"
60
- ],
61
55
  "publishConfig": {
62
56
  "access": "public"
63
57
  },
@@ -33,7 +33,7 @@ export class CodeCommitSourceSegment extends SourceSegment {
33
33
  {
34
34
  ...this.props,
35
35
  actionName: this.props.repository.repositoryName,
36
- }
36
+ },
37
37
  );
38
38
  }
39
39
  }
@@ -53,7 +53,7 @@ export class CodeCommitSourceSegmentConstructed extends SegmentConstructed {
53
53
  constructor(
54
54
  scope: Pipeline,
55
55
  id: string,
56
- props: CodeCommitSourceSegmentConstructedProps
56
+ props: CodeCommitSourceSegmentConstructedProps,
57
57
  ) {
58
58
  super(scope, id);
59
59
  this.name = "Source";
@@ -0,0 +1,60 @@
1
+ import { IAction } from "aws-cdk-lib/aws-codepipeline";
2
+ import { CodeStarConnectionsSourceAction } from "aws-cdk-lib/aws-codepipeline-actions";
3
+
4
+ import { Pipeline } from "./pipeline";
5
+ import { Artifact } from "./artifact";
6
+ import { SegmentConstructed } from "./segment";
7
+ import { SourceSegment, SourceSegmentProps } from "./source-segment";
8
+
9
+ export interface CodeStarSourceSegmentProps extends SourceSegmentProps {
10
+ readonly owner: string;
11
+ readonly connectionArn: string;
12
+ readonly repository: string;
13
+ readonly branch?: string;
14
+ readonly triggerOnPush?: boolean;
15
+ readonly variablesNamespace?: string;
16
+ }
17
+
18
+ /**
19
+ * @category Segments
20
+ */
21
+ export class CodeStarSourceSegment extends SourceSegment {
22
+ private props: CodeStarSourceSegmentProps;
23
+ constructor(props: CodeStarSourceSegmentProps) {
24
+ super(props);
25
+ this.props = props;
26
+ }
27
+ construct(scope: Pipeline): SegmentConstructed {
28
+ return new CodeStarSourceSegmentConstructed(scope, this.props.repository, {
29
+ ...this.props,
30
+ actionName: this.props.repository,
31
+ repo: this.props.repository,
32
+ });
33
+ }
34
+ }
35
+
36
+ export interface CodeStarSourceSegmentConstructedProps {
37
+ readonly output: Artifact;
38
+ readonly actionName: string;
39
+ readonly connectionArn: string;
40
+ readonly owner: string;
41
+ readonly repo: string;
42
+ readonly branch?: string;
43
+ readonly runOrder?: number;
44
+ readonly triggerOnPush?: boolean;
45
+ readonly variablesNamespace?: string;
46
+ }
47
+
48
+ export class CodeStarSourceSegmentConstructed extends SegmentConstructed {
49
+ readonly name: string;
50
+ readonly actions: IAction[];
51
+ constructor(
52
+ scope: Pipeline,
53
+ id: string,
54
+ props: CodeStarSourceSegmentConstructedProps,
55
+ ) {
56
+ super(scope, id);
57
+ this.name = "Source";
58
+ this.actions = [new CodeStarConnectionsSourceAction(props)];
59
+ }
60
+ }
@@ -55,7 +55,7 @@ export class GitHubSourceSegmentConstructed extends SegmentConstructed {
55
55
  constructor(
56
56
  scope: Pipeline,
57
57
  id: string,
58
- props: GitHubSourceSegmentConstructedProps
58
+ props: GitHubSourceSegmentConstructedProps,
59
59
  ) {
60
60
  super(scope, id);
61
61
  this.name = "Source";
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./artifact";
2
2
  export * from "./code-commit-source-segment";
3
+ export * from "./code-star-source-segment";
3
4
  export * from "./git-hub-source-segment";
4
5
  export * from "./pipeline-segment";
5
6
  export * from "./pipeline";
package/src/pipeline.ts CHANGED
@@ -33,7 +33,11 @@ export class Pipeline extends Stack {
33
33
  readonly rootDir: string;
34
34
  readonly buildDir: string;
35
35
 
36
- constructor(scope: Construct, id: string, readonly props: PipelineProps) {
36
+ constructor(
37
+ scope: Construct,
38
+ id: string,
39
+ readonly props: PipelineProps,
40
+ ) {
37
41
  super(scope, id, props);
38
42
 
39
43
  this.pipelineName = props.pipelineName ? props.pipelineName : id;
@@ -50,15 +54,15 @@ export class Pipeline extends Stack {
50
54
  });
51
55
 
52
56
  const sourceSegments: SourceSegment[] = props.segments.filter(
53
- (segment: Segment) => segment.isSource
57
+ (segment: Segment) => segment.isSource,
54
58
  ) as SourceSegment[];
55
59
 
56
60
  const pipelineSegment: PipelineSegment | undefined = props.segments.find(
57
- (segment: Segment) => segment.isPipeline
61
+ (segment: Segment) => segment.isPipeline,
58
62
  ) as PipelineSegment;
59
63
 
60
64
  const segments: Segment[] = props.segments.filter(
61
- (segment: Segment) => !segment.isSource && !segment.isPipeline
65
+ (segment: Segment) => !segment.isSource && !segment.isPipeline,
62
66
  );
63
67
 
64
68
  new AwsPipeline(this, "Pipeline", {
@@ -73,7 +77,7 @@ export class Pipeline extends Stack {
73
77
  ...actions,
74
78
  ...segment.construct(this).actions,
75
79
  ],
76
- []
80
+ [],
77
81
  ),
78
82
  ],
79
83
  },
@@ -34,7 +34,7 @@ export class PublishAssetsAction extends Construct implements IAction {
34
34
  bound(
35
35
  scope: Construct,
36
36
  stage: IStage,
37
- options: ActionBindOptions
37
+ options: ActionBindOptions,
38
38
  ): ActionConfig {
39
39
  throw new Error(`Method not implemented.${!scope && !stage! && options}`);
40
40
  }
@@ -42,7 +42,7 @@ export class PublishAssetsAction extends Construct implements IAction {
42
42
  bind(
43
43
  scope: Construct,
44
44
  stage: IStage,
45
- options: ActionBindOptions
45
+ options: ActionBindOptions,
46
46
  ): ActionConfig {
47
47
  throw new Error(`Method not implemented.${!scope && !stage! && options}`);
48
48
  }
@@ -50,7 +50,7 @@ export class PublishAssetsAction extends Construct implements IAction {
50
50
  onStateChange(
51
51
  name: string,
52
52
  target?: IRuleTarget | undefined,
53
- options?: RuleProps | undefined
53
+ options?: RuleProps | undefined,
54
54
  ): Rule {
55
55
  throw new Error(`Method not implemented.${!name && !target! && options}`);
56
56
  }
@@ -67,7 +67,7 @@ export class PublishAssetsAction extends Construct implements IAction {
67
67
  role: new Role(this, "UpdatePipelineCodeCuildRole", {
68
68
  assumedBy: new CompositePrincipal(
69
69
  new ServicePrincipal("codebuild.amazonaws.com"),
70
- new AccountPrincipal(Stack.of(this).account)
70
+ new AccountPrincipal(Stack.of(this).account),
71
71
  ),
72
72
  inlinePolicies: {
73
73
  selfMutation: new PolicyDocument({
@@ -97,8 +97,8 @@ export class PublishAssetsAction extends Construct implements IAction {
97
97
  nodejs: "latest",
98
98
  },
99
99
  commands: [
100
- "npm i -g npm@latest",
101
- "npm i -g @flit/publish-cdk-assets@latest",
100
+ "n lts",
101
+ "npm i -g npm@latest @flit/publish-cdk-assets@latest",
102
102
  ],
103
103
  },
104
104
  build: {
@@ -115,12 +115,12 @@ export class PublishAssetsAction extends Construct implements IAction {
115
115
  this.bind = (
116
116
  scope: Construct,
117
117
  stage: IStage,
118
- options: ActionBindOptions
118
+ options: ActionBindOptions,
119
119
  ): ActionConfig => codeBuild.bind(scope, stage, options);
120
120
  this.onStateChange = (
121
121
  name: string,
122
122
  target?: IRuleTarget,
123
- options?: RuleProps
123
+ options?: RuleProps,
124
124
  ): Rule => codeBuild.onStateChange(name, target, options);
125
125
  }
126
126
  }
@@ -51,7 +51,7 @@ export class S3SourceSegmentConstructed extends SegmentConstructed {
51
51
  constructor(
52
52
  scope: Pipeline,
53
53
  id: string,
54
- props: S3SourceSegmentConstructedProps
54
+ props: S3SourceSegmentConstructedProps,
55
55
  ) {
56
56
  super(scope, id);
57
57
  this.name = "Source";
@@ -92,7 +92,7 @@ export class StackSegment extends Segment {
92
92
  ...this.props,
93
93
  input: this.inputs[0],
94
94
  extraInputs: this.inputs.slice(1),
95
- }
95
+ },
96
96
  );
97
97
  }
98
98
  }
@@ -118,7 +118,7 @@ export class StackSegmentConstructed extends SegmentConstructed {
118
118
  constructor(
119
119
  scope: Pipeline,
120
120
  id: string,
121
- props: StackSegmentConstructedProps
121
+ props: StackSegmentConstructedProps,
122
122
  ) {
123
123
  super(scope, id);
124
124
 
@@ -147,7 +147,7 @@ export class StackSegmentConstructed extends SegmentConstructed {
147
147
  "runtime-versions": {
148
148
  nodejs: "latest",
149
149
  },
150
- commands: ["npm i -g npm@latest", "npm ci"],
150
+ commands: ["n 18", "npm i -g npm@latest", "npm ci"],
151
151
  },
152
152
  build: {
153
153
  commands: props.command,
@@ -177,7 +177,7 @@ export class StackSegmentConstructed extends SegmentConstructed {
177
177
  changeSetName: `${props.stack.stackName}Changes`,
178
178
  adminPermissions: true,
179
179
  templatePath: buildArtifact.atPath(
180
- path.join(scope.buildDir, props.stack.templateFile)
180
+ path.join(scope.buildDir, props.stack.templateFile),
181
181
  ),
182
182
  }),
183
183
  ...(props.manualApproval