]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
roles/pulpito: support github pull branches to checkout
authorKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Thu, 14 Oct 2021 12:16:12 +0000 (14:16 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Fri, 15 Oct 2021 21:59:37 +0000 (23:59 +0200)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@gmail.com>
roles/pulpito/tasks/setup_pulpito.yml

index 84b740fbe1a5006c3adfe08dfdacacb2acf7c8a6..f9ea51bac49b185d662f69874f8f0474ebcaadb2 100644 (file)
@@ -1,4 +1,19 @@
 ---
+- name: Determine GitHub Pull Request
+  set_fact:
+    pulpito_pull: "{{ pulpito_branch | regex_replace( '^refs/pull/([^/]+)/.*$', '\\1') }}"
+
+- name: Clone the repo and checkout pull request branch
+  git:
+    repo: "{{ pulpito_repo }}"
+    dest: "{{ pulpito_repo_path }}"
+    version: "pull-{{ pulpito_pull }}"
+    refspec: '+{{ pulpito_branch }}:refs/remotes/origin/pull-{{ pulpito_pull }}'
+  become_user: "{{ pulpito_user }}"
+  tags:
+    - repos
+  when: pulpito_pull is defined and pulpito_pull != pulpito_branch
+
 - name: Checkout the repo
   git:
     repo: "{{ pulpito_repo }}"
@@ -7,6 +22,7 @@
   become_user: "{{ pulpito_user }}"
   tags:
     - repos
+  when: pulpito_pull is not defined or pulpito_pull == pulpito_branch
 
 - name: Look for the virtualenv
   stat: