Revert "Revert "Set default branch for repo""

This reverts commit b076aefa08.

This may still not work. The last time it got 404s when
running as part of project creation. So possibly it was
failing because there was no git content yet and thus
master was an invalid value. If that's the case, we may
need to add auto_init to true just to get a default repo
and metadata and count on gerrit force-pushing during first
replication.

Use auto_init to create a repo with a master branch

It's not possible to set the default_branch to master if there is
no repo, and without that first replication sets the branch
incorrectly.

Set auto_init to true to get an empty repo which will be replaced
by the initial gerrit force-push anyway.

Change-Id: I66de43a4d00583c06cf92bb7083ce28d4b8d4df9
Story: 2004627
Task: 29847
This commit is contained in:
Monty Taylor 2019-03-05 19:38:31 +00:00
parent 9ff29b108d
commit d447f7d2df

View File

@ -17,7 +17,7 @@
method: POST
body_format: json
body:
auto_init: false
auto_init: true
description: "{{ (project.description | default(''))[:255] }}"
name: "{{ repo }}"
private: false
@ -46,3 +46,18 @@
external_tracker_url: "https://storyboard.openstack.org/#!/project/{{ org }}/{{ repo }}"
tracker_url_format: https://storyboard.openstack.org/#!/story/{index}
tracker_issue_style: numeric
- name: Set default branch
when: gitea_always_update or project.project not in gitea_repos
uri:
url: "{{ gitea_url }}/{{ org }}/{{ repo }}/settings/branches"
validate_certs: false
user: root
password: "{{ gitea_root_password }}"
force_basic_auth: true
status_code: 302
method: POST
body_format: form-urlencoded
body:
_csrf: "{{ gitea_token }}"
action: default_branch
branch: master