Skip to content

Instantly share code, notes, and snippets.

@technicool
Created January 2, 2017 21:07
Show Gist options
  • Save technicool/b1b23a2cf465ecb91760b15fb286d2bf to your computer and use it in GitHub Desktop.
Save technicool/b1b23a2cf465ecb91760b15fb286d2bf to your computer and use it in GitHub Desktop.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Dromedary CodePipeline provisioning
Parameters:
ArtifactStoreBucket:
Type: String
Description: S3 bucket to use for artifacts. Just bucket Name; not URL. IAM user
should have access to the bucket.
Default: codepipeline-us-east-1-XXXXXXXXXXX
GitHubToken:
NoEcho: 'true'
Type: String
Description: Secret. It might look something like 9b189a1654643522561f7b3ebd44a1531a4287af
OAuthToken with access to Repo. Go to https://github.com/settings/tokens
GitHubUser:
Type: String
Description: GitHub UserName
Default: stelligent
Repo:
Type: String
Description: GitHub Repo to pull from. Only the Name. not the URL
Default: dromedary
Branch:
Type: String
Description: Branch to use from Repo. Only the Name. not the URL
Default: master
MyInputArtifacts:
Type: String
Default: DromedarySource
MyBuildProvider:
Type: String
Description: Unique identifier for Custom Action
MyJenkinsURL:
Type: String
CodePipelineServiceRole:
Type: String
Default: arn:aws:iam::123456789012:role/AWS-CodePipeline-Service
Description: This IAM role must have proper permissions.
Resources:
AppPipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
RoleArn:
Ref: CodePipelineServiceRole
Stages:
- Name: Source
Actions:
- InputArtifacts: []
Name: Source
ActionTypeId:
Category: Source
Owner: ThirdParty
Version: '1'
Provider: GitHub
OutputArtifacts:
- Name:
Ref: MyInputArtifacts
Configuration:
Owner:
Ref: GitHubUser
Repo:
Ref: Repo
Branch:
Ref: Branch
OAuthToken:
Ref: GitHubToken
RunOrder: 1
- Name: Commit
Actions:
- InputArtifacts:
- Name:
Ref: MyInputArtifacts
Name: Build
ActionTypeId:
Category: Build
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts:
- Name: DromedaryBuild
Configuration:
ProjectName: drom-build
RunOrder: 1
- InputArtifacts:
- Name:
Ref: MyInputArtifacts
Name: UnitTest
ActionTypeId:
Category: Test
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts: []
Configuration:
ProjectName: drom-unit-test
RunOrder: 1
- InputArtifacts:
- Name:
Ref: MyInputArtifacts
Name: StaticCodeAnalysis
ActionTypeId:
Category: Test
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts: []
Configuration:
ProjectName: drom-staticcode-anal
RunOrder: 1
- Name: Acceptance
Actions:
- InputArtifacts:
- Name: DromedaryBuild
Name: CreateEnvironment
ActionTypeId:
Category: Test
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts:
- Name: DromedaryCreate
Configuration:
ProjectName: drom-create-env
RunOrder: 1
- InputArtifacts:
- Name: DromedaryCreate
Name: AcceptanceTest
ActionTypeId:
Category: Test
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts:
- Name: DromedaryAccepted
Configuration:
ProjectName: drom-acceptance-test
RunOrder: 2
- InputArtifacts:
- Name: DromedaryCreate
Name: InfrastructureTest
ActionTypeId:
Category: Test
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts:
- Name: DromedaryInfra
Configuration:
ProjectName: drom-infra-test
RunOrder: 2
- Name: Production
Actions:
- InputArtifacts:
- Name: DromedaryAccepted
Name: PromoteEnvironment
ActionTypeId:
Category: Test
Owner: Custom
Version: '1'
Provider:
Ref: MyBuildProvider
OutputArtifacts: []
Configuration:
ProjectName: drom-promote-env
RunOrder: 1
ArtifactStore:
Type: S3
Location:
Ref: ArtifactStoreBucket
Outputs:
StackName:
Value:
Ref: AWS::StackName
CodePipelineURL:
Value:
Fn::Join:
- ''
- - https://console.aws.amazon.com/codepipeline/home?region=
- Ref: AWS::Region
- "#/view/"
- Ref: AppPipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment