Skip to content

Commit eb297b0

Browse files
holserdanpawlik
authored andcommitted
[kustomize_deploy] Improve code clarity
- Rename _cifmw_kustomize_deploy_olm_osp_operator_sub to _cifmw_kustomize_deploy_olm_osp_operator_subscription for better readability and consistency. - Add dedicated cifmw_kustomize_deploy_retries_subscription parameter (default: 90) to allow independent configuration of Subscription vs InstallPlan retry timeouts. - Fix task name from 'Wait for InstallPlan to be created' to 'Wait for Subscription to be created' to correctly reflect what the task is actually waiting for. - Update role README.md to document the new retries_subscription parameter in the Timeouts section. This change improves maintainability by using more descriptive variable names and properly separating concerns between Subscription and InstallPlan wait operations. Resolves: https://issues.redhat.com/browse/OSPCIX-1100 Assisted-By: Claude Code/claude-sonnet-4.5 Signed-off-by: Sergii Golovatiuk <sgolovat@redhat.com> Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
1 parent 815fcbf commit eb297b0

File tree

6 files changed

+31
-16
lines changed

6 files changed

+31
-16
lines changed

.github/workflows/verify-pr-prefix.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jobs:
2020
with:
2121
fetch-depth: 0
2222

23+
- name: Dump commit message to file
24+
run: |
25+
git fetch origin ${{ github.event.pull_request.head.sha }}
26+
git log -1 --pretty=format:"%B" ${{ github.event.pull_request.head.sha }} | head -n1 > commit-message-file
27+
2328
- name: Run commit message check
2429
id: prefixcheck
2530
run: |
26-
./scripts/check-role-prefix.sh
31+
./scripts/check-role-prefix.sh commit-message-file

roles/kustomize_deploy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ with a message.
101101
Some tasks uses timeouts when applying or waiting for resources. Those timeouts can be controlled by:
102102

103103
* `cifmw_kustomize_deploy_delay`: (Int) Ansible `delay` passed to tasks that waits for a resource to reach a target state (default `10`)
104+
* `cifmw_kustomize_deploy_retries_subscription`: (Int) Ansible `retries` passed to tasks that wait for the Subscription (default `90`)
104105
* `cifmw_kustomize_deploy_retries_install_plan`: (Int) Ansible `retries` passed to tasks that wait for the InstallPlan (default `60`)
105106

106107
### Task tagging

roles/kustomize_deploy/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ cifmw_kustomize_deploy_dp_dest_file: >-
222222
# timeouts and retry configuration
223223

224224
cifmw_kustomize_deploy_delay: 10
225+
cifmw_kustomize_deploy_retries_subscription: 90
225226
cifmw_kustomize_deploy_retries_install_plan: 60
226227

227228
# Default retry settings for k8s_info operations to handle transient auth failures

roles/kustomize_deploy/tasks/install_operators.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@
9191
src: "{{ cifmw_kustomize_deploy_olm_dest_file }}"
9292
register: _cifmw_kustomize_deploy_olm_apply_out
9393

94-
- name: Wait for the openstack operators InstallPlan to be created
94+
- name: Wait for the openstack operators Subscription to be created
9595
vars:
96-
_cifmw_kustomize_deploy_olm_osp_operator_sub: >-
96+
_cifmw_kustomize_deploy_olm_osp_operator_subscription: >-
9797
{{
9898
(
9999
_cifmw_kustomize_deploy_olm_apply_out.result.results |
@@ -108,18 +108,18 @@
108108
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
109109
api_key: "{{ cifmw_openshift_token | default(omit) }}"
110110
context: "{{ cifmw_openshift_context | default(omit) }}"
111-
api_version: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.apiVersion }}"
111+
api_version: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.apiVersion }}"
112112
kind: Subscription
113-
namespace: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.metadata.namespace }}"
114-
name: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.metadata.name }}"
115-
register: _cifmw_kustomize_deploy_olm_osp_operator_sub_out
116-
retries: "{{ cifmw_kustomize_deploy_retries_install_plan }}"
113+
namespace: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.metadata.namespace }}"
114+
name: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.metadata.name }}"
115+
register: _cifmw_kustomize_deploy_olm_osp_operator_subscription_out
116+
retries: "{{ cifmw_kustomize_deploy_retries_subscription }}"
117117
delay: "{{ cifmw_kustomize_deploy_delay }}"
118118
until:
119-
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.failed is false
120-
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources is defined
121-
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | length == 1
122-
- (_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first)['status']['installPlanRef'] is defined
119+
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.failed is false
120+
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources is defined
121+
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | length == 1
122+
- (_cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | first)['status']['installPlanRef'] is defined
123123

124124
- name: Install plan
125125
ansible.builtin.include_tasks: install_plan.yml
@@ -131,7 +131,7 @@
131131
vars:
132132
_install_plan: >-
133133
{{
134-
(_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first).status.installPlanRef
134+
(_cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | first).status.installPlanRef
135135
}}
136136
kubernetes.core.k8s_info:
137137
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"

scripts/check-role-prefix.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
#!/bin/bash
22

33
# Get the latest commit message file
4-
TMP_MSG_FILE=$(mktemp)
5-
git log -1 --pretty=format:"%s%n%n%b" >"$TMP_MSG_FILE"
4+
TMP_MSG_FILE="$1"
5+
6+
echo "Checking file $TMP_MSG_FILE"
7+
cat $TMP_MSG_FILE
8+
9+
if [ -z "$TMP_MSG_FILE" ]; then
10+
echo "now here"
11+
TMP_MSG_FILE=$(mktemp)
12+
git log -1 --pretty=format:"%B" | head -n1
13+
fi
614

715
echo "Checking latest commit message:"
816
cat "$TMP_MSG_FILE"

scripts/git-check-commit-body-length.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ FAIL_LENGTH=0
2020
FAIL_SIGNED_OFF_BY=0
2121

2222
BODY=$(tail -n +3 "$MSG_FILE" | sed '/^\s*#/d' | sed '/^\s*$/d')
23-
BODY_LEN=$(echo -n "$BODY" | wc -m)
23+
BODY_LEN=$(echo -n "$BODY" | sed '/Signed-off-by:/d' | wc -m)
2424

2525
if [ "$BODY_LEN" -lt "$MIN_BODY_LEN" ]; then
2626
echo -e "\n\n**WARNING: Commit message body is too short (has $BODY_LEN chars, minimum $MIN_BODY_LEN required).**\n" >&2

0 commit comments

Comments
 (0)