-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cristov
committed
Aug 12, 2018
1 parent
64c0ab0
commit cf7b823
Showing
85 changed files
with
81,327 additions
and
6 deletions.
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
Prelab/002-deploy-options-ecs/deployment/deployment-pipeline-name.yaml
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,135 @@ | ||
--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
|
||
|
||
Parameters: | ||
GitHubRepo001: | ||
Type: String | ||
|
||
GitHubBranch: | ||
Type: String | ||
|
||
GitHubToken: | ||
Type: String | ||
NoEcho: true | ||
|
||
GitHubUser: | ||
Type: String | ||
|
||
Cluster: | ||
Type: String | ||
|
||
Service: | ||
Type: String | ||
|
||
CodeBuildServiceRole: | ||
Type: String | ||
|
||
CodePipelineServiceRoleArn: | ||
Type: String | ||
|
||
ArtifactBucketName: | ||
Type: String | ||
|
||
Resources: | ||
Repository: | ||
Type: AWS::ECR::Repository | ||
DeletionPolicy: Retain | ||
|
||
CodeBuildProject: | ||
Type: AWS::CodeBuild::Project | ||
Properties: | ||
Artifacts: | ||
Type: CODEPIPELINE | ||
Source: | ||
Type: CODEPIPELINE | ||
BuildSpec: | | ||
version: 0.2 | ||
phases: | ||
pre_build: | ||
commands: | ||
- $(aws ecr get-login --no-include-email) | ||
- TAG="$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)" | ||
- IMAGE_URI="${REPOSITORY_URI}:${TAG}" | ||
build: | ||
commands: | ||
- mvn package -Pdocker -Ddocker.repo=$REPOSITORY_URI -Ddocker.tag=$TAG | ||
post_build: | ||
commands: | ||
- docker tag $REPOSITORY_URI/name:$TAG $IMAGE_URI | ||
- docker push "$IMAGE_URI" | ||
- printf '[{"name":"name","imageUri":"%s"}]' "$IMAGE_URI" > images-name.json | ||
artifacts: | ||
files: images-name.json | ||
Environment: | ||
ComputeType: BUILD_GENERAL1_SMALL | ||
Image: aws/codebuild/java:openjdk-8 | ||
PrivilegedMode: true | ||
Type: LINUX_CONTAINER | ||
EnvironmentVariables: | ||
- Name: AWS_DEFAULT_REGION | ||
Value: !Ref AWS::Region | ||
- Name: REPOSITORY_URI | ||
Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository} | ||
Name: !Ref AWS::StackName | ||
ServiceRole: !Ref CodeBuildServiceRole | ||
|
||
Pipeline: | ||
Type: AWS::CodePipeline::Pipeline | ||
Properties: | ||
RoleArn: !Ref CodePipelineServiceRoleArn | ||
ArtifactStore: | ||
Type: S3 | ||
Location: !Ref ArtifactBucketName | ||
Stages: | ||
- Name: Source | ||
Actions: | ||
- Name: App | ||
ActionTypeId: | ||
Category: Source | ||
Owner: ThirdParty | ||
Version: 1 | ||
Provider: GitHub | ||
Configuration: | ||
Owner: !Ref GitHubUser | ||
Repo: !Ref GitHubRepo001 | ||
Branch: !Ref GitHubBranch | ||
OAuthToken: !Ref GitHubToken | ||
OutputArtifacts: | ||
- Name: App | ||
RunOrder: 1 | ||
- Name: Build | ||
Actions: | ||
- Name: Build | ||
ActionTypeId: | ||
Category: Build | ||
Owner: AWS | ||
Version: 1 | ||
Provider: CodeBuild | ||
Configuration: | ||
ProjectName: !Ref CodeBuildProject | ||
InputArtifacts: | ||
- Name: App | ||
OutputArtifacts: | ||
- Name: BuildOutput | ||
RunOrder: 1 | ||
- Name: Deploy | ||
Actions: | ||
- Name: Deploy | ||
ActionTypeId: | ||
Category: Deploy | ||
Owner: AWS | ||
Version: 1 | ||
Provider: ECS | ||
Configuration: | ||
ClusterName: !Ref Cluster | ||
ServiceName: !Ref Service | ||
FileName: images-name.json | ||
InputArtifacts: | ||
- Name: BuildOutput | ||
RunOrder: 1 | ||
|
||
|
||
Outputs: | ||
PipelineUrl: | ||
Value: !Sub https://console.aws.amazon.com/codepipeline/home?region=${AWS::Region}#/view/${Pipeline} |
135 changes: 135 additions & 0 deletions
135
Prelab/002-deploy-options-ecs/deployment/deployment-pipeline-webapp.yaml
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,135 @@ | ||
--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
|
||
|
||
Parameters: | ||
GitHubRepo002: | ||
Type: String | ||
|
||
GitHubBranch: | ||
Type: String | ||
|
||
GitHubToken: | ||
Type: String | ||
NoEcho: true | ||
|
||
GitHubUser: | ||
Type: String | ||
|
||
Cluster: | ||
Type: String | ||
|
||
Service: | ||
Type: String | ||
|
||
CodeBuildServiceRole: | ||
Type: String | ||
|
||
CodePipelineServiceRoleArn: | ||
Type: String | ||
|
||
ArtifactBucketName: | ||
Type: String | ||
|
||
Resources: | ||
Repository: | ||
Type: AWS::ECR::Repository | ||
DeletionPolicy: Retain | ||
|
||
CodeBuildProject: | ||
Type: AWS::CodeBuild::Project | ||
Properties: | ||
Artifacts: | ||
Type: CODEPIPELINE | ||
Source: | ||
Type: CODEPIPELINE | ||
BuildSpec: | | ||
version: 0.2 | ||
phases: | ||
pre_build: | ||
commands: | ||
- $(aws ecr get-login --no-include-email) | ||
- TAG="$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)" | ||
- IMAGE_URI="${REPOSITORY_URI}:${TAG}" | ||
build: | ||
commands: | ||
- mvn package -Pdocker -Ddocker.repo=$REPOSITORY_URI -Ddocker.tag=$TAG | ||
post_build: | ||
commands: | ||
- docker tag $REPOSITORY_URI/webapp:$TAG $IMAGE_URI | ||
- docker push "$IMAGE_URI" | ||
- printf '[{"name":"webapp","imageUri":"%s"}]' "$IMAGE_URI" > images-webapp.json | ||
artifacts: | ||
files: images-webapp.json | ||
Environment: | ||
ComputeType: BUILD_GENERAL1_SMALL | ||
Image: aws/codebuild/java:openjdk-8 | ||
PrivilegedMode: true | ||
Type: LINUX_CONTAINER | ||
EnvironmentVariables: | ||
- Name: AWS_DEFAULT_REGION | ||
Value: !Ref AWS::Region | ||
- Name: REPOSITORY_URI | ||
Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository} | ||
Name: !Ref AWS::StackName | ||
ServiceRole: !Ref CodeBuildServiceRole | ||
|
||
Pipeline: | ||
Type: AWS::CodePipeline::Pipeline | ||
Properties: | ||
RoleArn: !Ref CodePipelineServiceRoleArn | ||
ArtifactStore: | ||
Type: S3 | ||
Location: !Ref ArtifactBucketName | ||
Stages: | ||
- Name: Source | ||
Actions: | ||
- Name: App | ||
ActionTypeId: | ||
Category: Source | ||
Owner: ThirdParty | ||
Version: 1 | ||
Provider: GitHub | ||
Configuration: | ||
Owner: !Ref GitHubUser | ||
Repo: !Ref GitHubRepo002 | ||
Branch: !Ref GitHubBranch | ||
OAuthToken: !Ref GitHubToken | ||
OutputArtifacts: | ||
- Name: App | ||
RunOrder: 1 | ||
- Name: Build | ||
Actions: | ||
- Name: Build | ||
ActionTypeId: | ||
Category: Build | ||
Owner: AWS | ||
Version: 1 | ||
Provider: CodeBuild | ||
Configuration: | ||
ProjectName: !Ref CodeBuildProject | ||
InputArtifacts: | ||
- Name: App | ||
OutputArtifacts: | ||
- Name: BuildOutput | ||
RunOrder: 1 | ||
- Name: Deploy | ||
Actions: | ||
- Name: Deploy | ||
ActionTypeId: | ||
Category: Deploy | ||
Owner: AWS | ||
Version: 1 | ||
Provider: ECS | ||
Configuration: | ||
ClusterName: !Ref Cluster | ||
ServiceName: !Ref Service | ||
FileName: images-webapp.json | ||
InputArtifacts: | ||
- Name: BuildOutput | ||
RunOrder: 1 | ||
|
||
|
||
Outputs: | ||
PipelineUrl: | ||
Value: !Sub https://console.aws.amazon.com/codepipeline/home?region=${AWS::Region}#/view/${Pipeline} |
Oops, something went wrong.