-
Notifications
You must be signed in to change notification settings - Fork 45
feat: support this role in container builds #303
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
Reviewer's GuideThis PR introduces a __timesync_is_booted flag to detect systemd runtime availability in container build environments and conditionally alters service discovery, state management, handler execution, and testing flow to support running the timesync role under buildah scenarios, alongside adding a metadata tag for container builds. Sequence diagram for conditional service management based on booted statesequenceDiagram
participant Ansible
participant System
participant Service
Ansible->>System: Run "systemctl is-system-running"
System-->>Ansible: Return status (e.g., 'offline', 'running')
Ansible->>Ansible: Set __timesync_is_booted flag
alt __timesync_is_booted is true
Ansible->>Service: Manage service state (start/stop/enable/disable)
else __timesync_is_booted is false
Ansible->>System: List unit files via "systemctl list-unit-files"
System-->>Ansible: Return service list
Ansible->>Ansible: Set timesync_services fact
Ansible->>Service: Only enable/disable, omit state changes
end
Class diagram for timesync role variables and service managementclassDiagram
class TimesyncRole {
+__timesync_is_booted: bool
+timesync_services: list
+Service Management (conditional on __timesync_is_booted)
}
class Service {
+name: string
+state: string ("started", "stopped", or omitted)
+enabled: bool
}
TimesyncRole "1" -- "*" Service : manages
TimesyncRole : determines __timesync_is_booted
TimesyncRole : sets timesync_services
Service : state set only if __timesync_is_booted
Service : enabled always set
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 there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `handlers/main.yml:6` </location>
<code_context>
service:
name: chronyd
state: restarted
+ when: __timesync_is_booted | d(false)
- name: Restart ntpd
</code_context>
<issue_to_address>
Handler will be skipped if __timesync_is_booted is not set.
Confirm that skipping the handler when __timesync_is_booted is undefined is intentional, as this may affect environments where the variable is missing.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| service: | ||
| name: chronyd | ||
| state: restarted | ||
| when: __timesync_is_booted | d(false) |
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.
question: Handler will be skipped if __timesync_is_booted is not set.
Confirm that skipping the handler when __timesync_is_booted is undefined is intentional, as this may affect environments where the variable is missing.
|
[citest] |
|
[citest] |
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 <rmeggins@redhat.com>
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 rmeggins@redhat.com
Summary by Sourcery
Enable the timesync Ansible role to operate correctly in container build environments by detecting whether the system is booted and adjusting service discovery, start/stop operations, and CI tests accordingly.
New Features:
Enhancements:
Tests: