我很容易地通过AWS CDK部署AWS服务。
现在我需要更新一个服务,例如一个任务映像。
我试图通过使用@aws/aws-codepipeline和action 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'有什么想法吗?
发布于 2021-11-23 20:59:21
有一种类型错配。EcsDeployActionProps 期待服务道具类型为IBaseService。但是它从IFargateService获得了一个不兼容的fromFargateServiceArn类型。
幸运的是,相关的静态fromFargateServiceAttributes(范围、id、attrs)返回您要寻找的兼容类型IBaseService。
https://stackoverflow.com/questions/70085753
复制相似问题