AWS CDK EcsDeployAction aktualizovať existujúce Fargate Služby

0

Otázka

Som deployng Fargate služieb prostredníctvom AWS CDK s ľahkosťou.

Teraz musím aktualizovať služby, napríklad úlohu obrazu.
I 'm trying to dosiahnuť použitím @aws-cdk/aws-codepipeline a akcie EcsDeployAction

Snažím sa import a aktualizácia existujúcej (predtým nasadené) fargate služby, ako je tento:

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: ...
    })
  ]
})

Ale to nezdá správne, pretože som si strojom chyba:

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

Akýkoľvek nápad?

1

Najlepšiu odpoveď

1

Tam je typ nesúlad. EcsDeployActionProps očakáva, že služba prop byť typu IBaseService. Ale je to stále nekompatibilný IFargateService typ fromFargateServiceArn.

Našťastie, súvisiacich statické fromFargateServiceAttributes(rozsah, id, attrs) vráti kompatibilné typ IBaseService hľadáte.

2021-11-23 20:59:21

Ďakujem. Budem sa snažiť tento prístup, pre istotu, že to bude fungovať.
andreav

V iných jazykoch

Táto stránka je v iných jazykoch

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