Skip to content

Add description field for Ci::InstanceVariable and InheritedCiVariable

Mireya Andres requested to merge ci-instance-var-description into master

What does this MR do and why?

Additional backend implementation for adding description to CI variables. Implements #378938 (closed) and used in !140547 (merged).

This MR creates the following changes:

  • Exposes description in variable_params_attributes from the admin/group/project controllers.
  • Adds the optional description field to Ci::InstanceVariable, allowing users to add a description to their instance-level (admin) CI variables. This field is already available for group-level and project-level CI variables.
  • Include description field in the query results for inherited CI variables and instance CI variables.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Instance-level CI Variables Inherited CI Variables
Screenshot_2023-12-22_at_16.46.17 Screenshot_2023-12-22_at_18.30.37

How to set up and validate locally

API:

  1. Generate a Personal Access Token via http://gdk.test:3000/-/profile/personal_access_tokens.
  2. Create a new instance variable with a description.
curl --request POST --header "PRIVATE-TOKEN: <PERSONAL_ACCESS_TOKEN>" "http://gdk.test:3000/api/v4/admin/ci/variables" --form "key=NEW_ADMIN_VARIABLE" --form "value=ADMIN_VAR_KEY" --form "description=This is a new instance variable."

From the UI:

You can also run !140547 (merged) to verify that you can add descriptions to instance-level variables from the UI.

GraphQL Queries (for instance-level CI variables and inherited CI variables)

# instance-level ci variables
query {
  ciVariables(first: 10) {
    nodes {
      id
      key
      value
      description
    }
  }
}

# inherited ci variables
query {
  project(fullPath: "kitchen-sink/bakery") {
    inheritedCiVariables(first: 10) {
      nodes {
        id
        key
        description
      }
    }    
  }
}

Related to #418331 (closed)

Edited by Veethika Mishra

Merge request reports