Configuring Pull mirroring when creating a project is not working
Summary
Users cannot create PULL Mirror Repository using the Project API which should be possible according to Create a pull mirror documentation. Ideally a user should also be able to create a repository mirror during project creation or an empty repository first and just update the project settings to enabled pull mirroring.
Steps to reproduce
Case 1: Create repository and mirror settings in one API call
- Go to a paid namespace (Premium or higher).
- Create a repository using the API with
import_urlandmirrorsettings. See example below.
curl --request POST --header "PRIVATE-TOKEN: <TOKEN>" \
--header "Content-Type: application/json" --data '{ "name": "<PROJECTNAME>", "description": "<PROJECTDESCRIPTION>", "path": "<PROJECTPATH>","namespace_id": "<PAIDNAMESPACE_ID>","import_url": "https://<USERNAME>:<TOKEN>@gitlab.com/<GROUP>/<USER>/<PROJECT>.git", "initialize_with_readme": "false", "mirror": "true"}' \
--url 'https://gitlab.com/api/v4/projects/'
- Observe that the project is created but the Mirror Repository settings are missing.
Case 2: Create empty repository first then update project settings to include import_url and mirror settings.
- Go to a paid namespace (Premium or higher).
- Create a repository using the API without
import_urlandmirrorsettings. See example below.
curl --request POST --header "PRIVATE-TOKEN: <TOKEN>" \
--header "Content-Type: application/json" --data '{ "name": "<PROJECTNAME>", "description": "<PROJECTDESCRIPTION>", "path": "<PROJECTPATH>","namespace_id": "<PAIDNAMESPACE_ID>","initialize_with_readme": "false"}' \
--url 'https://gitlab.com/api/v4/projects/'
- Update repository settings.
curl --request PUT --header "PRIVATE-TOKEN: <TOKEN>" \
-d 'import_url=https://<USERNAME>:<TOKEN>@gitlab.com/<GROUP>/<USER>/<PROJECT>.git' \
-d 'mirror=true' \
"https://gitlab.com/api/v4/projects/<PROJECT_ID>"
- Observe that the mirror repository settings are not updated.
Example Project
https://gitlab.com/gitlab-gold/kballon/test-pull-mirror-using-api
What is the current bug behavior?
- Project is created without the mirror settings being reflected properly.
What is the expected correct behavior?
- Project should be created with correct mirror settings.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com 15.5.0-pre e495bae6
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Edited by 🤖 GitLab Bot 🤖