Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI variables returns empty string?

It's been 2 days since one of my project' build starts failing on Gitlab CI. The main error was E_MISSING_APP_KEY and when I check another variable just by echoing $HOST and $PORT from my .gitlab-ci.yml config, like this

tests:
  script:
    - echo "${HOST} ${PORT}"
    - node -e "console.log(process.env.HOST, process.env.PORT)"
    - node_modules/.bin/nyc node ace test -t 0

I got nothing.

initial error

The build was failed because it can't read my environment variable that I set on its CI Settings.

my CI variable setting

Anyone experiencing same issue? & how to solve this?


Update:

I'm trying to create new project with only containing .gitlab-ci.yml file here and it's seems working just fine

result on new dummy project

But why the world it's still failing on my main project?

kee failing

like image 352
Fery W Avatar asked May 06 '26 13:05

Fery W


2 Answers

For anyone else having a similar problem:

check your variable, if it is protected your branch has to be protected as well or remove the protected option on your variable

like image 193
Avshalom N. Israel Avatar answered May 09 '26 02:05

Avshalom N. Israel


The issue is solved by delete all of my variables I've had & set them back from the CI Setting. And the build pipeline is running without any errors. (except the actual testing is still failed, lol)

enter image description here

Honestly, I'm still wondering why this could happened? and hopefully no one will experiencing same kind of issue like me here..

like image 40
Fery W Avatar answered May 09 '26 00:05

Fery W



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!