6

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
Fery W
  • 1,402
  • 1
  • 15
  • 28
  • Have you tried any of the steps outlined at the "More details" link? – Sidney Apr 15 '18 at 21:23
  • The "More details" link is actually built-in "exception message" from Adonis.js frameworks & the errors has nothing to do with it. – Fery W Apr 16 '18 at 02:14
  • Maybe I misunderstood your question. You said the `E_MISSING_APP_KEY` error is thrown, and that "more details" link provides info about the `E_MISSING_APP_KEY` error. How is that not relevant? – Sidney Apr 16 '18 at 16:24
  • Edited, apologize about that.. – Fery W Apr 16 '18 at 17:16
  • I see, so you've entered the variables into the CI's settings but adonis can't seem to access the APP_KEY. Is it accessible from `process.env`? – Sidney Apr 16 '18 at 17:57
  • Yes, but as you can see on my first image. `echo "${HOST} ${PORT}"` also not working. – Fery W Apr 17 '18 at 00:35

3 Answers3

35

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

1

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..

Fery W
  • 1,402
  • 1
  • 15
  • 28
0

If you are running the job on tag creation, you have to protect the tag. To do that automatically, you can give it a pattern to Gitlab in order to protect it. If you think anyone should be able to create a tag, then better to unmark the protected option for the variables.

From Gitlab docs:

To protect a tag, you must have at least the Maintainer role.

  1. Go to the project’s Settings > Repository.
  2. From the Tag dropdown list, select the tag you want to protect or

type and select Create wildcard. In the screenshot below, we chose to protect all tags matching v*

Protected tags page

You can protect only giving maintainers permission to create a tag pattern, for instance.

From the Allowed to create dropdown list, select users with permission to create matching tags, and select Protect

Maicon Mauricio
  • 2,052
  • 1
  • 13
  • 29