|
45 | 45 | template: long-running-stack.yaml |
46 | 46 | capabilities: "CAPABILITY_IAM" |
47 | 47 | timeout-in-minutes: 90 |
| 48 | + |
| 49 | + test-no-execute-changeset: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - name: Check out repository code |
| 53 | + uses: actions/checkout@v3 |
| 54 | + - name: Configure AWS credentials from Test account |
| 55 | + uses: aws-actions/configure-aws-credentials@v1 |
| 56 | + with: |
| 57 | + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} |
| 58 | + aws-region: us-east-1 |
| 59 | + - name: Cleanup existing stack if present |
| 60 | + run: | |
| 61 | + STACK_NAME="test-no-execute-changeset-${{ github.run_number }}-${{ github.run_attempt }}" |
| 62 | + if aws cloudformation describe-stacks --stack-name $STACK_NAME 2>/dev/null; then |
| 63 | + echo "Stack exists, deleting it first..." |
| 64 | + aws cloudformation delete-stack --stack-name $STACK_NAME |
| 65 | + aws cloudformation wait stack-delete-complete --stack-name $STACK_NAME |
| 66 | + fi |
| 67 | + - name: Deploy with no-execute-changeset=1 (should create stack in REVIEW_IN_PROGRESS) |
| 68 | + uses: aws-actions/aws-cloudformation-github-deploy@master |
| 69 | + with: |
| 70 | + name: test-no-execute-changeset-${{ github.run_number }}-${{ github.run_attempt }} |
| 71 | + template: no-execute-changeset-test.yaml |
| 72 | + capabilities: "CAPABILITY_IAM" |
| 73 | + no-execute-changeset: "1" |
| 74 | + - name: Verify stack is in REVIEW_IN_PROGRESS status |
| 75 | + run: | |
| 76 | + STACK_NAME="test-no-execute-changeset-${{ github.run_number }}-${{ github.run_attempt }}" |
| 77 | + echo "Checking stack status after deployment with no-execute-changeset=1..." |
| 78 | + STACK_STATUS=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query 'Stacks[0].StackStatus' --output text) |
| 79 | + echo "Stack status: $STACK_STATUS" |
| 80 | + |
| 81 | + if [ "$STACK_STATUS" = "REVIEW_IN_PROGRESS" ]; then |
| 82 | + echo "✅ SUCCESS: Stack is in REVIEW_IN_PROGRESS status as expected" |
| 83 | + else |
| 84 | + echo "❌ FAILURE: Stack status is $STACK_STATUS, expected REVIEW_IN_PROGRESS" |
| 85 | + echo "This indicates the bug is present - the changeset was executed despite no-execute-changeset=1" |
| 86 | + exit 1 |
| 87 | + fi |
| 88 | + - name: Cleanup test stack |
| 89 | + if: always() |
| 90 | + run: | |
| 91 | + STACK_NAME="test-no-execute-changeset-${{ github.run_number }}-${{ github.run_attempt }}" |
| 92 | + if aws cloudformation describe-stacks --stack-name $STACK_NAME 2>/dev/null; then |
| 93 | + aws cloudformation delete-stack --stack-name $STACK_NAME |
| 94 | + aws cloudformation wait stack-delete-complete --stack-name $STACK_NAME |
| 95 | + echo "Test stack cleaned up successfully" |
| 96 | + fi |
0 commit comments