Skip to content

Add ability to create sha256 project through using the GitLab API

What does this MR do and why?

Contributes to #419887 (closed)

Problem

For future support of SHA256 repositories we don't have a way to create a project via API.

Solution

  • Adjust Projects::CreateService interface to accept object_format instead of use_sha256_repository
  • Extend allowed parameters for Project creation API

How to set up and validate locally

Projects API

  1. Visit http://127.0.0.1:3000/api/v4/projects
  2. You should see a new field repository_object_format in the response

Creation of the project

  1. Feature.enable(:support_sha256_repositories)
  2. curl --request POST --header "PRIVATE-TOKEN: <PRIVATE_TOKEN>" --header "Content-Type: application/json" --data '{"name": "sha256_project", "description": "New Project", "repository_object_format": "sha256", "initialize_with_readme": "true"}' "http://127.0.0.1:3000/api/v4/projects"
  3. You should see a new project with SHA256

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports