Search code examples
gitlabgitlab-ci

GItlab: has there any way we can select the variable values as drop down menu


In Gitlab ci We have declared our variables like below

 USER_NAME:
    value: ""  
    description: "Enter Username"
  File_Name:
    description: "Enter the file name"

It only give a text box where We can enter the value.

Can I make a drop down select box is there any option available to make it a select box.Then we can select the value from drop down.


Solution

  • GitLab 15.7 (December 2022) has finally implemented this:

    Select predefined CI/CD variables values from a dropdown list

    Previously, you could pre-fill CI/CD variables in the “Run pipeline” page, with a specific value.

    Unfortunately, if you had multiple options for the variable’s value, you still had to manually input the option you wanted. This was an error-prone process because you could easily input an invalid value, or just mistype it.

    In this release, we’ve added the ability to set a list of values which are surfaced in a drop-down list in the “Run pipeline” page.

    Now you can define the exact list of values that are valid for each CI/CD variable when running a pipeline manually, greatly simplifying your workflow when using manually-triggered pipelines.

    https://about.gitlab.com/images/15_7/prefill.png -- Select predefined CI/CD variables values from a dropdown list

    See Documentation and Issue.