Skip to content

Commit

Permalink
fix(gh): adjuts tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Langleu committed Oct 17, 2024
1 parent b89deab commit 1a687c1
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 229 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/aws_ec2_golden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,25 @@ jobs:
run: |
terraform init
# We are hardcoding the AMI as it's a moving target
terraform plan -var aws_ami="ami" -out=tfplan
terraform plan -var aws_ami="ami" -out=tfplan || true
- name: Convert Terraform plan to JSON
working-directory: aws/ec2/terraform
run: |
# Use jq to "pretty print" the JSON output to allow comparison
terraform show -json tfplan | jq > tfplan.json
- name: Compare Terraform plan with golden file
working-directory: aws/ec2/terraform
run: |
delta <(jq .planned_values plan2.json) <(jq .planned_values plan3.json)
delta <(jq .planned_values ${{github.workspace}}/aws/ec2/test/golden/tfplan.json) <(jq .planned_values ${{github.workspace}}/aws/ec2/terraform/tfplan.json)
exit $?
- name: Post diff on PR
if: failure() && github.event_name == 'pull_request'
uses: int128/diff-action@v1
if: always() && github.event_name == 'pull_request'
uses: int128/diff-action@3be570dc544fa95fcb45525611b05615778714ca # v1
with:
base: ${{ github.workspace }}/aws/ec2/test/golden/tfplan.json
head: ${{ github.workspace }}/aws/ec2/terraform/tfplan.json
comment-header: Terraform plan diff
comment-footer: Check the delta diff in the GH workflow for a detailed comparison.
- name: Overwrite local golden files
if: failure() && github.event_name == 'push'
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/aws_ec2_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
schedule:
- cron: 0 4 * * 1-5
workflow_dispatch:
pull_request:
paths:
- .github/workflows/aws_ec2_tests.yml
- .tool-versions
- aws/ec2/**
- '!aws/ec2/test/golden/**'
# pull_request:
# paths:
# - .github/workflows/aws_ec2_tests.yml
# - .tool-versions
# - aws/ec2/**
# - '!aws/ec2/test/golden/**'

# limit to a single execution per actor of this workflow
concurrency:
Expand Down
Empty file modified .github/workflows/scripts/tf_configure_remote_backend.sh
100644 → 100755
Empty file.
Loading

0 comments on commit 1a687c1

Please sign in to comment.