簡體   English   中英

AWS CDK EcsDeployAction 更新現有 Fargate 服務

[英]AWS CDK EcsDeployAction update existing Fargate Service

我正在通過 AWS CDK 輕松部署 Fargate 服務。

現在我需要更新一個服務,例如一個任務圖像。
我正在嘗試通過使用 @aws-cdk/aws-codepipeline 和操作 EcsDeployAction 來完成此操作

我正在嘗試導入和更新現有(以前部署的)fargate 服務,如下所示:

const pipeline = new codepipeline.Pipeline(this, 'MyPipeline')

// import an existing fargate service
const fargateService = ecs.FargateService.fromFargateServiceArn(
  this,
  "FargateService",
  "MyFargateServiceARN"
);

// Deploy a new version according to what 
const sourceStage = this.pipeline.addStage({
  stageName: 'Deploy',
  actions: [
    new codepipeline_actions.EcsDeployAction({
      actionName: "ECS-Service",
      service: fargateService,       <--- here the typescript error
      input: ...
    })
  ]
})

但這似乎不正確,因為我收到 typescript 錯誤:

Property 'cluster' is missing in type 'IFargateService' but required in type 'IBaseService'

任何想法?

類型不匹配。 EcsDeployActionProps 期望服務屬性為IBaseService類型。 但它從fromFargateServiceArn獲得了不兼容的IFargateService類型。

幸運的是,相關的static fromFargateServiceAttributes(scope, id, attrs)返回您正在尋找的兼容類型IBaseService

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM