prepare-workspace-git: Add allow deleting current branch
In cases where the HEAD branch of a repository is deleted, prepare-workspace-git will be unable to propagate that deletion from the executor repos to a clone of a cached repo on a remote node. Correct this by unsetting the receive.delyDeleteCurrent flag. This was correctly set in mirror-workspace-git, but did not make it into prepare-workspace-git. Change-Id: I159fb1f9f9cee873466f11be2f155bed6892472e
This commit is contained in:
parent
bb9c303fab
commit
8003cdc76c
@ -30,6 +30,10 @@
|
|||||||
fi
|
fi
|
||||||
cd {{ zuul_workspace_root }}/{{ zj_project.src_dir }}
|
cd {{ zuul_workspace_root }}/{{ zj_project.src_dir }}
|
||||||
git config --local --bool core.bare false
|
git config --local --bool core.bare false
|
||||||
|
# Allow pushing to non-bare repo
|
||||||
|
git config --local receive.denyCurrentBranch ignore
|
||||||
|
# Allow deleting current branch
|
||||||
|
git config --local receive.denyDeleteCurrent ignore
|
||||||
git remote -v | grep origin && git remote rm origin || true
|
git remote -v | grep origin && git remote rm origin || true
|
||||||
git remote add origin file:///dev/null
|
git remote add origin file:///dev/null
|
||||||
args:
|
args:
|
||||||
@ -42,16 +46,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- skip_ansible_lint
|
- skip_ansible_lint
|
||||||
|
|
||||||
- name: Allow pushing to non-bare repo
|
|
||||||
git_config:
|
|
||||||
name: receive.denyCurrentBranch
|
|
||||||
value: ignore
|
|
||||||
scope: local
|
|
||||||
repo: "{{ zuul_workspace_root }}/{{ zj_project.value.src_dir }}"
|
|
||||||
with_dict: "{{ _zuul_projects }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: zj_project
|
|
||||||
|
|
||||||
- name: Include tasks to synchronize src repos to workspace directory
|
- name: Include tasks to synchronize src repos to workspace directory
|
||||||
include_tasks: sync-project.yaml
|
include_tasks: sync-project.yaml
|
||||||
with_dict: "{{ _zuul_projects }}"
|
with_dict: "{{ _zuul_projects }}"
|
||||||
@ -69,6 +63,7 @@
|
|||||||
git clean -xdf
|
git clean -xdf
|
||||||
# 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
|
||||||
|
git config --local --unset receive.denyDeleteCurrent
|
||||||
# checkout the branch matching the branch set up by the executor
|
# checkout the branch matching the branch set up by the executor
|
||||||
git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ zj_project.value.checkout }}
|
git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ zj_project.value.checkout }}
|
||||||
# put out a status line with the current HEAD
|
# put out a status line with the current HEAD
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
fi
|
fi
|
||||||
cd {{ zuul_workspace_root }}/{{ zj_project.src_dir }}
|
cd {{ zuul_workspace_root }}/{{ zj_project.src_dir }}
|
||||||
git config --local --bool core.bare false
|
git config --local --bool core.bare false
|
||||||
|
# Allow pushing to non-bare repo
|
||||||
|
git config --local receive.denyCurrentBranch ignore
|
||||||
|
# Allow deleting current branch
|
||||||
|
git config --local receive.denyDeleteCurrent ignore
|
||||||
git remote -v | grep origin && git remote rm origin || true
|
git remote -v | grep origin && git remote rm origin || true
|
||||||
git remote add origin file:///dev/null
|
git remote add origin file:///dev/null
|
||||||
args:
|
args:
|
||||||
@ -42,16 +46,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- skip_ansible_lint
|
- skip_ansible_lint
|
||||||
|
|
||||||
- name: Allow pushing to non-bare repo
|
|
||||||
git_config:
|
|
||||||
name: receive.denyCurrentBranch
|
|
||||||
value: ignore
|
|
||||||
scope: local
|
|
||||||
repo: "{{ zuul_workspace_root }}/{{ zj_project.value.src_dir }}"
|
|
||||||
with_dict: "{{ _zuul_projects }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: zj_project
|
|
||||||
|
|
||||||
- name: Synchronize src repos to workspace directory
|
- name: Synchronize src repos to workspace directory
|
||||||
command: |-
|
command: |-
|
||||||
{% if ansible_connection == "kubectl" %}
|
{% if ansible_connection == "kubectl" %}
|
||||||
@ -90,6 +84,7 @@
|
|||||||
git clean -xdf
|
git clean -xdf
|
||||||
# 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
|
||||||
|
git config --local --unset receive.denyDeleteCurrent
|
||||||
# checkout the branch matching the branch set up by the executor
|
# checkout the branch matching the branch set up by the executor
|
||||||
git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ zj_project.value.checkout }}
|
git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ zj_project.value.checkout }}
|
||||||
# put out a status line with the current HEAD
|
# put out a status line with the current HEAD
|
||||||
|
Loading…
Reference in New Issue
Block a user