Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Use supported ansible-lint action; run ansible-lint against the collection #410

Merged
merged 1 commit into from
Jan 6, 2024

Conversation

richm
Copy link
Contributor

@richm richm commented Dec 15, 2023

The old ansible-community ansible-lint is deprecated. There is a
new ansible-lint github action. The new ansible-lint has several checks
related to ansible-test and the ignore files. Many of our ignore settings
are not allowed any more and are required to be fixed or addressed in the
Ansible preferred way.

The python imports have to be wrapped in a try/except ImportError, and
where possible, an error must be returned from the module explaining
what was not able to be imported.

The module documentation must comply with the Ansible standards. One
aspect of this is the version_added must be a valid ansible-core
version in X.Y.Z format. Note that this version isn't really used
anywhere, so it doesn't matter for users of the role, it is purely
an ansible-test and import gating issue.

I created a function generate_module_doc which will generate the
DOCUMENTATION options section from the Ansible module_args, if
necessary. Hopefully it won't be necessary going forward.

I fought a losing battle with flake8, pep8, etc. in ansible-test
to try to preserve the formatting in size.py - future developers
are welcome to try.

The result of this is that the .sanity files can be reduced to the
bare minimum which will greatly reduce the maintenance burden of
those files, make it easier to support newer versions of Ansible,
and make it easier to import the system roles collection into Galaxy
and Automation Hub.

The latest Ansible repo gating tests run ansible-lint against
the collection format instead of against individual roles.
We have to convert the role to collection format before running
ansible-test.

Role developers can run this locally using
tox -e collection,ansible-lint-collection
See linux-system-roles/tox-lsr#125

Add --- doc start to .markdownlint.yaml

Fixed some other linter errors in some tests files.

Signed-off-by: Rich Megginson [email protected]

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Attention: 45 lines in your changes are missing coverage. Please review.

Comparison is base (69ce4f8) 13.65% compared to head (41b4828) 13.30%.

Files Patch % Lines
library/blivet.py 0.00% 45 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #410      +/-   ##
==========================================
- Coverage   13.65%   13.30%   -0.35%     
==========================================
  Files           8        8              
  Lines        1736     1781      +45     
  Branches       79       79              
==========================================
  Hits          237      237              
- Misses       1499     1544      +45     
Flag Coverage Δ
sanity 16.54% <57.14%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@richm
Copy link
Contributor Author

richm commented Dec 15, 2023

[citest]

@richm richm force-pushed the ansible-lint-test-2.16 branch from f2beccf to 8f13c40 Compare December 15, 2023 23:46
…ollection

The old ansible-community ansible-lint is deprecated.  There is a
new ansible-lint github action.  The new ansible-lint has several checks
related to ansible-test and the ignore files.  Many of our ignore settings
are not allowed any more and are required to be fixed or addressed in the
Ansible preferred way.

The python imports have to be wrapped in a try/except ImportError, and
where possible, an error must be returned from the module explaining
what was not able to be imported.

The module documentation must comply with the Ansible standards.  One
aspect of this is the `version_added` must be a valid ansible-core
version in X.Y.Z format.  Note that this version isn't really used
anywhere, so it doesn't matter for users of the role, it is purely
an `ansible-test` and import gating issue.

I created a function `generate_module_doc` which will generate the
DOCUMENTATION options section from the Ansible module_args, if
necessary.  Hopefully it won't be necessary going forward.

I fought a losing battle with flake8, pep8, etc. in ansible-test
to try to preserve the formatting in size.py - future developers
are welcome to try.

The result of this is that the .sanity files can be reduced to the
bare minimum which will greatly reduce the maintenance burden of
those files, make it easier to support newer versions of Ansible,
and make it easier to import the system roles collection into Galaxy
and Automation Hub.

The latest Ansible repo gating tests run ansible-lint against
the collection format instead of against individual roles.
We have to convert the role to collection format before running
ansible-test.

Role developers can run this locally using
`tox -e collection,ansible-lint-collection`
See linux-system-roles/tox-lsr#125

Add `---` doc start to .markdownlint.yaml

Fixed some other linter errors in some tests files.

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the ansible-lint-test-2.16 branch from 8f13c40 to 41b4828 Compare January 3, 2024 21:41
@richm richm merged commit 8dbc9b4 into linux-system-roles:main Jan 6, 2024
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant