简体   繁体   中英

How to make Gitlab CI not apply variable when the variable is in file

I have created a GitLab pipeline and predefined variable (type file). That file contains a variable ${myVar} that should not has to be applied before some steps of the job. I found that when I open that file using cat , the ${myVar} disappeared. Looks like it was applied but with an empty string since its content has not yet been generated.

Question: how to tell GitLab CI to ignore variables in the variable file

The issue is fixed. All you need to do is to add one more $ sign before the variable. Hence instead of ${myVar} you need to specify $${myVar} in this case GitLab CI will not apply the variable

As of Gitlab 13.7 you can disable variable expansion for the variable (enabled by default). See:

https://gitlab.nposervices.com/help/ci/variables/index#expand-cicd-variables

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM