-
Notifications
You must be signed in to change notification settings - Fork 107
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 #661
Conversation
33883c0
to
7b1a52e
Compare
7b1a52e
to
1a689f7
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #661 +/- ##
==========================================
+ Coverage 43.31% 45.03% +1.71%
==========================================
Files 13 12 -1
Lines 3068 3080 +12
Branches 394 428 +34
==========================================
+ Hits 1329 1387 +58
+ Misses 1739 1692 -47
- Partials 0 1 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
[citest] |
@@ -22,15 +22,38 @@ | |||
author: "Wen Liang (@liangwen12year)" | |||
""" | |||
|
|||
EXAMPLES = r""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the format consistent, should we also add the options: desired_state:
for network_state ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the format consistent, should we also add the
options: desired_state:
for network_state ?
It was already there -
network/library/network_state.py
Line 17 in 1a689f7
options: |
One thing to note is that this internal module documentation is intended for end users to call these modules directly, without using the role. This use case does not work and is unsupported. For us, this internal role documentation and formatting is really only so that we can pass ansible-lint and ansible-test gating tests. For us, the main documentation is the README.md for the role, which describes the working and supported interface. Users are not supposed to know or care that there are modules used internally in the role to implement the functionality of the role.
tests/integration/conftest.py
Outdated
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--provider", action="store", default="nm", help="Network provider" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked the commit c29a2bf, is not the hook used with tests/integration/test_ethernet.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked the commit c29a2bf, is not the hook used with
tests/integration/test_ethernet.py
?
I see it in that commit - but where/how is it used? doing git grep conftest
in the network
role local git clone shows nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that the tests_integration_pytest.yml
failure is related to the changes, I think that the initialization hooks are the common usage of conftest.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok - I see - conftest.py is used internally by pytest - so no explicit reference - I added it back
[citest] |
3a61e9b
to
7156bb8
Compare
[citest] |
[citest bad] |
|
||
# pylint: enable=import-error, no-name-in-module | ||
|
||
provider.NetworkManagerProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason to remove this file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason to remove this file ?
https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/empty-init.html
It appears that this isn't being used directly - but perhaps it is needed to make the unit tests work - not sure - but for sure we need to make this an empty file, and figure out some other way to make the unit tests work if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any unit test failures though - so IMO it isn't needed
The only test failures I see are
- tests_provider_nm and tests_regression_nm on CentOS 9 - I don't think we need to run these tests on platforms where initscripts is not supported
- tests_bond_options_nm on CentOS 8 - maybe the test is disabling network access? cannot connect to the EPEL repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For skipping initscripts tests, I have the PR for review, #663
for the tests_bond_options_nm on CentOS 8, the test is not fully started yet, it fails in "INIT Prepare setup" where dnsmasq needs to be installed, maybe the EPEL repo can not be accessed itself sometime ? Also I noticed that some other bond tests (e.g. tests_bond_nm.yml) may fail for the same reason, and tests_bond_options.yml can also pass sometimes. see:
https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs/lsr-citool_network-663-70e4146_CentOS-Stream-8_20231220-205206/artifacts/summary.html
https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs/lsr-citool_network-663-70e4146_CentOS-Stream-8_20231220-205218/artifacts/summary.html
7156bb8
to
921be00
Compare
[citest] |
921be00
to
e034387
Compare
[citest] |
1 similar comment
[citest] |
[citest bad] |
…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. 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 The file `examples/down_profile+delete_interface.yml` was not used and was causing ansible-lint errors. ansible-lint enforces the order of keywords in plays - `name`, then `hosts`, then `vars`, then `tasks`. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
e034387
to
661f72f
Compare
ci: Use supported ansible-lint action; run ansible-lint against the collection
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-coreversion 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.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.yamlThe file
examples/down_profile+delete_interface.yml
was not used and was causing ansible-lint errors.
ansible-lint enforces the order of keywords in plays -
name
,then
hosts
, thenvars
, thentasks
.