Skip to content

Commit b9417dd

Browse files
Chandan Kumarbshewale
authored andcommitted
Add missing conditional for Update the go.mod file for no pr case
Without this conditional, the meta content provider is failing with following error: ``` msg: | 2025-06-27 06:20:22.612671 | controller | The task includes an option with an undefined variable. The error was: 'operator_api_path' is undefined. 'operator_api_path' is undefined 2025-06-27 06:20:22.612685 | controller | 2025-06-27 06:20:22.612699 | controller | The error appears to be in '/home/zuul-worker/src/github.com/openstack-k8s-operators/ci-framework/roles/operator_build/tasks/build.yml': line 70, column 3, but may 2025-06-27 06:20:22.612713 | controller | be elsewhere in the file depending on the exact syntax problem. 2025-06-27 06:20:22.612740 | controller | 2025-06-27 06:20:22.612753 | controller | The offending line appears to be: 2025-06-27 06:20:22.612766 | controller | 2025-06-27 06:20:22.612779 | controller | 2025-06-27 06:20:22.612792 | controller | - name: "{{ operator.name }} - Update the go.mod file using latest commit if no PR is provided" # noqa: name[template] 2025-06-27 06:20:22.612805 | controller | ^ here 2025-06-27 06:20:22.612818 | controller | We could be wrong, but this one looks like it might be an issue with 2025-06-27 06:20:22.612830 | controller | missing quotes. Always quote template expression brackets when they 2025-06-27 06:20:22.612843 | controller | start a value. For instance: 2025-06-27 06:20:22.612856 | controller | ``` By adding the conditional fixes the issue. Note: it also fixes the same conditional for other tasks. Signed-off-by: Chandan Kumar <Chandan Kumar (raukadah)>
1 parent 7fb4b62 commit b9417dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

roles/operator_build/tasks/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
operator_base_module: "{{ go_mod_out['content'] | b64decode | regex_search(cifmw_operator_build_org + '/' + operator.name + '/(\\w*)\\s', '\\1') }}"
3030

3131
- name: Get the base module name not empty operator_base_module
32-
when: operator_base_module is not none
32+
when: operator_base_module
3333
ansible.builtin.set_fact:
3434
operator_base_module_name: "{{ operator_base_module | first }}"
3535

3636
- name: "{{ operator.name }} - Set default api path" # noqa: name[template]
37-
when: operator_base_module is not none
37+
when: operator_base_module
3838
ansible.builtin.set_fact:
3939
operator_api_path: "github.com/{{ cifmw_operator_build_org }}/{{ operator.name }}/{{ operator_base_module_name }}"
4040

@@ -55,7 +55,7 @@
5555
- operator.name != cifmw_operator_build_meta_name
5656
- operator.pr_owner is defined
5757
- operator.pr_sha is defined
58-
- operator_base_module is not none
58+
- operator_base_module
5959

6060
- name: "{{ operator.name }} - Get latest commit when no PR is provided" # noqa: name[template] command-instead-of-module
6161
ansible.builtin.command:
@@ -83,6 +83,7 @@
8383
- cifmw_operator_build_meta_build
8484
- operator.name != cifmw_operator_build_meta_name
8585
- operator.pr_owner is not defined
86+
- operator_base_module
8687

8788
- name: Get container image
8889
block:

0 commit comments

Comments
 (0)