AWS CodePipeline Concepts: Difference between revisions
Jump to navigation
Jump to search
Line 43: | Line 43: | ||
{{Internal|GitHub Authentication for AWS CodePipeline|GitHub Authentication for AWS CodePipeline}} | {{Internal|GitHub Authentication for AWS CodePipeline|GitHub Authentication for AWS CodePipeline}} | ||
===Build Action=== | |||
<syntaxhighlight lang='yaml'> | |||
Resources: | |||
MyPipeline: | |||
Type: AWS::CodePipeline::Pipeline | |||
Properties: | |||
... | |||
Stages: | |||
... | |||
- Name: Build | |||
Actions: | |||
- Name: !Sub 'CodeBuild build driven by ${Buildspec}' | |||
ActionTypeId: | |||
Category: Build | |||
Owner: AWS | |||
Version: '1' | |||
Provider: CodeBuild | |||
InputArtifacts: | |||
- Name: ContainerSrc | |||
OutputArtifacts: | |||
- Name: ContainerBuild | |||
Configuration: | |||
ProjectName: !Ref CodeBuildProject | |||
RunOrder: 1 | |||
</syntaxhighlight> | |||
===Deploy Action=== | |||
<syntaxhighlight lang='yaml'> | |||
Resources: | |||
MyPipeline: | |||
Type: AWS::CodePipeline::Pipeline | |||
Properties: | |||
... | |||
Stages: | |||
... | |||
- Name: Deploy | |||
Actions: | |||
- Name: Deploy | |||
ActionTypeId: | |||
Category: Deploy | |||
Owner: AWS | |||
Version: '1' | |||
Provider: CloudFormation | |||
InputArtifacts: | |||
- Name: ContainerSrc | |||
- Name: ContainerBuild | |||
Configuration: | |||
StackName: !Join ['-', [!Sub '${AWS::Region}', !Join ['-', !Split ['.', !Ref GitHubRepositoryName]], 'deploy']] | |||
ActionMode: CREATE_UPDATE | |||
Capabilities: CAPABILITY_IAM | |||
TemplatePath: !Sub ContainerSrc::${SvcTemplate} | |||
TemplateConfiguration: ContainerBuild::overrides.json | |||
RoleArn: | |||
Fn::ImportValue: !Sub '${AWS::Region}-CloudformationLambdaExecutionRole' | |||
ParameterOverrides: !Sub '{ "ECRRepository": "${ECRRepository}", "EnvironmentName": "${CFEnvironment}", "Image": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${ECRRepository}", "DeploymentStackName": "${DeploymentStackName}", "GitHubRepo": "${GitHubRepositoryName}" }' | |||
OutputArtifacts: [] | |||
RunOrder: 1 | |||
</syntaxhighlight> |
Revision as of 01:32, 14 March 2019
External
Internal
Stage
Stage Action
Source Action
Resources:
MyPipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
...
Stages:
- Name: Source
Actions:
- InputArtifacts: []
Name: !Sub 'PullBranch-${Branch}'
ActionTypeId:
Category: Source
Owner: ThirdParty
Version: '1'
Provider: GitHub
OutputArtifacts:
- Name: ContainerSrc
Configuration:
Owner: 'novaordis-llc'
Repo: !Sub '${GitHubOrganizationUrl}/${GitHubRepositoryName}'
Branch: !Ref Branch
OAuthToken: ...
RunOrder: 1
GitHub Authentication
Build Action
Resources:
MyPipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
...
Stages:
...
- Name: Build
Actions:
- Name: !Sub 'CodeBuild build driven by ${Buildspec}'
ActionTypeId:
Category: Build
Owner: AWS
Version: '1'
Provider: CodeBuild
InputArtifacts:
- Name: ContainerSrc
OutputArtifacts:
- Name: ContainerBuild
Configuration:
ProjectName: !Ref CodeBuildProject
RunOrder: 1
Deploy Action
Resources:
MyPipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
...
Stages:
...
- Name: Deploy
Actions:
- Name: Deploy
ActionTypeId:
Category: Deploy
Owner: AWS
Version: '1'
Provider: CloudFormation
InputArtifacts:
- Name: ContainerSrc
- Name: ContainerBuild
Configuration:
StackName: !Join ['-', [!Sub '${AWS::Region}', !Join ['-', !Split ['.', !Ref GitHubRepositoryName]], 'deploy']]
ActionMode: CREATE_UPDATE
Capabilities: CAPABILITY_IAM
TemplatePath: !Sub ContainerSrc::${SvcTemplate}
TemplateConfiguration: ContainerBuild::overrides.json
RoleArn:
Fn::ImportValue: !Sub '${AWS::Region}-CloudformationLambdaExecutionRole'
ParameterOverrides: !Sub '{ "ECRRepository": "${ECRRepository}", "EnvironmentName": "${CFEnvironment}", "Image": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${ECRRepository}", "DeploymentStackName": "${DeploymentStackName}", "GitHubRepo": "${GitHubRepositoryName}" }'
OutputArtifacts: []
RunOrder: 1