Merge "Optionally silence git in mirror-workspace-git-repos"

This commit is contained in:
Zuul 2019-03-26 17:00:48 +00:00 committed by Gerrit Code Review
commit 2d80c33990
3 changed files with 11 additions and 2 deletions

View File

@ -4,3 +4,11 @@ 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.
**Role Variables**
.. zuul:rolevar:: mirror_workspace_quiet
:default: false
If `true` git operations will be silenced and won't print every
changed reference.

View File

@ -0,0 +1 @@
mirror_workspace_quiet: false

View File

@ -7,7 +7,7 @@
with_dict: "{{ zuul.projects }}"
- name: Synchronize src repos to workspace directory
command: "git push --mirror git+ssh://{{ ansible_user }}@{{ ansible_host | ipwrap }}:{{ ansible_port }}/{{ ansible_user_dir }}/{{ item.value.src_dir}}"
command: "git push {% if mirror_workspace_quiet %}--quiet{% endif %} --mirror git+ssh://{{ ansible_user }}@{{ ansible_host | ipwrap }}:{{ ansible_port }}/{{ ansible_user_dir }}/{{ item.value.src_dir}}"
args:
chdir: "{{ zuul.executor.work_root }}/{{ item.value.src_dir }}"
with_dict: "{{ zuul.projects }}"
@ -32,7 +32,7 @@
# Undo the config setting we did above
git config --local --unset receive.denyCurrentBranch
# checkout the branch matching the branch set up by the executor
git checkout {{ item.value.checkout }}
git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ item.value.checkout }}
# put out a status line with the current HEAD
echo "{{ item.value.canonical_name }} checked out to:"
git log --pretty=oneline -1