Merge "Use the gitea api in the gitea renaming playbook"
This commit is contained in:
commit
a454fbb6d0
@ -36,33 +36,28 @@
|
|||||||
- name: "Transfer repo ownership from {{ oldorg }}/{{ oldproj }} to {{ neworg }}/{{ oldproj }}"
|
- name: "Transfer repo ownership from {{ oldorg }}/{{ oldproj }} to {{ neworg }}/{{ oldproj }}"
|
||||||
when: "oldorg != neworg"
|
when: "oldorg != neworg"
|
||||||
uri:
|
uri:
|
||||||
url: "{{ gitea_url }}/{{ oldorg }}/{{ oldproj }}/settings"
|
url: "{{ gitea_url }}/api/v1/repos/{{ oldorg }}/{{ oldproj }}/transfer"
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
user: root
|
user: root
|
||||||
password: "{{ gitea_root_password }}"
|
password: "{{ gitea_root_password }}"
|
||||||
force_basic_auth: true
|
force_basic_auth: true
|
||||||
status_code: 302
|
status_code: 202
|
||||||
method: POST
|
method: POST
|
||||||
body_format: form-urlencoded
|
body_format: json
|
||||||
body:
|
body:
|
||||||
_csrf: "{{ gitea_token }}"
|
new_owner: "{{ neworg }}"
|
||||||
action: transfer
|
|
||||||
repo_name: "{{ oldproj }}"
|
|
||||||
new_owner_name: "{{ neworg }}"
|
|
||||||
- name: "Update repo name from {{ neworg }}/{{ oldproj }} to {{ neworg }}/{{ newproj }}"
|
- name: "Update repo name from {{ neworg }}/{{ oldproj }} to {{ neworg }}/{{ newproj }}"
|
||||||
when: "oldproj != newproj"
|
when: "oldproj != newproj"
|
||||||
uri:
|
uri:
|
||||||
url: "{{ gitea_url }}/{{ neworg }}/{{ oldproj }}/settings"
|
url: "{{ gitea_url }}/api/v1/repos/{{ neworg }}/{{ oldproj }}"
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
user: root
|
user: root
|
||||||
password: "{{ gitea_root_password }}"
|
password: "{{ gitea_root_password }}"
|
||||||
force_basic_auth: true
|
force_basic_auth: true
|
||||||
status_code: 302
|
status_code: 200
|
||||||
method: POST
|
method: PATCH
|
||||||
body_format: form-urlencoded
|
body_format: json
|
||||||
body:
|
body:
|
||||||
_csrf: "{{ gitea_token }}"
|
name: "{{ newproj }}"
|
||||||
action: update
|
|
||||||
repo_name: "{{ newproj }}"
|
|
||||||
description: "{{ gitea_repo.json.description }}"
|
description: "{{ gitea_repo.json.description }}"
|
||||||
website: "{{ gitea_repo.json.website }}"
|
website: "{{ gitea_repo.json.website }}"
|
||||||
|
@ -33,17 +33,6 @@
|
|||||||
gitea_url: https://localhost:3000
|
gitea_url: https://localhost:3000
|
||||||
tasks:
|
tasks:
|
||||||
- include_vars: "{{ repolist }}"
|
- include_vars: "{{ repolist }}"
|
||||||
- name: Get a CSRF token
|
|
||||||
uri:
|
|
||||||
url: "{{ gitea_url }}/"
|
|
||||||
validate_certs: false
|
|
||||||
user: root
|
|
||||||
password: "{{ gitea_root_password }}"
|
|
||||||
force_basic_auth: true
|
|
||||||
register: gitea_token
|
|
||||||
- name: Parse CSRF taken
|
|
||||||
set_fact:
|
|
||||||
gitea_token: "{{ gitea_token.cookies._csrf|regex_replace('%3D','=') }}"
|
|
||||||
- name: Move gitea repo
|
- name: Move gitea repo
|
||||||
include_tasks: gitea-rename-tasks.yaml
|
include_tasks: gitea-rename-tasks.yaml
|
||||||
loop: "{{ repos }}"
|
loop: "{{ repos }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user