Skip to content

Commit 751ea2d

Browse files
🐛 Add checkout to PR banch into e2e tests (#145)
* Add checkout to PR banch into e2e tests Signed-off-by: michal.gubricky <[email protected]> * Simplify 'Set facts' task name Signed-off-by: Roman Hros <[email protected]> --------- Signed-off-by: michal.gubricky <[email protected]> Signed-off-by: Roman Hros <[email protected]> Co-authored-by: Roman Hros <[email protected]>
1 parent 960597f commit 751ea2d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

playbooks/openstack/e2e.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@
2121
tasks:
2222
- name: Determine cluster stack directory
2323
block:
24+
- name: Get PR details
25+
ansible.builtin.uri:
26+
url: "https://api.github.com/repos/{{ zuul.project.name }}/pulls/{{ zuul.change }}"
27+
body_format: json
28+
headers:
29+
Accept: application/vnd.github+json
30+
X-GitHub-Api-Version: 2022-11-28
31+
register: pull_request
32+
when: zuul.change is defined # execute when the e2e pipeline is initiated on a PR
33+
- name: Set facts when the e2e pipeline is initiated on a PR
34+
ansible.builtin.set_fact:
35+
git_branch_name: "{{ pull_request.json.head.ref }}"
36+
git_repository_url: "{{ pull_request.json.head.repo.clone_url }}"
37+
when: zuul.change is defined # execute when the e2e pipeline is initiated on a PR
38+
- name: Checkout to PR branch
39+
ansible.builtin.git:
40+
repo: "{{ git_repository_url }}"
41+
clone: false
42+
dest: "{{ project_dir }}"
43+
version: "{{ git_branch_name }}"
44+
when: zuul.change is defined # execute when the e2e pipeline is initiated on a PR
2445
- name: Make sure directory structure exists
2546
ansible.builtin.file:
2647
path: "{{ item }}"

0 commit comments

Comments
 (0)