Skip to content

Commit 074d610

Browse files
committed
Update build to copy deps into the container for building
1 parent 369cf1a commit 074d610

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

roles/operator_build/tasks/build.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,29 @@
3838
ansible.builtin.set_fact:
3939
operator_api_path: "github.com/{{ cifmw_operator_build_org }}/{{ operator.name }}/{{ operator_base_module_name }}"
4040

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.shell: |
46+
git clone {{ operator.src }} deps/{{ operator_base_module_name }}
47+
args:
48+
chdir: "{{ cifmw_operator_build_meta_src }}"
49+
when:
50+
- operator.name != cifmw_operator_build_meta_name
51+
4152
# This is telling the openstack operator to look for dependency on a particular branch on github.
4253
# 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_base_module_name }}
4357
- name: "{{ operator.name }} - Update the go.mod file in meta operator for provided PR_SHA" # noqa: name[template]
4458
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_base_module_name }}
4660
go mod tidy
4761
if [ -d ./apis ]; then
4862
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_base_module_name }}
5064
go mod tidy
5165
popd
5266
fi
@@ -78,11 +92,11 @@
7892

7993
- name: "{{ operator.name }} - Update the go.mod file using latest commit if no PR is provided" # noqa: name[template]
8094
ansible.builtin.shell: |
81-
go mod edit -replace {{ operator_api_path }}={{ operator.src }}/{{ operator_base_module_name }}
95+
go mod edit -replace {{ operator_api_path }}=./deps/{{ operator_base_module_name }}
8296
go mod tidy
8397
if [ -d ./apis ]; then
8498
pushd ./apis/
85-
go mod edit -replace {{ operator_api_path }}={{ operator.src }}/{{ operator_base_module_name }}
99+
go mod edit -replace {{ operator_api_path }}=./deps/{{ operator_base_module_name }}
86100
go mod tidy
87101
popd
88102
fi

0 commit comments

Comments
 (0)