CI/CD Environment Variables scope to specific environment Pipeline job
Summary
When defining environment variables in the project settings, the Environment
drop down appears to be exclusively a search and select control. The user cannot see/select the environments that already exist for the project without searching first.
From our perspective I would expect the drop down to contain environments that have already been defined in the .gitlab-ci.yml file at the very least. As we got more familiar with this feature it seems to support wildcard matching so thats been very helpful in allowing us the flexibility to target multiple environments with the same set of environment variables. For example we have the "environments" column set to :
Item 1: coolapp-dev Item 2: coolapp-prod Item 3: coolapp-* Item 4: *
So this has been working for us but I dont think the behavior is very obvious from a UI perspective.
Steps to reproduce
I created environment called test2. in Gitlab Project -> Settings -> CI/CD -> Environment Variables -> Create new variable (API_KEY). Couldn't scope this new variable to a specific environment test2. We need pipelines created for each environment and each environment uses different set of environment variables.
- Gitlab Version: 11.7.0-ee.0.el7
- OS RHEL 7.6 x86_64
What is the current bug behavior?
In the image below, there are 2 environments configured for the project:
... but these environments doesn't appear in Environment Variables
dropdown:
What is the expected correct behavior?
The Environment Variables
dropdown should display the 2 environments configured for the project.
Proposed Solution
- In
settings/ci_cd
, under theVariables
section: - When open, the
Environments scope
dropdown should display a list of all available environments configured in the project.- Environments should be listed alphabetically.
- If applicable, environments should be listed per group.
- Each group should display the respective environments.
- The scope
* (All environments)
should be displayed on the first position of the list.
Note: emptying the search box inside the Environment Scope dropdown initially would go a long ways in making this more discoverable. This would allow the dropdown to show all (well, the first 20) environments right off the bat without the users having to clear the search input first.