Skip to content

Commit

Permalink
Fix drift detection mode (#42)
Browse files Browse the repository at this point in the history
* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode

* Fix drift detection mode
  • Loading branch information
goruha authored Oct 16, 2023
1 parent e8ef6e7 commit 7ce5db8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test-changes-exists-drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ jobs:
echo "file_md=$(cat ./metadata/issue-description-plat-ue2-sandbox-foobar_changes.md | jq -Rs .)" >> $GITHUB_OUTPUT
echo "file_json=$(cat ./metadata/plat-ue2-sandbox-foobar_changes.metadata.json | jq -Rs . )" >> $GITHUB_OUTPUT
echo "file_json=$(cat ./metadata/plat-ue2-sandbox-foobar_changes.metadata.json | jq -Rs . )" >> $GITHUB_OUTPUT
echo files_json_count=$(ls -lA ./metadata/*.json | wc -l) >> $GITHUB_OUTPUT
- uses: nick-fields/assert-action@v1
with:
Expand All @@ -108,6 +110,11 @@ jobs:
actual: "${{ fromJSON(needs.test.outputs.summary) }}"
expected: "${{ fromJSON(steps.metadata.outputs.file_md) }}"

- uses: nick-fields/assert-action@v1
with:
actual: "${{ steps.metadata.outputs.files_json_count }}"
expected: "1"

- uses: nick-fields/assert-action@v1
with:
actual: "${{ fromJSON(steps.metadata.outputs.file_json) }}"
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/test-no-changes-drift-more.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,35 @@ jobs:
test -f ./metadata/plat-ue2-sandbox-foobar.metadata.json
FILE_EXISTS=$?
echo "file_exists=${FILE_EXISTS}" >> $GITHUB_OUTPUT
test -f ./metadata/issue-description-plat-ue2-sandbox-foobar.md
FILE_EXISTS=$?
echo "file_md_exists=${FILE_EXISTS}" >> $GITHUB_OUTPUT
echo "file_json=$(cat ./metadata/plat-ue2-sandbox-foobar.metadata.json | jq -Rs . )" >> $GITHUB_OUTPUT
- uses: nick-fields/assert-action@v1
with:
actual: "${{ steps.metadata.outputs.dir_exists }}"
expected: "1"
expected: "0"

- uses: nick-fields/assert-action@v1
with:
actual: "${{ steps.metadata.outputs.file_exists }}"
expected: "0"

- uses: nick-fields/assert-action@v1
with:
actual: "${{ steps.metadata.outputs.file_md_exists }}"
expected: "1"

- uses: nick-fields/assert-action@v1
with:
actual: "${{ fromJSON(steps.metadata.outputs.file_json) }}"
expected: |
{ "stack": "plat-ue2-sandbox", "component": "foobar", "componentPath": "components/terraform/foobar", "drifted": false, "error": false }
- uses: nick-fields/assert-action@v1
with:
actual: "${{ fromJSON(needs.test.outputs.summary) }}"
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ runs:
fi
- name: Upload Artifacts
if: ${{ inputs.drift-detection-mode-enabled == 'true' && steps.atmos-plan.outputs.no-changes == 'false' }}
if: ${{ steps.atmos-github-actions-enabled.outputs.value == 'true' && inputs.drift-detection-mode-enabled == 'true' }}
uses: actions/upload-artifact@v3
with:
name: metadata
Expand Down

0 comments on commit 7ce5db8

Please sign in to comment.