1
0
mirror of https://github.com/ebosas/microservices.git synced 2025-08-24 20:08:55 +02:00

Create pipeline with separate builds

This commit is contained in:
ebosas
2021-11-11 12:35:45 +02:00
parent a4aabc7560
commit 28885af9b3
2 changed files with 27 additions and 16 deletions

View File

@@ -26,6 +26,16 @@ Resources:
Properties: Properties:
BucketName: !Sub microservices-${EnvironmentName}-${AWS::AccountId} BucketName: !Sub microservices-${EnvironmentName}-${AWS::AccountId}
#-----------------------------------------------------------------------------#
# Source Credentials
#-----------------------------------------------------------------------------#
SourceCredentials:
Type: AWS::CodeBuild::SourceCredential
Properties:
Token: !Ref GitHubToken
ServerType: GITHUB
AuthType: PERSONAL_ACCESS_TOKEN
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# CodePipeline # CodePipeline
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -47,7 +57,7 @@ Resources:
Type: AWS::CodePipeline::Pipeline Type: AWS::CodePipeline::Pipeline
DependsOn: DependsOn:
- SSMArtifactBucket - SSMArtifactBucket
- SSMCodePipelineServiceRole - SSMCodePipelineServiceRoleArn
- SSMCloudFormationDeployRole - SSMCloudFormationDeployRole
Properties: Properties:
RoleArn: !GetAtt CodePipelineServiceRole.Arn RoleArn: !GetAtt CodePipelineServiceRole.Arn
@@ -409,11 +419,12 @@ Resources:
- "logs:*" - "logs:*"
- "application-autoscaling:*" - "application-autoscaling:*"
- "cloudwatch:*" - "cloudwatch:*"
- "route53:*"
- "rds:*" - "rds:*"
- "mq:*" - "mq:*"
# - "secretsmanager:*" # - "secretsmanager:*"
- "ssm:*" - "ssm:*"
- "codebuild:*"
- "ecr:*"
Resource: "*" Resource: "*"
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -425,12 +436,12 @@ Resources:
Name: /microservices/artifact_bucket Name: /microservices/artifact_bucket
Type: String Type: String
Value: !Ref ArtifactBucket Value: !Ref ArtifactBucket
SSMCodePipelineServiceRole: SSMCodePipelineServiceRoleArn:
Type: AWS::SSM::Parameter Type: AWS::SSM::Parameter
Properties: Properties:
Name: /microservices/codepipeline_service_role Name: /microservices/codepipeline_service_role_arn
Type: String Type: String
Value: !Ref CodePipelineServiceRole Value: !GetAtt CodePipelineServiceRole.Arn
SSMCloudFormationDeployRole: SSMCloudFormationDeployRole:
Type: AWS::SSM::Parameter Type: AWS::SSM::Parameter
Properties: Properties:

View File

@@ -26,9 +26,9 @@ Parameters:
ArtifactBucket: ArtifactBucket:
Type: AWS::SSM::Parameter::Value<String> Type: AWS::SSM::Parameter::Value<String>
Default: /microservices/artifact_bucket Default: /microservices/artifact_bucket
CodePipelineServiceRole: CodePipelineServiceRoleArn:
Type: AWS::SSM::Parameter::Value<String> Type: AWS::SSM::Parameter::Value<String>
Default: /microservices/codepipeline_service_role Default: /microservices/codepipeline_service_role_arn
CloudFormationDeployRole: CloudFormationDeployRole:
Type: AWS::SSM::Parameter::Value<String> Type: AWS::SSM::Parameter::Value<String>
Default: /microservices/cloudformation_deploy_role Default: /microservices/cloudformation_deploy_role
@@ -46,16 +46,16 @@ Resources:
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# CodeBuild Project # CodeBuild Project
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
SourceCreds: # SourceCredentials:
Type: AWS::CodeBuild::SourceCredential # Type: AWS::CodeBuild::SourceCredential
Properties: # Properties:
Token: !Ref GitHubToken # Token: !Ref GitHubToken
ServerType: GITHUB # ServerType: GITHUB
AuthType: PERSONAL_ACCESS_TOKEN # AuthType: PERSONAL_ACCESS_TOKEN
CodeBuildProject: CodeBuildProject:
Type: AWS::CodeBuild::Project Type: AWS::CodeBuild::Project
DependsOn: SourceCreds # DependsOn: SourceCredentials
Properties: Properties:
Artifacts: Artifacts:
Type: NO_ARTIFACTS Type: NO_ARTIFACTS
@@ -136,7 +136,7 @@ Resources:
Pipeline: Pipeline:
Type: AWS::CodePipeline::Pipeline Type: AWS::CodePipeline::Pipeline
Properties: Properties:
RoleArn: !Ref CodePipelineServiceRole RoleArn: !Ref CodePipelineServiceRoleArn
ArtifactStore: ArtifactStore:
Type: S3 Type: S3
Location: !Ref ArtifactBucket Location: !Ref ArtifactBucket
@@ -252,7 +252,7 @@ Resources:
- s3:GetObject - s3:GetObject
- s3:PutObject - s3:PutObject
- s3:GetObjectVersion - s3:GetObjectVersion
- Resource: !GetAtt Repository.Arn - Resource: "*" # !GetAtt Repository.Arn
Effect: Allow Effect: Allow
Action: Action:
- ecr:GetDownloadUrlForLayer - ecr:GetDownloadUrlForLayer