Skip to content

Commit 460924b

Browse files
committed
[set_openstack_containers] Add fallback task for operators not having generic k8s labels
Some of the operators with older build did not have the generic app.kubernetes.io/name label, thus they need to be identified using openstack.org/operator-name label. Signed-off-by: Amartya Sinha <amsinha@redhat.com>
1 parent b954eac commit 460924b

File tree

1 file changed

+18
-7
lines changed
  • roles/set_openstack_containers/tasks

1 file changed

+18
-7
lines changed

roles/set_openstack_containers/tasks/main.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@
5252
cacheable: true
5353

5454
- name: Get meta operator environment variable
55-
environment:
56-
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
57-
PATH: "{{ cifmw_path }}"
58-
cifmw.general.ci_script:
59-
output_dir: "{{ cifmw_set_openstack_containers_basedir }}/artifacts"
60-
script: "oc set env $(oc get pods -n {{ operator_namespace }} -o name -l app.kubernetes.io/name={{ operator_name }}-operator) -n {{ operator_namespace }} --list"
61-
register: containers_env_list
55+
block:
56+
- name: Get meta operator environment variable with generic k8s labels
57+
environment:
58+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
59+
PATH: "{{ cifmw_path }}"
60+
cifmw.general.ci_script:
61+
output_dir: "{{ cifmw_set_openstack_containers_basedir }}/artifacts"
62+
script: "oc set env $(oc get pods -n {{ operator_namespace }} -o name -l app.kubernetes.io/name={{ operator_name }}-operator) -n {{ operator_namespace }} --list"
63+
register: containers_env_list
64+
rescue:
65+
- name: Get meta operator environment variable (for operators not having generic k8s labels)
66+
environment:
67+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
68+
PATH: "{{ cifmw_path }}"
69+
cifmw.general.ci_script:
70+
output_dir: "{{ cifmw_set_openstack_containers_basedir }}/artifacts"
71+
script: "oc set env $(oc get pods -n {{ operator_namespace }} -o name -l openstack.org/operator-name={{ operator_name }}) -n {{ operator_namespace }} --list"
72+
register: containers_env_list
6273

6374
- name: Generate update_env_vars.sh script
6475
ansible.builtin.template:

0 commit comments

Comments
 (0)