Skip to content

Backend: CI_DEPLOY_* variables not set if gitlab-deploy-token is defined in group settings

Summary

As described here, you could add a special deploy token, which would be exposed as environment variables in a CI job. Doing so in a project works fine, but I need this deploy token to be valid for all projects in this group. So I added a group deploy token with the same name. Unfortunately after this change the CI_DEPLOY_USER and CI_DEPLOY_PASSWORD variables are undefined in the CI job.

Steps to reproduce

  • Add a group deploy token with name 'gitlab-deploy-token'
  • Run a CI pipeline in a project within this group.

Workaround

  1. Created a deploy token in group level named gitlab-deploy-token
  2. Set group level environment variables CI_DEPLOY_USER and CI_DEPLOY_PASSWORD to gitlab-deploy-token and the value thereof, respectively.

Proposal

  1. Either provide the values automatically
  2. or add the workaround in the documentation

Example Project

Example project: https://gitlab.com/justinvtime-test/test

Build with the project deploy token defined: https://gitlab.com/justinvtime-test/test/-/jobs/505669965

Build with the group deploy token defined: https://gitlab.com/justinvtime-test/test/-/jobs/505668102

What is the current bug behavior?

the CI_DEPLOY_USER and CI_DEPLOY_PASSWORD variables are undefined in the CI job

What is the expected correct behavior?

the CI_DEPLOY_USER and CI_DEPLOY_PASSWORD variables are defined in the CI job

Edited by Mark Nuzzo