@flit/cdk-pipeline 1.0.6 → 1.0.8
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 +379 -58
- package/README.md +3 -3
- package/{dist → lib}/artifact.js +1 -1
- package/{dist → lib}/pipeline-segment.js +1 -1
- package/{dist → lib}/pipeline.js +1 -1
- package/{dist → lib}/publish-assets-action.js +1 -1
- package/{dist → lib}/segment.js +2 -2
- package/{dist → lib}/source-segment.d.ts +31 -4
- package/lib/source-segment.js +74 -0
- package/{dist → lib}/stack-segment.js +2 -2
- package/{dist → lib}/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/dist/source-segment.js +0 -45
- package/src/artifact.ts +0 -24
- package/src/index.ts +0 -7
- package/src/pipeline-segment.ts +0 -68
- package/src/pipeline.ts +0 -94
- package/src/publish-assets-action.ts +0 -126
- package/src/segment.ts +0 -45
- package/src/source-segment.ts +0 -71
- package/src/stack-segment.ts +0 -195
- /package/{dist → lib}/artifact.d.ts +0 -0
- /package/{dist → lib}/index.d.ts +0 -0
- /package/{dist → lib}/index.js +0 -0
- /package/{dist → lib}/pipeline-segment.d.ts +0 -0
- /package/{dist → lib}/pipeline.d.ts +0 -0
- /package/{dist → lib}/publish-assets-action.d.ts +0 -0
- /package/{dist → lib}/segment.d.ts +0 -0
- /package/{dist → lib}/stack-segment.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flit/cdk-pipeline",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "A highly customizable and extensible CI/CD pipeline intended as alternative to CDK's native CodePipeline",
|
|
6
6
|
"homepage": "https://p-mercury.github.io/jumper-de/modules/_flit_cdk_pipeline",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"aws",
|
|
9
9
|
"awscdk",
|
|
10
|
-
"
|
|
10
|
+
"aws-cdk",
|
|
11
|
+
"pipeline",
|
|
12
|
+
"codepipeline",
|
|
13
|
+
"cicd"
|
|
11
14
|
],
|
|
12
15
|
"author": {
|
|
13
16
|
"name": "Luis Vierroth",
|
|
@@ -18,14 +21,13 @@
|
|
|
18
21
|
"url": "https://github.com/p-mercury/jumper-de.git"
|
|
19
22
|
},
|
|
20
23
|
"bugs": "https://github.com/p-mercury/jumper-de/issues",
|
|
21
|
-
"main": "./
|
|
22
|
-
"types": "./
|
|
24
|
+
"main": "./lib/index.js",
|
|
25
|
+
"types": "./lib/index.d.ts",
|
|
23
26
|
"typedoc": {
|
|
24
27
|
"entryPoint": "./src/index.ts"
|
|
25
28
|
},
|
|
26
29
|
"files": [
|
|
27
|
-
"
|
|
28
|
-
"src",
|
|
30
|
+
"lib",
|
|
29
31
|
".jsii",
|
|
30
32
|
"README.md"
|
|
31
33
|
],
|
|
@@ -63,24 +65,23 @@
|
|
|
63
65
|
"outdir": "./dist",
|
|
64
66
|
"tsc": {
|
|
65
67
|
"rootDir": "./src",
|
|
66
|
-
"outDir": "./
|
|
68
|
+
"outDir": "./lib"
|
|
67
69
|
},
|
|
68
70
|
"targets": {
|
|
69
71
|
"java": {
|
|
70
|
-
"package": "
|
|
72
|
+
"package": "flit.cdk-pipeline",
|
|
71
73
|
"maven": {
|
|
72
|
-
"groupId": "
|
|
73
|
-
"artifactId": "
|
|
74
|
+
"groupId": "flit",
|
|
75
|
+
"artifactId": "cdk-pipeline"
|
|
74
76
|
}
|
|
75
77
|
},
|
|
76
78
|
"dotnet": {
|
|
77
|
-
"namespace": "
|
|
78
|
-
"packageId": "
|
|
79
|
-
"iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png"
|
|
79
|
+
"namespace": "Flit.CDK.Pipeline",
|
|
80
|
+
"packageId": "Flit.CDK.Pipeline"
|
|
80
81
|
},
|
|
81
82
|
"python": {
|
|
82
|
-
"
|
|
83
|
-
"module": "
|
|
83
|
+
"libName": "flit.cdk-pipeline",
|
|
84
|
+
"module": "flit.cdk-pipeline",
|
|
84
85
|
"classifiers": [
|
|
85
86
|
"Framework :: AWS CDK",
|
|
86
87
|
"Framework :: AWS CDK :: 2"
|
package/dist/source-segment.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a, _b, _c;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.GitHubSourceSegmentConstructed = exports.GitHubSourceSegment = exports.SourceSegment = void 0;
|
|
5
|
-
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
|
-
const aws_codepipeline_actions_1 = require("aws-cdk-lib/aws-codepipeline-actions");
|
|
7
|
-
const segment_1 = require("./segment");
|
|
8
|
-
class SourceSegment extends segment_1.Segment {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.isSource = true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
_a = JSII_RTTI_SYMBOL_1;
|
|
15
|
-
SourceSegment[_a] = { fqn: "@flit/cdk-pipeline.SourceSegment", version: "1.0.6" };
|
|
16
|
-
exports.SourceSegment = SourceSegment;
|
|
17
|
-
/**
|
|
18
|
-
* @category Segments
|
|
19
|
-
*/
|
|
20
|
-
class GitHubSourceSegment extends SourceSegment {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
this.props = props;
|
|
24
|
-
}
|
|
25
|
-
construct(scope) {
|
|
26
|
-
return new GitHubSourceSegmentConstructed(scope, this.props.repo, {
|
|
27
|
-
...this.props,
|
|
28
|
-
actionName: this.props.repo,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
_b = JSII_RTTI_SYMBOL_1;
|
|
33
|
-
GitHubSourceSegment[_b] = { fqn: "@flit/cdk-pipeline.GitHubSourceSegment", version: "1.0.6" };
|
|
34
|
-
exports.GitHubSourceSegment = GitHubSourceSegment;
|
|
35
|
-
class GitHubSourceSegmentConstructed extends segment_1.SegmentConstructed {
|
|
36
|
-
constructor(scope, id, props) {
|
|
37
|
-
super(scope, id);
|
|
38
|
-
this.name = "Source";
|
|
39
|
-
this.actions = [new aws_codepipeline_actions_1.GitHubSourceAction(props)];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
_c = JSII_RTTI_SYMBOL_1;
|
|
43
|
-
GitHubSourceSegmentConstructed[_c] = { fqn: "@flit/cdk-pipeline.GitHubSourceSegmentConstructed", version: "1.0.6" };
|
|
44
|
-
exports.GitHubSourceSegmentConstructed = GitHubSourceSegmentConstructed;
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlLXNlZ21lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc291cmNlLXNlZ21lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSxtRkFHOEM7QUFLOUMsdUNBQXdEO0FBTXhELE1BQXNCLGFBQWMsU0FBUSxpQkFBTztJQUFuRDs7UUFDVyxhQUFRLEdBQVksSUFBSSxDQUFDO0tBQ25DOzs7O0FBRnFCLHNDQUFhO0FBY25DOztHQUVHO0FBQ0gsTUFBYSxtQkFBb0IsU0FBUSxhQUFhO0lBRXBELFlBQVksS0FBK0I7UUFDekMsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ2IsSUFBSSxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7SUFDckIsQ0FBQztJQUNELFNBQVMsQ0FBQyxLQUFlO1FBQ3ZCLE9BQU8sSUFBSSw4QkFBOEIsQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUU7WUFDaEUsR0FBRyxJQUFJLENBQUMsS0FBSztZQUNiLFVBQVUsRUFBRSxJQUFJLEN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ENvbnN0cnVjdGVkUHJvcHMge1xuICByZWFkb25seSBvdXRwdXQ6IEFydGlmYWN0O1xuICByZWFkb25seSBhY3Rpb25OYW1lOiBzdHJpbmc7XG4gIHJlYWRvbmx5IG9hdXRoVG9rZW46IFNlY3JldFZhbHVlO1xuICByZWFkb25seSBvd25lcjogc3RyaW5nO1xuICByZWFkb25seSByZXBvOiBzdHJpbmc7XG4gIHJlYWRvbmx5IGJyYW5jaD86IHN0cmluZztcbiAgcmVhZG9ubHkgcnVuT3JkZXI/OiBudW1iZXI7XG4gIHJlYWRvbmx5IHRyaWdnZXI/OiBHaXRIdWJUcmlnZ2VyO1xuICByZWFkb25seSB2YXJpYWJsZXNOYW1lc3BhY2U/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCBjbGFzcyBHaXRIdWJTb3VyY2VTZWdtZW50Q29uc3RydWN0ZWQgZXh0ZW5kcyBTZWdtZW50Q29uc3RydWN0ZWQge1xuICByZWFkb25seSBuYW1lOiBzdHJpbmc7XG4gIHJlYWRvbmx5IGFjdGlvbnM6IElBY3Rpb25bXTtcbiAgY29uc3RydWN0b3IoXG4gICAgc2NvcGU6IFBpcGVsaW5lLFxuICAgIGlkOiBzdHJpbmcsXG4gICAgcHJvcHM6IEdpdEh1YlNvdXJjZVNlZ21lbnRDb25zdHJ1Y3RlZFByb3BzXG4gICkge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG4gICAgdGhpcy5uYW1lID0gXCJTb3VyY2VcIjtcbiAgICB0aGlzLmFjdGlvbnMgPSBbbmV3IEdpdEh1YlNvdXJjZUFjdGlvbihwcm9wcyldO1xuICB9XG59XG4iXX0=
|
package/src/artifact.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Artifact as AwsArtifact } from "aws-cdk-lib/aws-codepipeline";
|
|
2
|
-
|
|
3
|
-
import { Segment } from "./segment";
|
|
4
|
-
|
|
5
|
-
export class Artifact extends AwsArtifact {
|
|
6
|
-
private producer?: Segment;
|
|
7
|
-
private consumers: Segment[] = [];
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
}
|
|
11
|
-
produce(producer: Segment) {
|
|
12
|
-
if (this.producer) throw new Error("Artifact is already produced");
|
|
13
|
-
this.producer = producer;
|
|
14
|
-
}
|
|
15
|
-
consume(producer: Segment) {
|
|
16
|
-
this.consumers.push(producer);
|
|
17
|
-
}
|
|
18
|
-
obtainProducer(): Segment | undefined {
|
|
19
|
-
return this.producer;
|
|
20
|
-
}
|
|
21
|
-
obtainConsumers(): Segment[] {
|
|
22
|
-
return this.consumers;
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/index.ts
DELETED
package/src/pipeline-segment.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { BuildEnvironmentVariable } from "aws-cdk-lib/aws-codebuild";
|
|
2
|
-
|
|
3
|
-
import { Artifact } from "./artifact";
|
|
4
|
-
import { Segment, SegmentConstructed } from "./segment";
|
|
5
|
-
import { StackSegmentConstructed } from "./stack-segment";
|
|
6
|
-
import { Pipeline } from "./pipeline";
|
|
7
|
-
|
|
8
|
-
export interface PipelineSegmentProps {
|
|
9
|
-
/**
|
|
10
|
-
* The input arfifact for the build stage.
|
|
11
|
-
*/
|
|
12
|
-
readonly input: Artifact | Artifact[];
|
|
13
|
-
/**
|
|
14
|
-
* The command(s) to build the stack.
|
|
15
|
-
* @example "cdk synth StackName --strict --exclusively"
|
|
16
|
-
*/
|
|
17
|
-
readonly command: string | string[];
|
|
18
|
-
/**
|
|
19
|
-
* The environmental variables for the build stage.
|
|
20
|
-
*/
|
|
21
|
-
readonly environmentVariables?: { [key: string]: BuildEnvironmentVariable };
|
|
22
|
-
/**
|
|
23
|
-
* The name of the stack to apply this action to.
|
|
24
|
-
* @deafult The name of the given stack.
|
|
25
|
-
*/
|
|
26
|
-
readonly stackName?: string;
|
|
27
|
-
/**
|
|
28
|
-
* The AWS account this Action is supposed to operate in.
|
|
29
|
-
*/
|
|
30
|
-
readonly account?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The AWS region the given Action resides in.
|
|
33
|
-
*/
|
|
34
|
-
readonly region?: string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The artifact to hold the stack deployment output file.
|
|
38
|
-
* @default no output artifact
|
|
39
|
-
*/
|
|
40
|
-
readonly output?: Artifact;
|
|
41
|
-
/**
|
|
42
|
-
* Does this stage require manual approval of the change set?
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
readonly manualApproval?: Boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @category Segments
|
|
50
|
-
*/
|
|
51
|
-
export class PipelineSegment extends Segment {
|
|
52
|
-
readonly isPipeline: boolean = true;
|
|
53
|
-
readonly props: PipelineSegmentProps;
|
|
54
|
-
|
|
55
|
-
constructor(props: PipelineSegmentProps) {
|
|
56
|
-
super(props);
|
|
57
|
-
this.props = props;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
construct(scope: Pipeline): SegmentConstructed {
|
|
61
|
-
return new StackSegmentConstructed(scope, `Deploy${scope.stackName}`, {
|
|
62
|
-
...this.props,
|
|
63
|
-
stack: scope,
|
|
64
|
-
input: this.inputs[0],
|
|
65
|
-
extraInputs: this.inputs.slice(1),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
package/src/pipeline.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { App, Stack, StackProps } from "aws-cdk-lib";
|
|
2
|
-
import { Construct } from "constructs";
|
|
3
|
-
import { Pipeline as AwsPipeline, IAction } from "aws-cdk-lib/aws-codepipeline";
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
|
|
6
|
-
import { Artifact } from "./artifact";
|
|
7
|
-
import { Segment } from "./segment";
|
|
8
|
-
import { SourceSegment } from "./source-segment";
|
|
9
|
-
import { PipelineSegment } from "./pipeline-segment";
|
|
10
|
-
|
|
11
|
-
export interface PipelineProps extends StackProps {
|
|
12
|
-
/**
|
|
13
|
-
* The name of the generated pipeline.
|
|
14
|
-
* @default Stack ID
|
|
15
|
-
*/
|
|
16
|
-
readonly pipelineName?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The path to the cdk projects root directory containing the cdk.json file
|
|
19
|
-
* relative to the asset root
|
|
20
|
-
*/
|
|
21
|
-
readonly rootDir: string;
|
|
22
|
-
/**
|
|
23
|
-
* The segments to populating the pipeline.
|
|
24
|
-
*/
|
|
25
|
-
readonly segments: Segment[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @category Constructs
|
|
30
|
-
*/
|
|
31
|
-
export class Pipeline extends Stack {
|
|
32
|
-
readonly pipelineName: string;
|
|
33
|
-
readonly rootDir: string;
|
|
34
|
-
readonly buildDir: string;
|
|
35
|
-
|
|
36
|
-
constructor(scope: Construct, id: string, readonly props: PipelineProps) {
|
|
37
|
-
super(scope, id, props);
|
|
38
|
-
|
|
39
|
-
this.pipelineName = props.pipelineName ? props.pipelineName : id;
|
|
40
|
-
this.rootDir = props.rootDir;
|
|
41
|
-
this.buildDir = path.join(this.rootDir, (this.node.root as App).outdir);
|
|
42
|
-
|
|
43
|
-
if (!this.bundlingRequired) return;
|
|
44
|
-
|
|
45
|
-
props.segments.forEach((segment: Segment) => {
|
|
46
|
-
segment.inputs.forEach((artifact: Artifact) => {
|
|
47
|
-
if (!artifact.obtainProducer())
|
|
48
|
-
throw new Error("Artifact consumed but never produced.");
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const sourceSegments: SourceSegment[] = props.segments.filter(
|
|
53
|
-
(segment: Segment) => segment.isSource
|
|
54
|
-
) as SourceSegment[];
|
|
55
|
-
|
|
56
|
-
const pipelineSegment: PipelineSegment | undefined = props.segments.find(
|
|
57
|
-
(segment: Segment) => segment.isPipeline
|
|
58
|
-
) as PipelineSegment;
|
|
59
|
-
|
|
60
|
-
const segments: Segment[] = props.segments.filter(
|
|
61
|
-
(segment: Segment) => !segment.isSource && !segment.isPipeline
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
new AwsPipeline(this, "Pipeline", {
|
|
65
|
-
pipelineName: props.pipelineName,
|
|
66
|
-
restartExecutionOnUpdate: true,
|
|
67
|
-
stages: [
|
|
68
|
-
{
|
|
69
|
-
stageName: "Source",
|
|
70
|
-
actions: [
|
|
71
|
-
...sourceSegments.reduce(
|
|
72
|
-
(actions: IAction[], segment: SourceSegment) => [
|
|
73
|
-
...actions,
|
|
74
|
-
...segment.construct(this).actions,
|
|
75
|
-
],
|
|
76
|
-
[]
|
|
77
|
-
),
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
stageName: "Pipeline",
|
|
82
|
-
actions: [...pipelineSegment.construct(this).actions],
|
|
83
|
-
},
|
|
84
|
-
...segments.map((segment: Segment) => {
|
|
85
|
-
const build = segment.construct(this);
|
|
86
|
-
return {
|
|
87
|
-
stageName: build.name,
|
|
88
|
-
actions: build.actions,
|
|
89
|
-
};
|
|
90
|
-
}),
|
|
91
|
-
],
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Stack } from "aws-cdk-lib";
|
|
2
|
-
import { Construct } from "constructs";
|
|
3
|
-
import {
|
|
4
|
-
ActionBindOptions,
|
|
5
|
-
ActionConfig,
|
|
6
|
-
ActionProperties,
|
|
7
|
-
Artifact,
|
|
8
|
-
IAction,
|
|
9
|
-
IStage,
|
|
10
|
-
} from "aws-cdk-lib/aws-codepipeline";
|
|
11
|
-
import { BuildSpec, LinuxBuildImage, Project } from "aws-cdk-lib/aws-codebuild";
|
|
12
|
-
import { CodeBuildAction } from "aws-cdk-lib/aws-codepipeline-actions";
|
|
13
|
-
import {
|
|
14
|
-
AccountPrincipal,
|
|
15
|
-
CompositePrincipal,
|
|
16
|
-
PolicyDocument,
|
|
17
|
-
PolicyStatement,
|
|
18
|
-
Role,
|
|
19
|
-
ServicePrincipal,
|
|
20
|
-
} from "aws-cdk-lib/aws-iam";
|
|
21
|
-
import { IRuleTarget, RuleProps, Rule } from "aws-cdk-lib/aws-events";
|
|
22
|
-
import * as path from "path";
|
|
23
|
-
|
|
24
|
-
export interface PublishAssetsActionProps {
|
|
25
|
-
readonly actionName: string;
|
|
26
|
-
readonly input: Artifact;
|
|
27
|
-
readonly manifestPath: string;
|
|
28
|
-
readonly runOrder?: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class PublishAssetsAction extends Construct implements IAction {
|
|
32
|
-
public readonly actionProperties: ActionProperties;
|
|
33
|
-
|
|
34
|
-
bound(
|
|
35
|
-
scope: Construct,
|
|
36
|
-
stage: IStage,
|
|
37
|
-
options: ActionBindOptions
|
|
38
|
-
): ActionConfig {
|
|
39
|
-
throw new Error(`Method not implemented.${!scope && !stage! && options}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
bind(
|
|
43
|
-
scope: Construct,
|
|
44
|
-
stage: IStage,
|
|
45
|
-
options: ActionBindOptions
|
|
46
|
-
): ActionConfig {
|
|
47
|
-
throw new Error(`Method not implemented.${!scope && !stage! && options}`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onStateChange(
|
|
51
|
-
name: string,
|
|
52
|
-
target?: IRuleTarget | undefined,
|
|
53
|
-
options?: RuleProps | undefined
|
|
54
|
-
): Rule {
|
|
55
|
-
throw new Error(`Method not implemented.${!name && !target! && options}`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
constructor(scope: Construct, id: string, props: PublishAssetsActionProps) {
|
|
59
|
-
super(scope, id);
|
|
60
|
-
const codeBuild = new CodeBuildAction({
|
|
61
|
-
...props,
|
|
62
|
-
input: props.input,
|
|
63
|
-
project: new Project(this, id, {
|
|
64
|
-
environment: {
|
|
65
|
-
buildImage: LinuxBuildImage.AMAZON_LINUX_2_4,
|
|
66
|
-
},
|
|
67
|
-
role: new Role(this, "UpdatePipelineCodeCuildRole", {
|
|
68
|
-
assumedBy: new CompositePrincipal(
|
|
69
|
-
new ServicePrincipal("codebuild.amazonaws.com"),
|
|
70
|
-
new AccountPrincipal(Stack.of(this).account)
|
|
71
|
-
),
|
|
72
|
-
inlinePolicies: {
|
|
73
|
-
selfMutation: new PolicyDocument({
|
|
74
|
-
statements: [
|
|
75
|
-
new PolicyStatement({
|
|
76
|
-
actions: ["sts:AssumeRole"],
|
|
77
|
-
resources: [`arn:*:iam::${Stack.of(this).account}:role/*`],
|
|
78
|
-
conditions: {
|
|
79
|
-
"ForAnyValue:StringEquals": {
|
|
80
|
-
"iam:ResourceTag/aws-cdk:bootstrap-role": [
|
|
81
|
-
"image-publishing",
|
|
82
|
-
"file-publishing",
|
|
83
|
-
"deploy",
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
}),
|
|
88
|
-
],
|
|
89
|
-
}),
|
|
90
|
-
},
|
|
91
|
-
}),
|
|
92
|
-
buildSpec: BuildSpec.fromObject({
|
|
93
|
-
version: "0.2",
|
|
94
|
-
phases: {
|
|
95
|
-
install: {
|
|
96
|
-
"runtime-versions": {
|
|
97
|
-
nodejs: 18,
|
|
98
|
-
},
|
|
99
|
-
commands: [
|
|
100
|
-
"npm install -g npm@latest",
|
|
101
|
-
"npm i -g @flit/publish-cdk-assets@latest",
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
build: {
|
|
105
|
-
commands: `pca ${
|
|
106
|
-
props.manifestPath ? path.normalize(props.manifestPath) : "."
|
|
107
|
-
}`,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
}),
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
this.actionProperties = codeBuild.actionProperties;
|
|
115
|
-
this.bind = (
|
|
116
|
-
scope: Construct,
|
|
117
|
-
stage: IStage,
|
|
118
|
-
options: ActionBindOptions
|
|
119
|
-
): ActionConfig => codeBuild.bind(scope, stage, options);
|
|
120
|
-
this.onStateChange = (
|
|
121
|
-
name: string,
|
|
122
|
-
target?: IRuleTarget,
|
|
123
|
-
options?: RuleProps
|
|
124
|
-
): Rule => codeBuild.onStateChange(name, target, options);
|
|
125
|
-
}
|
|
126
|
-
}
|
package/src/segment.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Construct } from "constructs";
|
|
2
|
-
import { Stack } from "aws-cdk-lib";
|
|
3
|
-
import { IAction } from "aws-cdk-lib/aws-codepipeline";
|
|
4
|
-
|
|
5
|
-
import { Artifact } from "./artifact";
|
|
6
|
-
import { Pipeline } from "./pipeline";
|
|
7
|
-
|
|
8
|
-
export interface SegmentProps {
|
|
9
|
-
readonly input?: Artifact | Artifact[];
|
|
10
|
-
readonly output?: Artifact | Artifact[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export abstract class Segment {
|
|
14
|
-
readonly isSource: boolean = false;
|
|
15
|
-
readonly isPipeline: boolean = false;
|
|
16
|
-
readonly dependencies?: Stack[];
|
|
17
|
-
readonly inputs: Artifact[] = [];
|
|
18
|
-
readonly outputs: Artifact[] = [];
|
|
19
|
-
constructor(props: SegmentProps) {
|
|
20
|
-
if (props.input) {
|
|
21
|
-
this.inputs = (
|
|
22
|
-
props.input.constructor.name === "Array" ? props.input : [props.input]
|
|
23
|
-
) as Artifact[];
|
|
24
|
-
this.inputs.forEach((artifact: Artifact) => {
|
|
25
|
-
artifact.consume(this);
|
|
26
|
-
}, this);
|
|
27
|
-
}
|
|
28
|
-
if (props.output) {
|
|
29
|
-
this.outputs = (
|
|
30
|
-
props.output.constructor.name === "Array"
|
|
31
|
-
? props.output
|
|
32
|
-
: [props.output]
|
|
33
|
-
) as Artifact[];
|
|
34
|
-
this.outputs.forEach((artifact: Artifact) => {
|
|
35
|
-
artifact.produce(this);
|
|
36
|
-
}, this);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
abstract construct(scope: Pipeline): SegmentConstructed;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export abstract class SegmentConstructed extends Construct {
|
|
43
|
-
readonly name: string = "";
|
|
44
|
-
readonly actions: IAction[] = [];
|
|
45
|
-
}
|
package/src/source-segment.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { IAction } from "aws-cdk-lib/aws-codepipeline";
|
|
2
|
-
import {
|
|
3
|
-
GitHubSourceAction,
|
|
4
|
-
GitHubTrigger,
|
|
5
|
-
} from "aws-cdk-lib/aws-codepipeline-actions";
|
|
6
|
-
import { Pipeline } from "./pipeline";
|
|
7
|
-
import { SecretValue } from "aws-cdk-lib";
|
|
8
|
-
|
|
9
|
-
import { Artifact } from "./artifact";
|
|
10
|
-
import { Segment, SegmentConstructed } from "./segment";
|
|
11
|
-
|
|
12
|
-
export interface SourceSegmentProps {
|
|
13
|
-
readonly output: Artifact;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export abstract class SourceSegment extends Segment {
|
|
17
|
-
readonly isSource: boolean = true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface GitHubSourceSegmentProps extends SourceSegmentProps {
|
|
21
|
-
readonly oauthToken: SecretValue;
|
|
22
|
-
readonly owner: string;
|
|
23
|
-
readonly repo: string;
|
|
24
|
-
readonly branch?: string;
|
|
25
|
-
readonly runOrder?: number;
|
|
26
|
-
readonly trigger?: GitHubTrigger;
|
|
27
|
-
readonly variablesNamespace?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @category Segments
|
|
32
|
-
*/
|
|
33
|
-
export class GitHubSourceSegment extends SourceSegment {
|
|
34
|
-
private props: GitHubSourceSegmentProps;
|
|
35
|
-
constructor(props: GitHubSourceSegmentProps) {
|
|
36
|
-
super(props);
|
|
37
|
-
this.props = props;
|
|
38
|
-
}
|
|
39
|
-
construct(scope: Pipeline): SegmentConstructed {
|
|
40
|
-
return new GitHubSourceSegmentConstructed(scope, this.props.repo, {
|
|
41
|
-
...this.props,
|
|
42
|
-
actionName: this.props.repo,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface GitHubSourceSegmentConstructedProps {
|
|
48
|
-
readonly output: Artifact;
|
|
49
|
-
readonly actionName: string;
|
|
50
|
-
readonly oauthToken: SecretValue;
|
|
51
|
-
readonly owner: string;
|
|
52
|
-
readonly repo: string;
|
|
53
|
-
readonly branch?: string;
|
|
54
|
-
readonly runOrder?: number;
|
|
55
|
-
readonly trigger?: GitHubTrigger;
|
|
56
|
-
readonly variablesNamespace?: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export class GitHubSourceSegmentConstructed extends SegmentConstructed {
|
|
60
|
-
readonly name: string;
|
|
61
|
-
readonly actions: IAction[];
|
|
62
|
-
constructor(
|
|
63
|
-
scope: Pipeline,
|
|
64
|
-
id: string,
|
|
65
|
-
props: GitHubSourceSegmentConstructedProps
|
|
66
|
-
) {
|
|
67
|
-
super(scope, id);
|
|
68
|
-
this.name = "Source";
|
|
69
|
-
this.actions = [new GitHubSourceAction(props)];
|
|
70
|
-
}
|
|
71
|
-
}
|