EmilMoe's avatar
Level 10

GitLab CI: Variables not working

I have set up some variables for my CI script at https://gitlab.com///-/settings/ci_cd

Screenshot 2020-03-30 at 12.32.42.png

And I am trying to use them in .gitlab-ci-yml but it is as they are not parsed? If I put the content from the variables directly into the script, it works, but it fails when I refer them:

 $ npm-cli-login -u ${WEBIX_USER} -p ${WEBIX_PASSWORD} -e ${WEBIX_EMAIL} -r http://npm.webix.com -s @xbs
 /usr/lib/node_modules/npm-cli-login/lib/index.js:11
             throw new Error(err);
             ^

I read somewhere that it is intended that the variable name is displayed, but it doesn't change the fact that the login fails – and only when I refer variables, not when I hardcode the values.

0 likes
3 replies
bobbybouwmann's avatar
Level 88

Your command looks correct.

Did you add the variables to a specific project or to your global settings? Also, make sure if you have a fork of the repository that you set the variables there as well!

1 like
EmilMoe's avatar
Level 10

I put them in as global, but I selected protected as I thought that was something to do with secret values. Now I looked into that, and it seems to not be the case, but some kind of protected branch, which I don't think I have set up, so that might be the issue?

Please or to participate in this conversation.