diff --git a/roles/prepare-workspace-git/tasks/main.yaml b/roles/prepare-workspace-git/tasks/main.yaml index 644ae412d..51f554f02 100644 --- a/roles/prepare-workspace-git/tasks/main.yaml +++ b/roles/prepare-workspace-git/tasks/main.yaml @@ -30,6 +30,10 @@ fi cd {{ zuul_workspace_root }}/{{ zj_project.src_dir }} 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 add origin file:///dev/null args: @@ -42,16 +46,6 @@ tags: - 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 include_tasks: sync-project.yaml with_dict: "{{ _zuul_projects }}" @@ -69,6 +63,7 @@ git clean -xdf # Undo the config setting we did above git config --local --unset receive.denyCurrentBranch + git config --local --unset receive.denyDeleteCurrent # checkout the branch matching the branch set up by the executor git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ zj_project.value.checkout }} # put out a status line with the current HEAD diff --git a/roles/test-prepare-workspace-git/tasks/main.yaml b/roles/test-prepare-workspace-git/tasks/main.yaml index 5e68daf99..3787b53ac 100644 --- a/roles/test-prepare-workspace-git/tasks/main.yaml +++ b/roles/test-prepare-workspace-git/tasks/main.yaml @@ -30,6 +30,10 @@ fi cd {{ zuul_workspace_root }}/{{ zj_project.src_dir }} 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 add origin file:///dev/null args: @@ -42,16 +46,6 @@ tags: - 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 command: |- {% if ansible_connection == "kubectl" %} @@ -90,6 +84,7 @@ git clean -xdf # Undo the config setting we did above git config --local --unset receive.denyCurrentBranch + git config --local --unset receive.denyDeleteCurrent # checkout the branch matching the branch set up by the executor git checkout {% if mirror_workspace_quiet %}--quiet{% endif %} {{ zj_project.value.checkout }} # put out a status line with the current HEAD