Add environments as selector for repository "compare" page
Problem to Solve
Environments are an important kind of object in GitLab, and the state of an environment can be correlated with a git SHA that matches the last deployment done to that environment. This information is already known in the system - where we can expand functionality is by offering comparison between environments. This is useful in many scenarios, but the prototypical are as follows:
- Compare the state of your performance environment vs. your production environment to ensure they are a match and that testing that's happening in the performance arena is valid.
- Compare your staging environment to production to ensure that it contains only expected changes.
- Compare two environments to each other to determine root cause for why something is not working.
- Compare environment to a branch to see what changes will happen if you were to deploy there
- This would allow us to see how far behind a certain environment is compared to a branch, and similarly how far ahead a certain branch is to an environment.
An environment stores the commit SHA which was used and that commit can be used to compare against different branches. When using the Compare dropdown, it would skip a few steps (manually looking up SHAs) if the Environments could be use used in the "from" or "to".
Allow the use of Environment names on the Repository/Compare page in the "from" and "to" dropdowns.
Links / references
See the below page in the docs for CI regarding the ability to checkout deployments based on the Environment name. These references could be used on the Compare page as well.
Why should someone use it; what's the underlying problem.
Wanting to compare your current branch against what is deployed to a current environment, you first need to go to the environment page and copy the SHA, go to the Compare page and paste that SHA in rather than being able to use the Environment name directly
What is the solution.
Allow the use of the Environment name in the Repository/Compare dropdowns which will use the latest commit hash deployed to that environment
How does someone use this
When opening the dropdowns on the Repository/Compare page, you can start typing the names of an environment and it will auto fill based on your currently defined Environments.
On compare page
- Take latest commit ref of Environment, compare that commit with another branch/environment/tag
- Order sections in dropdown alphabetically: branch/environment/tag