44e8254679
Change-Id: I24d8fd400362ea6a20bc068617e863f98c3e3170
36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
- name: Allow pushing to non-bare repo
|
|
command: "git config --local receive.denyCurrentBranch ignore"
|
|
args:
|
|
chdir: "{{ ansible_user_dir }}/{{ item.src_dir}}"
|
|
with_items: "{{ zuul.projects }}"
|
|
|
|
- name: Synchronize src repos to workspace directory
|
|
command: "git push --mirror git+ssh://{{ ansible_user }}@{{ ansible_host }}/{{ ansible_user_dir }}/{{ item.src_dir}}"
|
|
args:
|
|
chdir: "{{ zuul.executor.work_root }}/{{ item.src_dir }}"
|
|
with_items: "{{ zuul.projects }}"
|
|
delegate_to: localhost
|
|
|
|
- name: Determine local HEAD
|
|
shell: "git status |head -1 |awk '{ print $NF }'"
|
|
args:
|
|
chdir: "{{ zuul.executor.work_root }}/{{ item.src_dir }}"
|
|
with_items: "{{ zuul.projects }}"
|
|
delegate_to: localhost
|
|
register: statuses
|
|
|
|
# Do this as a multi-line shell so that we can do the loop once
|
|
- name: Update remote repository state correctly
|
|
shell: |
|
|
# Reset is needed because we pushed to a non-bare repo
|
|
git reset --hard
|
|
# 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.1.stdout }}
|
|
args:
|
|
chdir: "{{ ansible_user_dir }}/{{ item.0.src_dir }}"
|
|
with_together:
|
|
- "{{ zuul.projects }}"
|
|
- "{{ statuses.results }}"
|