-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(s3): Add DeployAction for codepipeline (#1596)
- Loading branch information
1 parent
58b4685
commit 8f1a5e8
Showing
6 changed files
with
358 additions
and
4 deletions.
There are no files selected for viewing
223 changes: 223 additions & 0 deletions
223
packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-s3-deploy.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
{ | ||
"Resources": { | ||
"PipelineArtifactsBucket22248F97": { | ||
"Type": "AWS::S3::Bucket", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"PipelineRoleD68726F7": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "codepipeline.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"PipelineRoleDefaultPolicyC7A05455": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"s3:GetObject*", | ||
"s3:GetBucket*", | ||
"s3:List*", | ||
"s3:DeleteObject*", | ||
"s3:PutObject*", | ||
"s3:Abort*" | ||
], | ||
"Effect": "Allow", | ||
"Resource": [ | ||
{ | ||
"Fn::GetAtt": [ | ||
"PipelineArtifactsBucket22248F97", | ||
"Arn" | ||
] | ||
}, | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"PipelineArtifactsBucket22248F97", | ||
"Arn" | ||
] | ||
}, | ||
"/*" | ||
] | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"Action": [ | ||
"s3:GetObject*", | ||
"s3:GetBucket*", | ||
"s3:List*" | ||
], | ||
"Effect": "Allow", | ||
"Resource": [ | ||
{ | ||
"Fn::GetAtt": [ | ||
"PipelineBucketB967BD35", | ||
"Arn" | ||
] | ||
}, | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"PipelineBucketB967BD35", | ||
"Arn" | ||
] | ||
}, | ||
"/*" | ||
] | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"Action": [ | ||
"s3:DeleteObject*", | ||
"s3:PutObject*", | ||
"s3:Abort*" | ||
], | ||
"Effect": "Allow", | ||
"Resource": [ | ||
{ | ||
"Fn::GetAtt": [ | ||
"DeployBucket67E2C076", | ||
"Arn" | ||
] | ||
}, | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"DeployBucket67E2C076", | ||
"Arn" | ||
] | ||
}, | ||
"/*" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "PipelineRoleDefaultPolicyC7A05455", | ||
"Roles": [ | ||
{ | ||
"Ref": "PipelineRoleD68726F7" | ||
} | ||
] | ||
} | ||
}, | ||
"PipelineC660917D": { | ||
"Type": "AWS::CodePipeline::Pipeline", | ||
"Properties": { | ||
"RoleArn": { | ||
"Fn::GetAtt": [ | ||
"PipelineRoleD68726F7", | ||
"Arn" | ||
] | ||
}, | ||
"Stages": [ | ||
{ | ||
"Actions": [ | ||
{ | ||
"ActionTypeId": { | ||
"Category": "Source", | ||
"Owner": "AWS", | ||
"Provider": "S3", | ||
"Version": "1" | ||
}, | ||
"Configuration": { | ||
"S3Bucket": { | ||
"Ref": "PipelineBucketB967BD35" | ||
}, | ||
"S3ObjectKey": "key" | ||
}, | ||
"InputArtifacts": [], | ||
"Name": "Source", | ||
"OutputArtifacts": [ | ||
{ | ||
"Name": "SourceArtifact" | ||
} | ||
], | ||
"RunOrder": 1 | ||
} | ||
], | ||
"Name": "Source" | ||
}, | ||
{ | ||
"Actions": [ | ||
{ | ||
"ActionTypeId": { | ||
"Category": "Deploy", | ||
"Owner": "AWS", | ||
"Provider": "S3", | ||
"Version": "1" | ||
}, | ||
"Configuration": { | ||
"BucketName": { | ||
"Ref": "DeployBucket67E2C076" | ||
}, | ||
"Extract": "true" | ||
}, | ||
"InputArtifacts": [ | ||
{ | ||
"Name": "SourceArtifact" | ||
} | ||
], | ||
"Name": "DeployAction", | ||
"OutputArtifacts": [], | ||
"RunOrder": 1 | ||
} | ||
], | ||
"Name": "Deploy" | ||
} | ||
], | ||
"ArtifactStore": { | ||
"Location": { | ||
"Ref": "PipelineArtifactsBucket22248F97" | ||
}, | ||
"Type": "S3" | ||
} | ||
}, | ||
"DependsOn": [ | ||
"PipelineRoleD68726F7", | ||
"PipelineRoleDefaultPolicyC7A05455" | ||
] | ||
}, | ||
"PipelineBucketB967BD35": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"VersioningConfiguration": { | ||
"Status": "Enabled" | ||
} | ||
} | ||
}, | ||
"DeployBucket67E2C076": { | ||
"Type": "AWS::S3::Bucket", | ||
"DeletionPolicy": "Retain" | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-s3-deploy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import s3 = require('@aws-cdk/aws-s3'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import codepipeline = require('../lib'); | ||
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-s3-deploy'); | ||
|
||
const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); | ||
|
||
const sourceStage = new codepipeline.Stage(pipeline, 'Source', { pipeline }); | ||
const bucket = new s3.Bucket(stack, 'PipelineBucket', { | ||
versioned: true, | ||
removalPolicy: cdk.RemovalPolicy.Destroy, | ||
}); | ||
const sourceAction = new s3.PipelineSourceAction(stack, 'Source', { | ||
stage: sourceStage, | ||
outputArtifactName: 'SourceArtifact', | ||
bucket, | ||
bucketKey: 'key', | ||
}); | ||
|
||
const deployBucket = new s3.Bucket(stack, 'DeployBucket', {}); | ||
|
||
const deployStage = new codepipeline.Stage(pipeline, 'Deploy', { pipeline }); | ||
deployBucket.addToPipelineAsDeploy(deployStage, 'DeployAction', { | ||
inputArtifact: sourceAction.outputArtifact, | ||
}); | ||
|
||
app.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.