Bootstrap: bootstrapping multiple environments with same bootstrap-bucket-name causes inconsistent stack creation

オープン
#96 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
aws, typescript
領域
cli, cloud

調査の方向性

BootstrapEnvironmentOptions と、packages/aws-cdk/lib/cli/cdk-toolkit.ts の 963-989 行にある CLI の実装から始め、次に packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts の BootstrappingParameters を調べます。bootstrapEnvironment がこれらのオプションをどのように受け取るかを追跡し、パラメーターを環境ごとにスコープする方法を特定してください。カスタムバケット名を使用して複数の環境をブートストラップしても、共有設定が原因で後続の環境が失敗しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

p2

Bootstrap fails when multiple environments are being bootstrapped with a custom bucketName

Description

Users can pass in BootstrappingParameters to modify how resources are created during bootstrap:
https://github.com/aws/aws-cdk-cli/blob/7517ecc2ded9169028540bc3bfdc8e320b161043/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts#L66-L72

If bucketName is passed in, bootstrap will attempt to create the bucket. If the bucket already exists, the bootstrap operation will fail.

When bootstrapping multiple environments, it is possible to pass in bucketName. However, this will cause at least one environment to fail bootstrapping. Assuming the bucket name is not already taken, the first environment that is bootstrapped will use that bucket name and succeed. All other environments will fail to bootstrap, since the bucket name is already taken.

Reproduction
Command-line:
cdk bootstrap --all \
  --bootstrap-bucket-name my-custom-parameters-bucket-481665128236 \
  aws://481665128236/us-east-2 \
  aws://481665128236/us-west-1
Result:

Only one environment is bootstrapped successfully.

Image Image
Proposed fix

BootstrappingParameters should be passed in per-environment. It should remain optional. The current CLI implementation is as follows:
https://github.com/aws/aws-cdk-cli/blob/7517ecc2ded9169028540bc3bfdc8e320b161043/packages/aws-cdk/lib/cli/cdk-toolkit.ts#L963-L989

BootstrapEnvironmentOptions is bootstrap-action-scoped (i.e. account-scoped), but it is passed into bootstrapEnvironment, an environment-scoped (i.e. region-scoped) function.

Consider something like the following as a param for bootstrap:

interface EnvironmentBootstrapConfig {
  readonly environment: string;  // The environment descriptor (e.g. 'aws://123456789012/us-east-1')
  readonly parameters?: BootstrappingParameters;
  // Other environment-specific options that were previously in BootstrapOptions
}
主要言語
TypeScript
スター
110
フォーク
138
平均マージ
1日 9時間
マージ済み PR(30日)
55

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/aws-cdk-cli のほかの issue

aws/aws-cdk-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。