#1658 Wrapper to check / create projects on GitLab using the REST API
Closed: Wrong tracker 2 days ago by arrfab. Opened 3 months ago by gwmngilfen.

Pagure-exporter will be doing the heavy lifting of the migration, but (AIUI) it assumes the target repo exists on GitLab

We should write a script to query the GitLab API for a list of repos (derived from Pagure) and create them as required.


Metadata Update from @gwmngilfen:
- Issue marked as blocking: #1654

3 months ago

Current plan is to start with an external script to deal with creating the GitLab repo, then to see if it can be integrated into Pagure Exporter. Target https://github.com/fedora-infra/pagure-exporter/tree/fogo branch for any exporter changes

OK, so I've written https://gitlab.com/gwmngilfen/create_project as a starting point:

  • Trivial wrapper that uses a config file for base URL, namespace, and API key so they can be re-used
  • Project name is a cmdline arg so we can loop over it easily
  • It uses python-gitlab so it could be integrated into pagure-exporter if needed

Tested locally on my GitLab namespace:

base_url: https://gitlab.com
namespace: gwmngilfen
gl_key: REDACTED
debug: false
(.venv) [greg@topaz]$ ./create_project.py create_project
Target project: gwmngilfen/create_project
Success: Project gwmngilfen/create_project already exists.
(.venv) [greg@topaz]$ ./create_project.py create_project2
Target project: gwmngilfen/create_project2
Project gwmngilfen/create_project2 does not exist. Creating...
Success: Project created: https://gitlab.com/gwmngilfen/create_project2

@arrfab @t0xic0der I think this will get us started? We can extend for nested namespaces or integrate into pagure-export if needed, ofc

Due to centos infra tracker migration (https://lists.centos.org/hyperkitty/list/devel@lists.centos.org/thread/V3ZLBYFHMWSZFXOVGVU7R6P2X6ELGY5V/), this ticket is now closed but you can find corresponding ticket open at
https://gitlab.com/CentOS/infra/tracker/-/issues/1658
Metadata for this ticket is imported in new gitlab tracker but not ownership, so feel free to visit migrated ticket to subscribe and get status update.

Metadata Update from @arrfab:
- Issue close_status updated to: Wrong tracker
- Issue status updated to: Closed (was: Open)

2 days ago

Log in to comment on this ticket.

Metadata