From dc0e340759a6a42f042405cf03347b6f3c328dd6 Mon Sep 17 00:00:00 2001 From: Aman Agrawal <42177948+aman0408@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:57:06 -0400 Subject: [PATCH] feat: Add cloudformation describe stack step on create cluster failure (#4556) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/actions/e2e/create-cluster/action.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/create-cluster/action.yaml b/.github/actions/e2e/create-cluster/action.yaml index 62bd52af82a5..6d9023825659 100644 --- a/.github/actions/e2e/create-cluster/action.yaml +++ b/.github/actions/e2e/create-cluster/action.yaml @@ -57,7 +57,7 @@ runs: --template-file $CLOUDFORMATION_PATH \ --capabilities CAPABILITY_NAMED_IAM \ --parameter-overrides "ClusterName=${{ inputs.cluster_name }}" \ - --tags "testing.karpenter.sh/type=e2e" "github.com/run-url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + --tags "testing.karpenter.sh/type=e2e" "github.com/run-url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" "karpenter.sh/discovery=${{ inputs.cluster_name }}" - name: create or upgrade cluster shell: bash run: | @@ -141,4 +141,13 @@ runs: --cluster "${{ inputs.cluster_name }}" \ --arn "arn:aws:iam::${{ inputs.account_id }}:role/KarpenterNodeRole-${{ inputs.cluster_name }}" \ --group system:bootstrappers \ - --group system:nodes \ No newline at end of file + --group system:nodes + - name: cloudformation describe stack events + shell: bash + if: failure() + run: | + stack_names=$(aws cloudformation describe-stacks --query 'Stacks[?Tags[?Key == `karpenter.sh/discovery` && Value == `${{ inputs.CLUSTER_NAME }}`]].{StackName: StackName}' --output text) + for stack_name in $stack_names; do + echo "Stack Events for $stack_name:" + aws cloudformation describe-stack-events --stack-name $stack_name + done \ No newline at end of file