Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab: Make required variables when running pipeline

I want the some of the variables should be required before executing the pipeline in gitlab. Can I achieve it. I have below gitlab-ci.yml

stages:          # Runs First - Anything that needs to run prior to your scripts running
  - deploy
  - Script

variables:
  Domain:
    value: "dom"
  HOST_NAME:
    value: ""  
  JAVA_FILES_WITH_ARGS:
    value: ""
  

I want to make mandatory(JAVA_FILES_WITH_ARGS, HOST_NAME) before run the pipeline how can I achieve it. it will not start the pipeline without these two variable values.

like image 386
Rajarshi Das Avatar asked May 27 '26 22:05

Rajarshi Das


1 Answers

The Answer: is

rules:
 - if: '$JAVA_FILES_WITH_ARGS != "" && $HOST_NAME != ""'
   allow_failure: true
like image 94
Rajarshi Das Avatar answered May 31 '26 11:05

Rajarshi Das



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!