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 #210

Merged
merged 1 commit into from
Jan 6, 2024

Conversation

richm
Copy link
Collaborator

@richm richm commented Dec 16, 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 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.

distutils.version is deprecated, and it is a hard error in python 3.12
Instead, use packaging.version - unfortunately, this means having to
add a dependency on python3-packaging on platforms that support it -
notably, there is no python-packaging available on EL7, so fall back
to using distutils.version there.

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

Signed-off-by: Rich Megginson rmeggins@redhat.com

@richm richm requested a review from rjeffman as a code owner December 16, 2023 00:03
Copy link

codecov bot commented Dec 16, 2023

Codecov Report

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

Comparison is base (4f50fa1) 0.00% compared to head (ee5e5b7) 32.95%.

Files Patch % Lines
module_utils/certificate_lsr/providers/base.py 79.62% 11 Missing ⚠️
...dule_utils/certificate_lsr/providers/certmonger.py 64.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main     #210       +/-   ##
=========================================
+ Coverage      0   32.95%   +32.95%     
=========================================
  Files         0        3        +3     
  Lines         0      613      +613     
  Branches      0      128      +128     
=========================================
+ Hits          0      202      +202     
- Misses        0      411      +411     
Flag Coverage Δ
sanity 32.95% <74.68%> (?)

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
Collaborator Author

richm commented Dec 16, 2023

[citest]

@richm
Copy link
Collaborator Author

richm commented Dec 18, 2023

[citest]

@richm
Copy link
Collaborator Author

richm commented Dec 18, 2023

centos 7 and 9 failures are baseos ci issues - the tests pass on those platforms locally

Copy link
Collaborator

@rjeffman rjeffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is similar to what we did to ansible-freeipa a while ago.

LGTM.

…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 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.

`distutils.version` is deprecated, and it is a hard error in python 3.12
Instead, use `packaging.version` - unfortunately, this means having to
add a dependency on `python3-packaging` on platforms that support it -
notably, there is no python-packaging available on EL7, so fall back
to using `distutils.version` there.

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

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
run_after:
description:
- Command that should run after saving the certificate.
required: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing required: false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is required: false - better style to omit required unless required: true

@richm richm merged commit 7a1fb24 into linux-system-roles:main Jan 6, 2024
18 checks passed
@richm richm deleted the ansible-lint-test-2.16 branch January 6, 2024 01:00
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.

None yet

3 participants