REST API: add an endpoint to configure pull mirrors

What does this MR do and why?

Contributes to #494294 (closed)

Problem

Currently, pull mirroring configuration is done through Projects API. This is confusing and leads to various problems.

Solution

Create a new endpoint to configure Pull Mirroring for a project.

How to set up and validate locally

  1. Enable a pull mirror configuration for the project with

    curl -X PUT --data 'enabled=true&url=http://example.com' --header "PRIVATE-TOKEN: <PRIVATE_TOKEN>" http://gdk.test:3000/api/v4/projects/<project_id>/mirror/pull

  2. You should see a response with enabled: true.

  3. Visit project with a new mirror

  4. Open Settings -> Repository -> Mirroring repositories

  5. You should see a new pull mirror configuration Screenshot_2024-10-11_at_17.43.16

  6. Disable a pull mirror configuraton with

    curl -X PUT --data 'enabled=false' --header "PRIVATE-TOKEN: <PRIVATE_TOKEN>" http://gdk.test:3000/api/v4/projects/<project_id>/mirror/pull

  7. The mirror configuration should disappear from UI

Screenshot_2024-10-11_at_17.45.29

Edited by Vasilii Iakliushin

Merge request reports

Loading
Loading