feat: support this role in container builds
Feature: Support running the timesync role during container builds.
Reason: This is particularly useful for building bootc derivative OSes.
Result: These flags enable running the bootc container scenarios in CI, which ensures that the role works in buildah build environment. This allows us to officially support this role for image mode builds.
Signed-off-by: Rich Megginson [email protected]
Summary by Sourcery
Enable offline NetworkManager support to allow the role to run in container build environments, refactor the command API and provider switching logic, and overhaul the test suite with a reusable harness and helper tasks to streamline CI testing
New Features:
- Introduce an offline NetworkManager provider (
nm_offline) for container build environments - Enable support for running the role under Buildah/container scenarios by switching to offline mode when the system is not booted
Enhancements:
- Add a
check_rcflag torun_commandand rename theifcfg_headerproperty tomanaged_file_header - Automatically detect booted systems (
__network_is_booted) and switch tonm_offlinewhen necessary
CI:
- Remove branch filters from the QEMU KVM integration tests workflow
Tests:
- Refactor test playbooks to use a unified
run_test.ymlharness with modular setup, assert, and cleanup tasks - Add new test helper tasks (
assert_connection_settings.yml,assert_command_output.yml,assert_nm_connection_status.yml, and handlers) - Update tests to conditionally skip or adjust behavior in
buildahenvironments and increase the default test timeout
Reviewer's Guide
Enables offline operation of the network role in buildah environments by introducing an nm_offline provider and boot detection, refactors library methods for command execution and file header handling, updates defaults and main tasks for offline support, and restructures the integration tests and CI workflow with a unified run_test harness to handle build and boot scenarios.
Class diagram for new and updated command provider classes
classDiagram
class Cmd {
+managed_file_header
+run_command(argv, encoding=None, check_rc=False)
+log(...)
}
class Cmd_nm {
+managed_file_header
+run_command(argv, encoding=None, check_rc=False)
}
class Cmd_nm_offline {
+profile_path(name)
+run_prepare()
+connection_create(connections, idx)
+run_action_present(idx)
+run_action_absent(idx)
+run_action_up(idx)
+run_action_down(idx)
}
class Cmd_initscripts {
+managed_file_header
+run_command(argv, encoding=None, check_rc=False)
}
Cmd <|-- Cmd_nm
Cmd <|-- Cmd_nm_offline
Cmd <|-- Cmd_initscripts
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Refactor command execution API and header property |
|
library/network_connections.py |
| Introduce offline NM backend for container builds |
|
library/network_connections.py |
| Automatic switch to nm_offline when system not booted |
|
tasks/set_facts.ymltasks/main.yml |
| Adjust service tasks and defaults for nm_offline support |
|
tasks/main.ymldefaults/main.yml |
| Refactor integration tests with unified run_test harness |
|
tests/playbooks/*.ymltests/tasks/run_test.ymltests/tasks/handle_*.yml |
| Add test helper task modules for assertions |
|
tests/tasks/assert_connection_settings.ymltests/tasks/assert_command_output.ymltests/tasks/assert_nm_connection_status.ymltests/collection-requirements.yml |
| Update CI workflow for bootc integration |
|
.github/workflows/qemu-kvm-integration-tests.yml |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Codecov Report
:x: Patch coverage is 5.13699% with 277 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 39.90%. Comparing base (1b57520) to head (e8a3ff4).
:warning: Report is 57 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| library/network_connections.py | 5.13% | 277 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #814 +/- ##
==========================================
- Coverage 43.11% 39.90% -3.22%
==========================================
Files 12 12
Lines 3124 3408 +284
==========================================
+ Hits 1347 1360 +13
- Misses 1777 2048 +271
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
[citest]
[citest]
[citest]
[citest]
[citest]
Thank you for your contribution! There was no activity in this pull request recently. To avoid pull requests to pile up, an automated process marked this pull request as stale. It will close this pull request if no further activity occurs. The current policy is available at: https://github.com//linux-system-roles/network/blob/main/.github/stale.yml