Skip to content

Commit ec1763b

Browse files
committed
[ci_nmstate] Check if kubeconfig file exists
The ci_nmstate role was failing during adoption deploy-infra jobs when cifmw_openshift_kubeconfig was defined but the file didn't exist yet. Root cause: ci-framework-jobs' adoption-uni-job-base uses variable_files_dirs to scan all YAML files in the scenario directory, including 05-tests.yaml which sets cifmw_openshift_kubeconfig. This has been the case since adoption jobs were introduced in October 2024. However, during the deploy-infra phase (before deploy-ocp), the OCP cluster and kubeconfig file don't exist yet. The issue was likely exposed by PR openstack-k8s-operators#3471 which changed how ansible_user_dir is evaluated, affecting how/when the kubeconfig path gets resolved. Fix: Add "cifmw_openshift_kubeconfig is exists" check to tasks that use the kubeconfig. The existing code already handles the skipped task gracefully via default([]) safeguards, treating all hosts as "unmanaged" when no k8s cluster is available (which is correct for infra creation). Fixes: OSPCIX-1122 Related: openstack-k8s-operators#3471 Assisted-By: Claude Code/claude-4.5-sonnet Signed-off-by: Harald Jensås <[email protected]>
1 parent 5a539ea commit ec1763b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

roles/ci_nmstate/tasks/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
label: "{{ item }}"
5555

5656
- name: Get k8s nodes
57-
when: cifmw_openshift_kubeconfig is defined
57+
when:
58+
- cifmw_openshift_kubeconfig is defined
59+
- cifmw_openshift_kubeconfig is exists
5860
kubernetes.core.k8s_info:
5961
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
6062
api_key: "{{ cifmw_openshift_token | default(omit)}}"
@@ -93,6 +95,7 @@
9395
- name: Provision k8s workers with nmstate
9496
when:
9597
- cifmw_openshift_kubeconfig is defined
98+
- cifmw_openshift_kubeconfig is exists
9699
- >-
97100
_cifmw_ci_nmstate_configs | dict2items |
98101
selectattr('key', 'in', _cifmw_ci_nmstate_k8s_hosts) |

0 commit comments

Comments
 (0)