fix: terraform.ymlのTerraform Planステップにpipefailを追加 - #54
Draft
kigawa01 wants to merge 1 commit into
Draft
Conversation
`./run.sh ... plan ... | tee plan_output.txt`にpipefailが設定されておらず、 teeの終了コード(常に0)でステップの成否が判定されていたため、 run.sh plan自体が失敗(postcondition違反、terraform init/planエラー等) していてもステップが「成功」と誤判定されていた。 実際にkigawa-net/infra#51のCIで、hardware/k8s-worker3のplanが "join_info did not return a token"のpostcondition違反で失敗して いたにもかかわらず、GitHub Actions上は該当ステップ・ジョブとも 成功(緑)と表示されるという形でこの問題が顕在化した。 kigawa-net/kinfra連携のterraform-kinfra.ymlで既に同様の修正を 行っている(同じパターンのバグ)。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #51のCIチェックで
terraform (hardware, k8s-worker3)が"pass"表示になっていたが、実際のログを確認するとterraform plan自体は"Resource postcondition failed: join_info did not return a token"で失敗していた。原因は
Terraform Planステップの./run.sh ... plan ... | tee plan_output.txtにset -o pipefailが設定されておらず、パイプ全体の終了コードが常に成功するteeのものになっていたため、run.sh plan自体の失敗(postcondition違反、terraform init/planエラー等)がステップ・ジョブ全体の成否判定から握りつぶされていたこと。kigawa-net/kinfra連携の
terraform-kinfra.ymlで以前見つけて修正したのと同じパターンのバグ。Changes
.github/workflows/terraform.yml:Terraform Planステップのrun:ブロック先頭にset -o pipefailを追加Test plan
🤖 Generated with Claude Code