From 285021551aea5535a1347cebcd062661273b5f2c Mon Sep 17 00:00:00 2001 From: "michal.gubricky" Date: Mon, 22 Jul 2024 09:44:03 +0200 Subject: [PATCH] Add checkout to PR banch into e2e tests Signed-off-by: michal.gubricky --- playbooks/openstack/e2e.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/playbooks/openstack/e2e.yaml b/playbooks/openstack/e2e.yaml index ffad3881..af5dcb59 100644 --- a/playbooks/openstack/e2e.yaml +++ b/playbooks/openstack/e2e.yaml @@ -23,6 +23,20 @@ tasks: - name: Determine cluster stack directory block: + - name: | + Set facts - + Priority is given to the values of git_reference and git_repo over variables collected from the PR. + In cases where git_reference and git_repo are undefined, and e2e is not executed on the PR, a fallback mechanism is employed. + ansible.builtin.set_fact: + git_branch_name: "{{ git_reference | default(pull_request.json.head.ref) | default(git_reference_default) }}" + git_repository_url: "{{ git_repo | default(pull_request.json.head.repo.clone_url) | default(git_repo_default) }}" + - name: Checkout to PR branch + ansible.builtin.git: + repo: "{{ git_repository_url }}" + clone: false + dest: "{{ project_dir }}" + version: "{{ git_branch_name }}" + when: zuul.change is defined # execute when the e2e pipeline is initiated on a PR - name: Make sure directory structure exists ansible.builtin.file: path: "{{ item }}"