Commit graph

798 commits

Author SHA1 Message Date
dependabot[bot]
4aef173aea
ci: Bump ansible/ansible-lint from 6 to 24 (#677)
Bumps [ansible/ansible-lint](https://github.com/ansible/ansible-lint) from 6 to 24.
- [Release notes](https://github.com/ansible/ansible-lint/releases)
- [Commits](https://github.com/ansible/ansible-lint/compare/v6...v24)

---
updated-dependencies:
- dependency-name: ansible/ansible-lint
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 15:46:58 +01:00
Rich Megginson
e681c3fea5 test: improve bond test failure debugging
Improve bond test failure debugging
* put test setup into block/always so that cleanup happens for setup failures
* trace shell commands so that we can determine exactly which command failed
* add error reporting so that when certain commands fail, we can determine the error code

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-02-27 13:17:16 -05:00
Rich Megginson
4b12e154a6 docs(changelog): version 1.15.1 [citest skip]
Update changelog and .README.html for version 1.15.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-02-14 20:32:54 -07:00
Wen Liang
c6be8dfde5 test: Purge DNS config at the end of tests_network_state.yml
Without purging the DNS testing config at the end
`tests_network_state.yml`, the managed hosts can not properly resolve
certain hosts (e.g. mirrors.fedoraproject.org, mirrors.centos.org )
in the package installation task of other tests.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
b4f51e2691 test: Add DNS, routes and network connectivity checks during cleanup
In order to guarantee each test is cleaned up properly in the end, it
is important to add a post-test check to each test checking that:

- Routes and DNS are restored.
- Network connectivity to certain hosts are preserved.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
ae9f212086 test: Retry until success when installing package
Sometimes the rpm download returns a 403, which is likely caused by
too many parallel jobs attempt the download from the same controller in
too short a period of time, so the epel server throttles additional
downloads - use a retry here to mitigate.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
910ddd20a9 test: Rewrite tests_bond_options.yml in the new testing format
The new testing format is more concise and easier to debug when test
failure happens.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Rich Megginson
6c74dee859 ci: fix python unit test - copy pytest config to tests/unit
This is fixed by tox-lsr 3.2.2 - all actions that use tox-lsr are updated to
3.2.2, not just the python unit tests, even though the fix is only related to
pytest.  All roles are updated to use tox-lsr 3.2.2 for the sake of consistency
even if not affected by the pytest issue.

Something changed recently in the way github actions provisions systems which
means some of the directories are not readable by the python unit test actions.
In addition, the python unit tests were causing a lot of unnecessary directory
traversal doing collection/discovery of unit test files, because of using
`pytest -c /path/to/tox-lsr/pytest.ini` Unfortunately, with `pytest`, the
directory of the config file is the root directory for the tests and tests
discovery, and there is no way around this.

Therefore, the only solution is to copy the tox-lsr `pytest.ini` to the
`tests/unit` directory, which makes that the test root directory.

See also https://github.com/linux-system-roles/tox-lsr/pull/160

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-02-05 17:14:33 -07:00
dependabot[bot]
779eb87a31 ci: Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 14:36:29 -07:00
Wen Liang
9b76608757 test: Clean up mock wifi at the end of each wireless test
Baseos CI runs different wireless tests in a sequence, the mock wifi
needs to be cleaned up properly at the end of each wireless test,
otherwise, it will cause the failure during the setup of mock wifi
for the next wireless test.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-01-29 14:44:04 -07:00
Rich Megginson
4f1137415c docs(changelog): version 1.15.0 [citest skip]
Update changelog and .README.html for version 1.15.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-01-17 13:34:45 -07:00
Wen Liang
b7492a27ba feat: Support blackhole, prohibit and unreachable route types
It is useful and common practice to configure the routes with blackhole,
prohibit, and unreachable route types when users have BGP routing
setups.

Notice that this feature is only for nm provider using
`network_connections` variable. Configuring blackhole, prohibit, and
unreachable route types is also supported by using `network_state` since
nmstate version 2.2.20 (the setting name is `route-type`).

Resolves: https://issues.redhat.com/browse/RHEL-19579

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-01-12 14:14:50 -07:00
Rich Megginson
735d4befa7 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 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.

This also requires tox-lsr 3.2.1 - bump other actions to use 3.2.1

Role developers can run this locally using
`tox -e collection,ansible-lint-collection`
See https://github.com/linux-system-roles/tox-lsr/pull/125

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-01-12 07:46:51 -07:00
Rich Megginson
e4d499763c 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-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 https://github.com/linux-system-roles/tox-lsr/pull/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>
2024-01-05 17:36:07 -07:00
dependabot[bot]
15e705dd95 ci: Bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-03 13:25:06 -07:00
dependabot[bot]
fc593dcffa ci: Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-03 13:24:24 -07:00
Wen Liang
bbdc7f77c4 test: Fix wifi test failures
CentOS Stream build process has been moved to
https://kojihub.stream.centos.org.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-23 13:51:06 -07:00
Wen Liang
55e953099a tests: Fix installing kernel module in Fedora
`uname -m` will show the machine hardware name.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-23 13:49:48 -07:00
Wen Liang
eab5cccfcc test: Skip running tests where initscripts is not supported
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-21 08:24:55 -07:00
Rich Megginson
e213dc9af9 docs(changelog): version 1.14.2 [citest skip]
Update changelog and .README.html for version 1.14.2

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-12-12 09:07:26 -07:00
Rich Megginson
428273cf2a refactor: get_ostree_data.sh use env shebang - remove from .sanity*
Use the `#!/usr/bin/env bash` shebang which is ansible-test friendly.
This means we can remove get_ostree_data.sh from the .sanity* files.
This also means we can remove the .sanity* files if we do not need
them otherwise.  Fix other shell scripts to use the friendly shebang
and remove from the .sanity* files.

Rename `pth` to `path` in honor of nscott

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-12-07 07:25:47 -07:00
dependabot[bot]
d21b60f30d ci: bump actions/github-script from 6 to 7
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 14:56:36 -07:00
Wen Liang
ed93bed847 refractor: Use meaningful variable
Some variables used in the module code are not meaningful at all, which
might be hard to read and understand. Therefore, replace them with
meaningful variables.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-01 13:39:57 -07:00
Rich Megginson
11fa80a74b docs(changelog): version 1.14.1 [citest skip]
Update changelog and .README.html for version 1.14.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-11-30 08:49:58 -07:00
Wen Liang
7c4f11f1d9 tests: Fix tests_network_state_nm.yml CI failure
Since the merge of nmstate commit 'nm dns: Support appending static DNS
before dynamic DNS' (https://github.com/nmstate/nmstate/pull/2438),
nmstate treats interface with `auto-dns: true` as valid to store DNS
and tries to use NetworkManager global DNS as much as possible. However,
in NM, `dns=systemd-resolved` does not support global DNS configuration,
because systemd-resolved only supports per-interface DNS servers (via
the D-Bus API). Therefore, write and validate the DNS configuration in
/run/NetworkManager/no-stub-resolv.conf, which contains the original
DNS settings pushed to the DNS plugin.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-11-29 16:29:50 -07:00
Rich Megginson
0c590cdf5a refactor: improve support for ostree systems
The dependency on `ansible.utils.update_fact` is causing issue with
some users who now must install that collection in order to run
the role, even if they do not care about ostree.

The fix is to stop trying to set `ansible_facts.pkg_mgr`, and instead
force the use of the ostree package manager with the `package:` module
`use:` option.  The strategy is - on ostree systems, set the flag
`__$ROLENAME_is_ostree` if the system is an ostree system.  The flag
will either be undefined or `false` on non-ostree systems.
Then, change every invocation of the `package:` module like this:

```yaml
- name: Ensure required packages are present
  package:
    name: "{{ __$ROLENAME_packages }}"
    state: present
    use: "{{ (__$ROLENAME_is_ostree | d(false)) |
      ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
```

This should ensure that the `use:` parameter is not used if the system
is non-ostree.  The goal is to make the ostree support as unobtrusive
as possible for non-ostree systems.
The user can also set `__$ROLENAME_is_ostree: true` in the inventory or play
if the user knows that ostree is being used and wants to skip the check.
Or, the user is concerned about the performance hit for ostree detection
on non-ostree systems, and sets `__$ROLENAME_is_ostree: false` to skip
the check.
The flag `__$ROLENAME_is_ostree` can also be used in the role or tests to
include or exclude tasks from being run on ostree systems.

This fix also improves error reporting in the `get_ostree_data.sh` script
when included roles cannot be found.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-11-29 07:05:00 -07:00
Wen Liang
c7a31e7079 fix: Allow address 0.0.0.0/0 or ::/0 for 'from'/'to' in routing rule validation
`from 0.0.0.0/0` means from all IPv4 addresses, `from ::/0` means from
all IPv6 addresses. In NM, if `from` property is not specified in a
routing rule, NM still appends `from 0.0.0.0/0` or `from ::/0` to the
rule. NM also allows to specify `to 0.0.0.0/0` or `to ::/0` in a
routing rule, but the connection profiles will only show the `from`
setting for the rule.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-11-13 14:06:53 -07:00
Rich Megginson
815b5b0cc5 docs(changelog): version 1.14.0 [citest skip]
Update changelog and .README.html for version 1.14.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-11-09 14:26:53 -07:00
Rich Megginson
9a16583783 feat: support for ostree systems
Feature: Allow running and testing the role with ostree managed nodes.

Reason: We have users who want to use the role to manage ostree
systems.

Result: Users can use the role to manage ostree managed nodes.

NOTE: The .ostree/packages-*.txt are generated by running the
script https://github.com/linux-system-roles/auto-maintenance/blob/main/check-logs-for-packages.sh
which is used with an integration test CI run with the
https://github.com/linux-system-roles/auto-maintenance/blob/main/callback_plugins/dump_packages.py
plugin.  An example of such a CI run is
https://github.com/linux-system-roles/network/pull/647

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-30 12:02:20 -06:00
Wen Liang
712f1dfcf4 docs(changelog): Fix wrong format in version 1.13.2
The changelog update for version 1.13.2 contains wrongly formatted
content which makes the changelog file update inconsistent from
previous release.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-26 08:12:48 -06:00
Rich Megginson
b940af74a6 docs(changelog): version 1.13.3 [citest skip]
Update changelog and .README.html for version 1.13.3

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-24 07:51:38 -06:00
Rich Megginson
a9f20cb87b ci: tox-lsr version 3.1.1
This is primarily for the update to ansible-plugin-scan to
work with the upcoming ostree changes, but also includes
some minor fixes which affect ci.
3.1.0 was released but not used due to a bug fixed in 3.1.1
See full release notes for 3.1.0 and 3.1.1
https://github.com/linux-system-roles/tox-lsr/releases

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-11 08:25:08 -06:00
Rich Megginson
e82aca60d0 ci: use dump_packages.py callback to get packages used by role
This adds the dump_packages.py callback which will dump the
arguments to the `package` module (except for `state: absent`)
to the integration test run logs.  The output looks like this:
`lsrpackages: pkg-a pkg-b ...`
We will have tooling which will scrape the logs to extract the
packages used at runtime and testing for all of the supported
combinations of distribution and version.

This also ensures the weekly-ci PR git commit message conforms
to commitlint.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-05 18:01:49 -06:00
Rich Megginson
2d41de3412 docs: Ensure badges are sorted consistently
Ensure badges are sorted so that future updates are
consistent and in a stable order.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-05 17:39:51 -06:00
Rich Megginson
3ff75152c2 ci: ensure dependabot git commit message conforms to commitlint
Ensure dependabot git commit message conforms to commitlint

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-05 17:39:51 -06:00
Wen Liang
ca2180e659 test: Remove bond tests tag expfail
Since the root cause of the bond tests failure is already found and
fixed (by the commit 'fix: Add dhcp client package dependency for
initscripts provider'). Therefore, remove the bond tests tag `expfail`
and enable the bond tests in the downstream testing.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-05 15:11:02 -06:00
Wen Liang
62c78f4fe0 fix: Add dhcp client package dependency for initscripts provider
Initscripts provider requires `/sbin/dhclient` to obtain DHCP address,
which is shipped in dhcp client package. But the managed hosts may not
already install the dhcp client package, thus, add it as the dependency
package for initscripts provider.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-05 15:11:02 -06:00
Wen Liang
17922ca6f3 fix: Install yum-utils package
`yum-config-manager` is provided by the yum-utils package, thus, install
the package as the dependency before using `yum-config-manager`.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-05 15:11:02 -06:00
dependabot[bot]
1801ae7870 build(deps): bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-02 14:56:28 -06:00
Wen Liang
94254894de test(infiniband): Negate the error message in assertion
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-09-25 14:40:16 -06:00
Wen Liang
b97c9bd01e test: Use variable to hold infiniband interface name
To avoid hard coded interface name used all over the place in
`tests_infiniband.yml`, specify a variable to hold the infiniband
interface name instead.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-09-25 14:40:16 -06:00
Sergei Petrosian
7b815366a0
docs(changelog): version 1.13.2 [citest skip] (#634)
Update changelog and .README.html for version 1.13.2

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-09-08 15:15:19 +02:00
Wen Liang
2b8fbe971f docs: Update README.md
Updating README.md to reflect some recently added changes or features.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-09-06 14:48:19 -06:00
Sergei Petrosian
44e5983185
ci: Remove badges from README.md prior to converting to HTML (#633)
- Remove thematic break after badges
- Remove badges from README.md prior to converting to HTML

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-08-28 12:16:58 +02:00
Sergei Petrosian
cd7eafe009
ci: Make badges consistent, run markdownlint all .md files (#631)
- Consistently generate badges for GH workflows in README RHELPLAN-146921
- Run markdownlint on all .md files
- Add custom-woke-action if not used already
- Use woke from linux-system-roles/lsr-woke-action

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-08-24 08:19:05 +02:00
Sergei Petrosian
4dd282e0c5 ci: Add markdownlint, test_html_build, and build_docs workflows
- markdownlint runs against README.md to avoid any issues with
  converting it to HTML
- test_converting_readme converts README.md > HTML and uploads this test
  artifact to ensure that conversion works fine
- build_docs converts README.md > HTML and pushes the result to the
  docs branch to publish dosc to GitHub pages site.
- Fix markdown issues in README.md

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-08-14 08:51:31 -06:00
Rich Megginson
666f9cb333 docs(changelog): version 1.13.1 [citest skip]
Create changelog update and release for version 1.13.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-20 13:33:40 -06:00
Rich Megginson
751c3fffca fix: facts being gathered unnecessarily
Cause: The comparison of the present facts with the required facts is
being done on unsorted lists.

Consequence: The comparison may fail if the only difference is the
order.  Facts are gathered unnecessarily.

Fix: Use `difference` which works no matter what the order is.  Ensure
that the fact gathering subsets used are the absolute minimum required.

Result: The role gathers only the facts it requires, and does
not unnecessarily gather facts.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-14 15:23:56 -06:00
Rich Megginson
a83b157591 ci: ansible-test ignores file for ansible-core 2.15
Need a new ignores file for ansible-core 2.15 ansible-test

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-13 10:35:55 -06:00
Rich Megginson
e16b0e65ff ci: ansible-lint - ignore var-naming[no-role-prefix]
ansible-lint has recently added a check for this.  It flags a lot of our test
code, and some of our role code that uses nested roles.
There is no easy way to disable it for these cases only.  It would be a
tremendous amount of work to add `# noqa` comments everywhere.
The use of `.ansible-lint-ignore` would be a maintenance burden (cannot use
tests/tests_*.yml or other similar wildcard to match all test files), would
still issue a lot of warning messages, and would not solve all of the problems.
The only way for now is to skip this rule.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-13 09:36:55 -06:00