From 1080e480c7eda33b07fb1b7739dc35f01bdf332b Mon Sep 17 00:00:00 2001 From: "Chandan Kumar (raukadah)" Date: Tue, 25 Feb 2025 19:11:56 +0530 Subject: [PATCH] Use zuul clonned repos for upstream in build_openstack_packages role In build_openstack_packages role for building rpms from gerrit and github, we are clonning the repo and checking out specific change. With these tasks, we are not able to build dlrn rpms if we have multiple prs/crs from same project. But we want to build rpms from all changes. In order to fix, Zuul knows how to checkout proper repos with changes under test and from Depends-on. DLRN always looks for clonned repos in DLRN data directory. In order to use zuul clonned sources with DLRN, We are creating symlink to dlrn data project directory and let's dlrn do the job. Signed-off-by: Chandan Kumar (raukadah) --- .../tasks/parse_and_build_pkgs.yml | 1 + .../tasks/run_dlrn.yml | 26 +++++-------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/roles/build_openstack_packages/tasks/parse_and_build_pkgs.yml b/roles/build_openstack_packages/tasks/parse_and_build_pkgs.yml index 92352610b7..34380f1cde 100644 --- a/roles/build_openstack_packages/tasks/parse_and_build_pkgs.yml +++ b/roles/build_openstack_packages/tasks/parse_and_build_pkgs.yml @@ -19,6 +19,7 @@ 'project': item.project.name, 'branch': item.branch, 'change': item.change, + 'src_dir': item.project.src_dir, 'refspec': '/'.join(['refs', 'changes', item.change[-2:], item.change, diff --git a/roles/build_openstack_packages/tasks/run_dlrn.yml b/roles/build_openstack_packages/tasks/run_dlrn.yml index 3ef88d9feb..31da6ed4a9 100644 --- a/roles/build_openstack_packages/tasks/run_dlrn.yml +++ b/roles/build_openstack_packages/tasks/run_dlrn.yml @@ -114,29 +114,15 @@ dest: '{{ cifmw_bop_build_repo_dir }}/DLRN/data/{{ project_name_mapped.stdout }}' version: '{{ _change.branch }}' - - name: "Clone {{ project_name_mapped.stdout }} from Github" # noqa: name[template] + - name: "Symlink {{ project_name_mapped.stdout }} from Zuul clonned repos" # noqa: name[template] when: - cifmw_bop_openstack_project_path | length == 0 - not repo_status.stat.exists - - "'host' in _change" - - "'github.com' in _change.host" - ansible.builtin.git: - repo: '{{ _change.host }}/{{ _change.project }}' - dest: '{{ cifmw_bop_build_repo_dir }}/DLRN/data/{{ project_name_mapped.stdout }}' - refspec: "+refs/pull/*:refs/remotes/origin/pr/*" - version: 'origin/pr/{{ _change.change }}/head' - - - name: "Clone Openstack {{ project_name_mapped.stdout }}" # noqa: name[template] - when: - - cifmw_bop_openstack_project_path | length == 0 - - not repo_status.stat.exists - - "'host' in _change" - - "'opendev' in _change.host" - ansible.builtin.git: - repo: '{{ _change.host }}/{{ _change.project }}' - dest: '{{ cifmw_bop_build_repo_dir }}/DLRN/data/{{ project_name_mapped.stdout }}' - refspec: "{{ _change.refspec }}" - version: 'FETCH_HEAD' + - "'src_dir' in _change" + ansible.builtin.file: + src: '{{ ansible_user_dir }}/{{ _change.src_dir }}' + path: '{{ cifmw_bop_build_repo_dir }}/DLRN/data/{{ project_name_mapped.stdout }}' + state: link - name: "Update packages.yml to use zuul repo for {{ project_name_mapped.stdout }}" # noqa: name[template], command-instead-of-module vars: