Monty Taylor 683b73b4fb Send readme parameter when creating projects
The web page from which this call is taken has a readme selector
and a default value of "Default" that we're not sending in this
request. Send it to avoid gitea not being able to find the empty
readme.

Also, add gitea-git-repos to the files section of system-config-run-gitea
so that we actually test it.

Change-Id: Ieec94aadb63fa097f10a3f325dd105b30e610dd9
2019-03-07 22:17:53 +00:00

65 lines
2.0 KiB
YAML

- name: debug
debug:
msg: "{{ project }}"
- name: Parse project name
set_fact:
org: "{{ project.project | regex_replace('^(.*)/(.*)$', '\\1') }}"
repo: "{{ project.project | regex_replace('^(.*)/(.*)$', '\\2') }}"
- name: Create repo
when: project.project not in gitea_repos
uri:
url: "{{ gitea_url }}/api/v1/org/{{ org }}/repos"
user: root
password: "{{ gitea_root_password }}"
force_basic_auth: true
validate_certs: false
status_code: 201
method: POST
body_format: json
body:
auto_init: true
description: "{{ (project.description | default(''))[:255] }}"
name: "{{ repo }}"
private: false
readme: Default
register: create_repo_result
- name: Adjust repo settings
when: gitea_always_update or project.project not in gitea_repos
uri:
url: "{{ gitea_url }}/{{ org }}/{{ repo }}/settings"
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: advanced
# enable_pulls is not provided, which disables it
# enable_wiki is not provided, which disables it
enable_external_wiki: false
external_wiki_url:
# enable_issues is on so that issue links work
enable_issues: on
enable_external_tracker: true
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