|
38 | 38 | ansible.builtin.set_fact: |
39 | 39 | operator_api_path: "github.com/{{ cifmw_operator_build_org }}/{{ operator.name }}/{{ operator_base_module_name }}" |
40 | 40 |
|
| 41 | + |
| 42 | + # Copy the dep into openstack-operator/deps |
| 43 | + # This copies the prepared zuul repo into the meta operator dir, which gets copied into the build container |
| 44 | +- name: "{{ operator.name }} - Copy dependancy source into meta operator" |
| 45 | + ansible.builtin.command: | |
| 46 | + git clone {{ operator.src }} deps/{{ operator.name }} |
| 47 | + args: |
| 48 | + chdir: "{{ cifmw_operator_build_meta_src }}" |
| 49 | + when: |
| 50 | + - operator.name != cifmw_operator_build_meta_name |
| 51 | + |
41 | 52 | # This is telling the openstack operator to look for dependency on a particular branch on github. |
42 | 53 | # This should be the zuul src path. |
| 54 | + # If we switch to using local sources, they need to be copied into the container for the build. |
| 55 | + # This can be done by copying the modified operator code into the openstack-operator dir |
| 56 | + # The replacement here will then point to ./deps/{{ operator.name }} |
43 | 57 | - name: "{{ operator.name }} - Update the go.mod file in meta operator for provided PR_SHA" # noqa: name[template] |
44 | 58 | ansible.builtin.shell: | |
45 | | - go mod edit -replace {{ operator_api_path }}={{ operator.src }}/{{ operator_base_module_name }} |
| 59 | + go mod edit -replace {{ operator_api_path }}=./deps/{{ operator.name }}/{{ operator_base_module_name }} |
46 | 60 | go mod tidy |
47 | 61 | if [ -d ./apis ]; then |
48 | 62 | pushd ./apis/ |
49 | | - go mod edit -replace {{ operator_api_path }}={{ operator.src }}/{{ operator_base_module_name }} |
| 63 | + go mod edit -replace {{ operator_api_path }}=./deps/{{ operator.name }}/operator_base_module_name |
50 | 64 | go mod tidy |
51 | 65 | popd |
52 | 66 | fi |
|
68 | 82 | # The PR sha does not need to be pulled from the zuul.projects, since this __should__ match HEAD |
69 | 83 | - name: "{{ operator.name }} - Set pr_sha to be used as image tag" # noqa: name[template] |
70 | 84 | ansible.builtin.set_fact: |
71 | | - #pr_sha: "{{ operator.pr_sha | default(git_head_out.stdout | trim) }}" |
| 85 | + # pr_sha: "{{ operator.pr_sha | default(git_head_out.stdout | trim) }}" |
72 | 86 | pr_sha: "{{ git_head_out.stdout | trim }}" |
73 | 87 |
|
74 | 88 | - name: Skip if operator.pr_sha matches HEAD |
75 | 89 | when: pr_sha != operator.pr_sha | default('') |
76 | 90 | ansible.builtin.debug: |
77 | 91 | msg: "Something" |
78 | 92 |
|
| 93 | +- name: Show the {{ item.name }} - {{ item.value }} |
| 94 | + ansible.builtin.debug: |
| 95 | + var: item |
| 96 | + with_items: |
| 97 | + - {name: operator_api_path, value: "{{ operator_api_path | default('') }}" } |
| 98 | + - {name: operator_base_module_name, value: "{{ operator_base_module_name | default('') }}" } |
| 99 | + - {name: operator.name, value: "{{ operator.name | default('')}}" } |
| 100 | + |
79 | 101 | - name: "{{ operator.name }} - Update the go.mod file using latest commit if no PR is provided" # noqa: name[template] |
80 | 102 | ansible.builtin.shell: | |
81 | | - go mod edit -replace {{ operator_api_path }}={{ operator.src }}/{{ operator_base_module_name }} |
| 103 | + go mod edit -replace {{ operator_api_path }}=./deps/{{ operator.name }}/{{ operator_base_module_name }} |
82 | 104 | go mod tidy |
83 | 105 | if [ -d ./apis ]; then |
84 | 106 | pushd ./apis/ |
85 | | - go mod edit -replace {{ operator_api_path }}={{ operator.src }}/{{ operator_base_module_name }} |
| 107 | + go mod edit -replace {{ operator_api_path }}=./deps/{{ operator.name }}/{{ operator_base_module_name }} |
86 | 108 | go mod tidy |
87 | 109 | popd |
88 | 110 | fi |
|
0 commit comments