Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 597
Rajarshi Das Avatar asked Sep 12 '25 16:09

Rajarshi Das


2 Answers

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.

like image 146
VonC Avatar answered Sep 15 '25 12:09

VonC


From version 15.7 is available

variables:
  CONTENTFUL_ENV:
    value: "preview"
    options:
      - "preview"
      - "cdn"
    description: "The contentful env"
like image 26
Reza Avatar answered Sep 15 '25 14:09

Reza