Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Add checkout to PR banch into e2e tests #145

Merged
merged 6 commits into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions playbooks/openstack/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@
tasks:
- name: Determine cluster stack directory
block:
- name: Get PR details
ansible.builtin.uri:
url: "https://api.github.com/repos/{{ zuul.project.name }}/pulls/{{ zuul.change }}"
body_format: json
headers:
Accept: application/vnd.github+json
X-GitHub-Api-Version: 2022-11-28
register: pull_request
when: zuul.change is defined # execute when the e2e pipeline is initiated on a PR
- name: Set facts when the e2e pipeline is initiated on a PR
ansible.builtin.set_fact:
git_branch_name: "{{ pull_request.json.head.ref }}"
git_repository_url: "{{ pull_request.json.head.repo.clone_url }}"
when: zuul.change is defined # execute when the e2e pipeline is initiated on a PR
- 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 }}"
Expand Down