Skip to content

Commit

Permalink
Add test for argument_specs matching
Browse files Browse the repository at this point in the history
Compare contents of `meta/arguments_spec.yml` against `defaults/main.yml` on
each role to make sure keys match.

Signed-off-by: SuperQ <[email protected]>
  • Loading branch information
SuperQ committed Jul 29, 2023
1 parent 603aa0c commit 1127aad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ansible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ jobs:
- name: Lint collection
uses: ansible/ansible-lint-action@main

- name: Lint arguments spec
uses: mikefarah/yq@master
with:
cmd: |
for role in roles/* ; do
echo "Checking ${role}"
diff -u \
<(yq eval -r 'keys | .[]' "${role}/defaults/main.yml" | sort -u) \
<(yq eval '.argument_specs.main.options | keys | .[] ' "${role}/meta/argument_specs.yml" | sort -u)
if [[ $? -ne 0 ]] ; then
echo "ERROR: ${role}: meta/argument_specs.yml doesn't match defaults/main.yml"
exit 1
fi
done
discover-ansible-versions:
runs-on: ubuntu-latest
outputs:
Expand Down

0 comments on commit 1127aad

Please sign in to comment.