Use item.checkout from zuul.projects when mirroring
We need to set the remote HEAD of the repos after we mirror them. We have been doing that by looking at git status on the local repos to find what their head has been set to. However, we have 'checkout' in zuul.projects now, so we can really just use that. Change-Id: I251da11b7767793278c3f08dcf64aa008e759669 Depends-On: https://review.openstack.org/540948
This commit is contained in:
parent
2943ce05c9
commit
4d2df638d1
@ -17,37 +17,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- skip_ansible_lint
|
- 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
|
# Do this as a multi-line shell so that we can do the loop once
|
||||||
- name: Update remote repository state correctly
|
- name: Update remote repository state correctly
|
||||||
shell: |
|
shell: |
|
||||||
@ -56,7 +25,7 @@
|
|||||||
# Undo the config setting we did above
|
# Undo the config setting we did above
|
||||||
git config --local --unset receive.denyCurrentBranch
|
git config --local --unset receive.denyCurrentBranch
|
||||||
# checkout the branch matching the branch set up by the executor
|
# checkout the branch matching the branch set up by the executor
|
||||||
git checkout {{ project_heads[item.key] }}
|
git checkout {{ item.value.checkout }}
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_user_dir }}/{{ item.value.src_dir }}"
|
chdir: "{{ ansible_user_dir }}/{{ item.value.src_dir }}"
|
||||||
with_dict: "{{ zuul.projects }}"
|
with_dict: "{{ zuul.projects }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user