Skip to content

Add status_message to package graphql payload

What does this MR do and why?

🌱 Context

When a package fails to upload to the GitLab Package Registry, we display only a generic message in the UI. The message does not give the user much insight into what went wrong and makes it difficult for them to know how to resolve the issue.

In Add`status_message` to the package model (!122299 - merged), a new column status_message was added to the package model. This column stores a descriptive error message that could help debug what went wrong when uploading a package.

We want the UI to be able to display this message to the user. To do so, we need to return its value in the GraphQL package payload.

The error message should be displayed on the page that lists the packages in the UI. On this page, the Types::Packages::PackageBaseType is used to access the package data. That's why the status_message should be added to Types::Packages::PackageBaseType in order to be accessible on the packages list page.

What would be needed in the frontend MR is to add statusMessage to the PackageData fragment. We can then display the message to the user instead of the static used error messages.

🚒 Solution

How to set up and validate locally

  1. In rails console, update the status_message field for any package:
Packages::Package.last.update(status_message: 'custom error message')
  1. Get the project full_path to use it later in the GraphQL query:
Packages::Package.last.project.full_path
  1. Open the local GraphQL explorer: http://gdk.test:3000/-/graphql-explorer

  2. Access the package list with this GraphQL query:

    GraphQL Query:
    {
      project(fullPath: <project full_path from step 2>){
        packages {
          nodes {
            statusMessage
         }
       }
     }
    }
  1. You should get the list of the project's packages and each package should have the statusMessage attribute
 {
 "data": {
   "project": {
     "packages": {
       "nodes": [
         {
           "statusMessage": "custom error message"
         },
         {
           "statusMessage": null
         }
       ]
     }
   }
 }
}

MR acceptance checklist

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

Related to #428207 (closed)

Edited by Moaz Khalifa

Merge request reports