Skip to content

Add capability to pre-populate Git repos #156

Description

@ericzolf

Something like the following:

- name: Import Git projects to gitea student user
  ansible.builtin.uri:
    url: "{{ gitea_protocol }}://{{ gitea_http_domain }}:{{ gitea_http_port }}/api/v1/repos/migrate"
    method: POST
    body_format: json
    body: {"clone_addr": "{{ item.url }}", "repo_name": "{{ item.name }}"}
    status_code: [201, 409]  # Created or Conflict
    headers:
      Content-Type: "application/json"
    user: "{{ gitea_users[0]['name'] }}"
    password: "{{ gitea_users[0]['password'] }}"
    force_basic_auth: yes
    validate_certs: no
  loop: "{{ gitea_repos }}"

Withdefaults/main.yml looking like the following:

# list of repos to migrate/copy onto the first user's account
gitea_repos: []
# example of entry
#  - name: ansible_role_gitea 
#    url: https://github.com/roles-ansible/ansible_role_gitea.git

It's a bit crude to simply use the first user but you perhaps have a better idea how to do it (simply worked for me!).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions