-
Notifications
You must be signed in to change notification settings - Fork 18
feat: Support this role in container builds #188
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
Conversation
Remove the spurious backtick.
Feature: Support running the cockpit role during container builds. Reason: This is particularly useful for building bootc derivative OSes. Result: The role now works during container builds. The bootc container scenarios run in CI, which ensures that the role works in buildah build environment. This allows us to officially support this role for image mode builds. Do *not* enable the role for system containers (the `container`) flag. That currently fails due to SELinux not working properly there, and needs to be looked at separately if desired. Detect if the system is booted (with systemd), and skip all runtime operations and checks if not. Also use `firewall-offline-cmd` which works also in non-booted environments -- we are only/primarily interested in the persistent firewall config anyway. Do full bootc end-to-end validation in tests_tangd_custom_port, which is one of the most complex ones (combining nbde_server, firewall, and selinux roles). Run the first scenario with custom port for that. See https://issues.redhat.com/browse/RHEL-78157
Reviewer's GuideEnable the nbde_server role to run during container-image builds by detecting systemd boot state to skip runtime tasks on non-booted hosts, switching to offline firewall commands, integrating Bootc end-to-end validation via buildah, and updating documentation and metadata for container build support. Sequence diagram for nbde_server role execution in container build environmentsequenceDiagram
participant User
participant Ansible
participant nbde_server_role
participant SystemdChecker
participant FirewallManager
User->>Ansible: Run playbook in container build
Ansible->>nbde_server_role: Execute role tasks
nbde_server_role->>SystemdChecker: Check if system is booted
SystemdChecker-->>nbde_server_role: Return boot state (not booted)
nbde_server_role->>FirewallManager: Use firewall-offline-cmd
nbde_server_role-->>Ansible: Skip runtime/service tasks
Ansible-->>User: Build completes with persistent config
Class diagram for nbde_server role boot state detection and service managementclassDiagram
class nbde_server {
+bool __nbde_server_is_ostree
+bool __nbde_server_is_booted
+void set_vars()
+void main_tang()
}
class SystemdChecker {
+command: systemctl is-system-running
+bool check_systemd_installed()
+bool is_system_booted()
}
class FirewallManager {
+void use_firewall_offline_cmd()
}
nbde_server --|> SystemdChecker : uses
nbde_server --|> FirewallManager : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @martinpitt - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[citest] |
|
Gateway timeouts, similar to my sudo PR. Retrying. |
|
[citest] |
|
As green as expected now. I had a quick look at the Ansible 2.19 failures, but many of them are in selinux. I think Rich is just doing a release. |
I don't see any selinux issues. The new version has been published to galaxy and should be used now. I see issues related to the use of |
Which are not related to this PR |
|
With these changes, the tests all pass on 2.19: and |
- Avoid `ansible_managed` variable, it's an internal constant. - Eliminate jinja templates in conditions.
|
@richm thanks! I pushed an extra commit with these changes with your name (credit where credit is due..). If this still fails, feel free to push to my fork (you should be able to). |
|
[citest] |
Feature: Support running the cockpit role during container builds.
Reason: This is particularly useful for building bootc derivative OSes.
Result: The role now works during container builds. The bootc container scenarios run in CI, which ensures that the role works in buildah build environment. This allows us to officially support this role for image mode builds.
Do not enable the role for system containers (the
container) flag. That currently fails due to SELinux not working properly there, and needs to be looked at separately if desired.Detect if the system is booted (with systemd), and skip all runtime operations and checks if not. Also use
firewall-offline-cmdwhich works also in non-booted environments -- we are only/primarily interested in the persistent firewall config anyway.Do full bootc end-to-end validation in tests_tangd_custom_port, which is one of the most complex ones (combining nbde_server, firewall, and selinux roles). Run the first scenario with custom port for that.
See https://issues.redhat.com/browse/RHEL-78157
Note that the QEMU Fedora 42 test will fail, as the role hasn't been adjusted to Ansible 2.19 yet (see #187). The bootc Fedora 42 test will pass, as it still uses Ansible 2.17 (we should probably update it to 2.19 as well, but that will happen separately).
Summary by Sourcery
Enable official support for container-based builds by detecting non-booted environments, skipping runtime operations, and updating tests and documentation to validate role behavior in Buildah scenarios
New Features:
Enhancements:
Documentation:
Tests:
Chores: