Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to pre-populate Git repos #156

Open
ericzolf opened this issue Mar 25, 2024 · 0 comments
Open

Add capability to pre-populate Git repos #156

ericzolf opened this issue Mar 25, 2024 · 0 comments

Comments

@ericzolf
Copy link

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!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant