Add mirror-workspace-git-repos role
Change-Id: I6958e95a9ea31ab8ae027a9b33069d74be615d91
This commit is contained in:
parent
ead78fed13
commit
348598e96a
6
roles/mirror-workspace-git-repos/README.rst
Normal file
6
roles/mirror-workspace-git-repos/README.rst
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Mirror the local git repos to remote nodes
|
||||||
|
|
||||||
|
This role uses git operations (unlike :zuul:role:`prepare-workspace`
|
||||||
|
which uses rsync) to mirror the local prepared git repos to the remote
|
||||||
|
nodes. This may be useful if the remote node already has a copy of
|
||||||
|
some or all of the git repos.
|
19
roles/mirror-workspace-git-repos/tasks/main.yaml
Normal file
19
roles/mirror-workspace-git-repos/tasks/main.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
- name: Synchronize src repos to workspace directory
|
||||||
|
command: "git push --mirror git+ssh://{{ ansible_user }}@{{ ansible_host }}/{{ ansible_user_dir }}/{{ item.src_dir}}"
|
||||||
|
chdir: "{{ zuul.executor.src_root }}/{{ item.src_dir }}"
|
||||||
|
with_items: "{{ zuul.projects }}"
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- name: Determine local HEAD
|
||||||
|
shell: "git status |head -1 |awk '{ print $NF }'"
|
||||||
|
chdir: "{{ zuul.executor.src_root }}/{{ item.src_dir }}"
|
||||||
|
with_items: "{{ zuul.projects }}"
|
||||||
|
delegate_to: localhost
|
||||||
|
register: statuses
|
||||||
|
|
||||||
|
- name: Checkout local HEAD on remote
|
||||||
|
command: "git checkout {{ item.1 }}"
|
||||||
|
chdir: "{{ zuul.executor.src_root }}/{{ item.0.src_dir }}"
|
||||||
|
with_together:
|
||||||
|
- "{{ zuul.projects }}"
|
||||||
|
- "{{ statuses }}"
|
Loading…
Reference in New Issue
Block a user