# GitLab CI environment variables

**URL:** https://discourse.julialang.org/t/gitlab-ci-environment-variables/36150
**Category:** New to Julia
**Created:** [March 18, 2020, 4:23pm UTC](https://discourse.julialang.org/t/gitlab-ci-environment-variables/36150 "2020-03-18T16:23:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)
#### Post date: [March 18, 2020, 4:23pm UTC](https://discourse.julialang.org/t/gitlab-ci-environment-variables/36150/1 "2020-03-18T16:23:58Z")

</div>

I want to setup a CI/CD pipeline in GitLab.  
In my testscript I need a _password_ and a _username_ that I don’t want to have in the repo.  
Is it possible to use the [GitLab environment variables](https://docs.gitlab.com/ee/ci/variables/) to pass this to the script?

My idea is that I would access the GitLab environment variables and pass them to the Julia environment variables.

```julia
- echo $USERNAME
- julia --project=@. -e 'import Pkg;
            ENV["USERNAME"] = "$USERNAME";
            ENV["PASSWORD"] = "$PASSWORD";
            Pkg.test(; coverage = true);'

```

The `echo` works but I’m not able to use the variable in the Julia code.  
I get the Julia error:

> ERROR: UndefVarError: USERNAME not define

Thanks!

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [March 18, 2020, 4:29pm UTC](https://discourse.julialang.org/t/gitlab-ci-environment-variables/36150/2 "2020-03-18T16:29:03Z")

</div>

If you `export` the variables in the shell you don’t need to set them in the Julia process. Your julia call fails because the command is single-quoted, which prevents shell variable interpolation, and `"$USERNAME"` does interpolation of the Julia variable `USERNAME` which is not set.

---

<div class="post-metadata">

### Author: ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)
#### Post date: [March 18, 2020, 4:34pm UTC](https://discourse.julialang.org/t/gitlab-ci-environment-variables/36150/3 "2020-03-18T16:34:18Z")

</div>

Thank you!  
I see; the GitLab CI variables can be directly accessed via `ENV["USERNAME"]` and `ENV["PASSWORD"]`.
