Merge "Use item.checkout from zuul.projects when mirroring"
This commit is contained in:
commit
6cfe94a80a
@ -17,37 +17,6 @@
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Show git status of src repos in workspace
|
||||
# Show the full git status output for each repo to debug failures
|
||||
# when determining HEAD in the next task.
|
||||
shell: "echo '{{ item.key }}:'; git status"
|
||||
args:
|
||||
chdir: "{{ zuul.executor.work_root }}/{{ item.value.src_dir }}"
|
||||
with_dict: "{{ zuul.projects }}"
|
||||
delegate_to: localhost
|
||||
# ANSIBLE0006: Skip linting since it triggers on the "git" command,
|
||||
# but status is not supported by ansible git module.
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Determine local HEAD of projects
|
||||
# Output yaml-valid dict data for projects and their current HEAD
|
||||
shell: "echo '{{ item.key }}:' $(git status | head -1 |awk '{ print $NF }')"
|
||||
args:
|
||||
chdir: "{{ zuul.executor.work_root }}/{{ item.value.src_dir }}"
|
||||
with_dict: "{{ zuul.projects }}"
|
||||
delegate_to: localhost
|
||||
register: project_heads_yaml
|
||||
# ANSIBLE0006: Skip linting since it triggers on the "git" command,
|
||||
# but status is not supported by ansible git module.
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Build dict to map project and current head HEAD
|
||||
set_fact:
|
||||
project_heads: "{{ project_heads|default({}) | combine( item.stdout | from_yaml ) }}"
|
||||
with_items: '{{ project_heads_yaml.results }}'
|
||||
|
||||
# Do this as a multi-line shell so that we can do the loop once
|
||||
- name: Update remote repository state correctly
|
||||
shell: |
|
||||
@ -56,7 +25,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 {{ project_heads[item.key] }}
|
||||
git checkout {{ item.value.checkout }}
|
||||
args:
|
||||
chdir: "{{ ansible_user_dir }}/{{ item.value.src_dir }}"
|
||||
with_dict: "{{ zuul.projects }}"
|
||||
|
Loading…
Reference in New Issue
Block a user