Bob5421
Bob5421

Reputation: 9173

gitlab-ci does not display environnement variable

I am working with gitlab-ci.

I have set an Environment variable: MY_ENV_VAR (in Project CI/CD Settings menu)

I see a message with says the environnement variable is prefixed by K8S_SECRET_

Here is my .gitlab-ci.yml:

deploy:
  only:
    - prod
  script:
    echo ${K8S_SECRET_MY_ENV_VAR}

It does not display the value in job... I see the echo command in green but i have something blank bellow.

I have tried echo $K8S_SECRET_MY_ENV_VAR or echo $SECRET_MY_ENV_VAR. It is the same.

Thanks

Upvotes: 1

Views: 4218

Answers (1)

slowko
slowko

Reputation: 875

The K8S_SECRET_ prefix is to target variables for the Auto Devops feature. Normal variables need no such prefix, so in your example simply reference $MY_ENV_VAR

Upvotes: 1

Related Questions