Skip to content

Add description optional field for Ci::Variable

Max Orefice requested to merge morefice/add-description-to-ci-variables into master

Ref: #409641 (closed)

What does this MR do and why?

This MR adds a description (optional) field allowing users to better describe the use of a given key.

This field is available at the Project and Group Ci::Variable level.

Screenshots or screen recordings

Screenshot_2023-06-21_at_10.41.26

How to set up and validate locally

  1. Generate a PAT http://gdk.test:3000/-/profile/personal_access_tokens
  2. Create a new variable with a description
curl --request POST --header "PRIVATE-TOKEN: <PERSONAL_ACCESS_TOKEN>" "http://gdk.test:3000/api/v4/projects/<PROJECT_ID>/variables" --form "key=NEW_VARIABLE" --form "value=new value" --form "description=description"
  1. Verify the variable has been created correctly
REST API
curl --header "PRIVATE-TOKEN: <PERSONAL_ACCESS_TOKEN>" "http://gdk.test:3000/api/v4/projects/<PROJECT_ID>/variables/NEW_VARIABLE"
GraphQL API
query {
 project(fullPath: "namespace1/project-1") {
   ciVariables {
     nodes {
       key
       value
       description
     }
   }
 }
}

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 Max Orefice

Merge request reports