feat(openshift): add restart for openscanhub + reusable role #3429

Merged
kevin merged 3 commits from smoliicek/ansible:add-restart-osh into main 2026-06-23 19:30:23 +00:00
Member

this commit adds a reusable role for restarting / rebuilding ocp stuff.
currently added this to playbooks/openshift-apps/openscanhub.yml, since it was referenced in infra/tickets#11884

not sure if i should add it to the other playbooks too, or no

Assisted-by: gpt-5.5 in Codex
Signed-off-by: Vít Smolík me@smoliicek.cz

this commit adds a reusable role for restarting / rebuilding ocp stuff. currently added this to playbooks/openshift-apps/openscanhub.yml, since it was referenced in https://forge.fedoraproject.org/infra/tickets/issues/11884 not sure if i should add it to the other playbooks too, or no Assisted-by: gpt-5.5 in Codex Signed-off-by: Vít Smolík <me@smoliicek.cz>
feat(openshift): add restart for openscanhub + reusable role
Some checks failed
AI Code Review / ai-review (pull_request_target) Successful in 13s
Linter / yamllint (pull_request) Successful in 46s
Linter / ansible-lint (pull_request) Failing after 2m10s
be038d745f
Assisted-by: gpt-5.5 in Codex
Signed-off-by: Vít Smolík <me@smoliicek.cz>

AI Code Review

Detailed Code Review

The changes introduce a generic OpenShift app-actions role meant to handle builds and rollouts (restarts) conditionally based on provided tags. The role uses never tags coupled with explicit build/rebuild or restart/rollout tags to only execute these actions when intentionally requested. The implementation correctly loops over defined resources and validates that app_actions_app is set before doing so. Integrating it into openscanhub.yml solves the immediate infrastructure need to cleanly restart its deployments. The code follows standard Ansible practices for include_role loops.

📂 File Reviews

📄 `roles/openshift/app-actions/tasks/main.yml` - Main tasks file for the app-actions role handling conditional builds and rollouts.
  • Minor [Suggestion]: It is good practice to provide customized failure messages for ansible.builtin.assert to make debugging easier if the role is invoked incorrectly.
    • Suggestion: Add fail_msg to the assert tasks.
  - name: Validate app_actions_app for builds
    ansible.builtin.assert:
      that:
      - app_actions_app is defined
      - app_actions_app | length > 0
      fail_msg: "app_actions_app must be defined and not empty"
      quiet: true

Summary

  • Overall Assessment: No critical issues identified. The role appears to correctly implement the desired tag-driven deployment and build actions.
  • Minor Suggestions:
    • Add explicit fail_msg to assert statements for better operator experience when debugging missing variables.
    • Consider eventually applying this role to other apps if they have the same requirement to trigger manual restarts via tag.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### Detailed Code Review The changes introduce a generic OpenShift app-actions role meant to handle builds and rollouts (restarts) conditionally based on provided tags. The role uses `never` tags coupled with explicit `build`/`rebuild` or `restart`/`rollout` tags to only execute these actions when intentionally requested. The implementation correctly loops over defined resources and validates that `app_actions_app` is set before doing so. Integrating it into `openscanhub.yml` solves the immediate infrastructure need to cleanly restart its deployments. The code follows standard Ansible practices for include_role loops. #### 📂 File Reviews <details> <summary><strong>📄 `roles/openshift/app-actions/tasks/main.yml`</strong> - Main tasks file for the app-actions role handling conditional builds and rollouts.</summary> - **Minor** [Suggestion]: It is good practice to provide customized failure messages for `ansible.builtin.assert` to make debugging easier if the role is invoked incorrectly. - *Suggestion:* Add `fail_msg` to the assert tasks. ```` - name: Validate app_actions_app for builds ansible.builtin.assert: that: - app_actions_app is defined - app_actions_app | length > 0 fail_msg: "app_actions_app must be defined and not empty" quiet: true ```` </details> ### ✅ Summary - **Overall Assessment:** No critical issues identified. The role appears to correctly implement the desired tag-driven deployment and build actions. - **Minor Suggestions:** - Add explicit `fail_msg` to assert statements for better operator experience when debugging missing variables. - Consider eventually applying this role to other apps if they have the same requirement to trigger manual restarts via tag. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
fix lint errors
Some checks failed
Linter / yamllint (pull_request) Successful in 28s
Linter / ansible-lint (pull_request) Failing after 1m26s
51a7c692e9
Signed-off-by: Vít Smolík <me@smoliicek.cz>
add fail_msg to assert in roles/openshift/app-actions
Some checks failed
Linter / yamllint (pull_request) Successful in 28s
Linter / ansible-lint (pull_request) Failing after 1m13s
8ce1258603
Signed-off-by: Vít Smolík <me@smoliicek.cz>
Owner

So, this looks fine to me. Lets merge it.

As to other apps, yes, we could convert them all... either as we do other things, or all at once. If you want to do a pr to move the rest that would be fine with me. ;)

So, this looks fine to me. Lets merge it. As to other apps, yes, we could convert them all... either as we do other things, or all at once. If you want to do a pr to move the rest that would be fine with me. ;)
kevin merged commit 6273dafdf2 into main 2026-06-23 19:30:23 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/ansible!3429
No description provided.