AWS CDK EcsDeployAction更新现有的服务Fargate

0

的问题

我deployng Fargate服务账户CDK提供方便。

现在我需要更新服务,例如任务的图像。
I'm试图做到这一点通过使用@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: ...
    })
  ]
})

但它似乎不会正确因为我得到一稿错误:

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

任何想法?

1

最好的答案

1

有一种类型的不匹配。 EcsDeployActionProps 预计该服务丙 要的类型 IBaseService. 但是它越来越不相容 IFargateService 的类型 fromFargateServiceArn.

幸运的是,相关的 静态fromFargateServiceAttributes(范围、标识、attrs) 返回的兼容类型 IBaseService 你是在寻找。

2021-11-23 20:59:21

谢谢你。 我会尝试这种方法,用于确保它的工作。
andreav

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................