1
0
mirror of https://github.com/ebosas/microservices.git synced 2025-07-12 22:41:13 +02:00

[DeployInfrastructure]

This commit is contained in:
ebosas
2021-11-09 13:41:04 +02:00
parent 4c694c0534
commit 3d72376329

View File

@ -218,9 +218,15 @@ Resources:
- Type: FILE_PATH - Type: FILE_PATH
Pattern: ^(cmd/server/|internal/|web/|server.Dockerfile) Pattern: ^(cmd/server/|internal/|web/|server.Dockerfile)
ExcludeMatchedPattern: false ExcludeMatchedPattern: false
# - Type: COMMIT_MESSAGE - - Type: EVENT
# Pattern: \[(BuildServer|BuildAll)\] Pattern: PUSH
# ExcludeMatchedPattern: false ExcludeMatchedPattern: false
- Type: HEAD_REF
Pattern: !Sub ^refs/heads/${GitHubBranch}$
ExcludeMatchedPattern: false
- Type: COMMIT_MESSAGE
Pattern: \[(BuildServer|BuildAll)\]
ExcludeMatchedPattern: false
ServiceRole: !Ref CodeBuildServiceRole ServiceRole: !Ref CodeBuildServiceRole
TimeoutInMinutes: 10 TimeoutInMinutes: 10
@ -233,7 +239,9 @@ Resources:
AuthType: PERSONAL_ACCESS_TOKEN AuthType: PERSONAL_ACCESS_TOKEN
# Pipeline # Pipeline
PipelineServer: # Also need a CloudWatch event:
# https://docs.aws.amazon.com/codepipeline/latest/userguide/create-cwe-ecr-source-cfn.html
Pipeline:
Type: AWS::CodePipeline::Pipeline Type: AWS::CodePipeline::Pipeline
Properties: Properties:
RoleArn: !GetAtt CodePipelineServiceRole.Arn RoleArn: !GetAtt CodePipelineServiceRole.Arn
@ -241,9 +249,10 @@ Resources:
Type: S3 Type: S3
Location: !Ref ArtifactBucket Location: !Ref ArtifactBucket
Stages: Stages:
# Pull the iamge from ECR # Get source artifacts
- Name: Source - Name: Source
Actions: Actions:
# Get an image from an ECR repository
- Name: Source - Name: Source
ActionTypeId: ActionTypeId:
Category: Source Category: Source
@ -256,6 +265,21 @@ Resources:
OutputArtifacts: OutputArtifacts:
- Name: Source - Name: Source
RunOrder: 1 RunOrder: 1
# Get source from a GitHub repository
- Name: Code
ActionTypeId:
Category: Source
Owner: ThirdParty
Version: 1
Provider: GitHub
Configuration:
Owner: !Ref GitHubUser
Repo: !Ref GitHubRepo
Branch: !Ref GitHubBranch
# OAuthToken: !Ref GitHubToken
OutputArtifacts:
- Name: Code
RunOrder: 1
# Deploy the service to the ECS/Fargate cluster # Deploy the service to the ECS/Fargate cluster
- Name: Deploy - Name: Deploy
Actions: Actions:
@ -281,6 +305,21 @@ Resources:
InputArtifacts: InputArtifacts:
- Name: Source - Name: Source
# Webhook:
# Type: AWS::CodePipeline::Webhook
# Properties:
# AuthenticationConfiguration:
# SecretToken: !Ref GitHubToken
# Filters:
# - JsonPath: "$.ref"
# MatchEquals: refs/heads/{Branch}
# Authentication: GITHUB_HMAC
# TargetPipeline: !Ref Pipeline
# TargetAction: Code
# Name: MyWebhook
# TargetPipelineVersion: !GetAtt Pipeline.Version
# RegisterWithThirdParty: false
# # The cache pipeline # # The cache pipeline
# PipelineCache: # PipelineCache:
# Type: AWS::CodePipeline::Pipeline # Type: AWS::CodePipeline::Pipeline