Merge "prepare-workspace-git: Add allow deleting current branch"

This commit is contained in:
Zuul 2024-07-23 18:21:43 +00:00 committed by Gerrit Code Review
commit 8c90dd472b
2 changed files with 10 additions and 20 deletions

View File

@ -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

View File

@ -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