firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.28k stars 128 forks source link

Get the variables from gitlab project variables #1206

Open ecourreges-orange opened 5 months ago

ecourreges-orange commented 5 months ago

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

firecow commented 5 months ago

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 commented 4 months ago

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

renne commented 1 month ago

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.