AWS ECS Fargate服务任务未通过Codepipeline Cloudformation提供程序获取更新的ECR映像

时间:2020-06-30 06:56:17

标签: docker amazon-cloudformation amazon-ecs aws-codepipeline aws-fargate

这是设置代码管道的方式 1.来源​​->代码提交 2.Build-> Codebuild将从codecommit构建docker镜像并推送到ECR注册表 3.Deploy-> Codedeploy将通过cloudformation提供程序(ActionMode:CREATE_UPDATE)部署新映像

我能够将更新后的docker镜像成功推送到ECR,但是ECS fargate服务未使用新更改进行更新,并且我不确定我的配置出了什么问题。我正在提供服务定义和管道配置以供参考:

Cloudformation服务定义:

  Service:
    Type: AWS::ECS::Service
    Properties: 
      Cluster: !Ref Cluster
      TaskDefinition: !Ref TaskDefinition
      LaunchType: FARGATE
      DeploymentConfiguration:
        **MaximumPercent: 200**
        **MinimumHealthyPercent: 0**
      DeploymentController:
        **Type: ECS**
      **DesiredCount: 1**
      HealthCheckGracePeriodSeconds: 120
      NetworkConfiguration: 
        AwsvpcConfiguration:
          AssignPublicIp: DISABLED
          Subnets:
            - !Ref PrivateSubnetOne
            - !Ref PrivateSubnetTwo
          SecurityGroups: 
            - !Ref ContainerSecurityGroup      
      LoadBalancers:
        - ContainerName: !Ref ServiceName
          ContainerPort: 80
          TargetGroupArn: !Ref TargetGroup

CodePipeline阶段:

                  Name: Deploywebservice
                  ActionTypeId:
                    Category: Deploy
                    Owner: AWS
                    Version: "1"
                    Provider: CloudFormation
                  InputArtifacts:
                    - Name: Sourcefiles
                  Configuration:  
                    **ActionMode: CREATE_UPDATE**
                    StackName: !Sub ${AWS::StackName}-webservice
                    RoleArn: !GetAtt CloudFormationRole.Arn
                    TemplatePath: SourceZip::web-service.yml
                    TemplateConfiguration: SourceZip::web-service-parameters.json 
                    Capabilities: CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND
                  RunOrder: 1

我的想法真的耗尽了,因此将其发布在此处以寻求帮助。

0 个答案:

没有答案