Skip to content

Add error message to repository storage moves

James Fargher requested to merge storage_moves_error into master

What does this MR do and why?

#333277 (closed)

Populates and exposes an error message field. This error will be populated when repository storage moves fail.

How to set up and validate locally

  1. Setup a second storage in gdk.yml:

    gitaly:
      storage_count: 2
  2. Rejigger/restart gdk:

    $ gdk reconfigure && gdk restart
  3. Confirm that gitlab-rails know about the storage. Visit Admin area > Settings > Repository > Repository Storage. The new storage should be called "gitaly-1".

  4. Create an access token with admin and API access. Visit Preferences > Access tokens > Add new token

  5. Initiate a repository storage move (make sure you substitute your project ID and access token). https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#schedule-a-repository-storage-move-for-a-project

    $ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" \
      --data '{"destination_storage_name":"gitaly-1"}' \
      "http://127.0.0.1:3000/api/v4/projects/<project_id>/repository_storage_moves"
    {"id":1,"created_at":"2023-11-13T02:57:43.523Z","state":"scheduled","source_storage_name":"default","destination_storage_name":"gitaly-1","error_message":null,"project":{"id":13,"description":"Sapiente cumque unde eos quae est.","name":"Underscore","name_with_namespace":"I User0 / Underscore","path":"Underscore","path_with_namespace":"i-user-0-1699826750/Underscore","created_at":"2023-11-12T22:09:10.639Z"}}
  6. Query the repository storage move:

    $ curl --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" \
      "http://127.0.0.1:3000/api/v4/projects/<project_id>/repository_storage_moves/<repository_storage_moves_id>"

    Failure example:

    {"id":1,"created_at":"2023-11-13T02:57:43.523Z","state":"failed","source_storage_name":"default","destination_storage_name":"gitaly-1","error_message":"5:invalid source repository.","project":{"id":13,"description":"Sapiente cumque unde eos quae est.","name":"Underscore","name_with_namespace":"I User0 / Underscore","path":"Underscore","path_with_namespace":"i-user-0-1699826750/Underscore","created_at":"2023-11-12T22:09:10.639Z"}}

    Success example:

    {"id":2,"created_at":"2023-11-13T03:09:55.577Z","state":"finished","source_storage_name":"default","destination_storage_name":"gitaly-1","error_message":null,"project":{"id":7,"description":"Dolore voluptate sunt et quia vel.","name":"Flight","name_with_namespace":"Flightjs / Flight","path":"Flight","path_with_namespace":"flightjs/Flight","created_at":"2023-11-12T22:05:26.207Z"}}

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 James Fargher

Merge request reports