gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Get the variables from gitlab project variables

Open ecourreges-orange opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. I would like an option for this tool to automatically get and use variables from the gitlab server project and/or group level variables. I am first interested by project level variables: https://docs.gitlab.com/ee/api/project_level_variables.html

Describe the solution you'd like I would like a CLI option like --project-id my_id and/or a project-id setting in one of the dot files, so that I can commit this file safely, and automatically get the variables filled from a call to gitlab API, whose URL can be guessed from the git remote and the project ID.

Describe alternatives you've considered I have to manually create a file in my repo at first use or use --variable every time which is cumbersome

ecourreges-orange avatar May 06 '24 14:05 ecourreges-orange

I'm most likely not going to work on this. We only use project CI/CD variables for holding secrets, that we do not want our developers to get their hands on.

I see the purpose of this feature though.

firecow avatar May 06 '24 17:05 firecow

@ecourreges-orange Keep it open, thats ok. Maybe some other contributor will implement it.

firecow avatar May 08 '24 07:05 firecow

It would be useful to support multiple environments. We, for example, use 3 environments in a Gitlab-CI/CD project:

  1. production environment
  2. staging environment
  3. development environment

This allows us to use variable references for variables which are the same for all 3 environments. The number of CI/CD-variables is reduced drastically by that approach. Pulling the variables of the development environment to laptops of developers would simplify things a lot and keep the variables in sync between Gitlab and local development.

renne avatar Aug 16 '24 11:08 renne

@renne In our case we moved the secrets out of Gitlab into sops files https://github.com/getsops/sops that live in the repo. Every dev has access to the dev sops file while some only to the prod one. We use this command specifically to pass decrypted env vars along to other processes.

ibizaman avatar Apr 10 '25 19:04 ibizaman