Protected Environments
Introduced in GitLab Premium 11.3.
Overview
Environments can be used for different reasons:
- Some of them are just for testing.
- Others are for production.
Since deploy jobs can be raised by different users with different roles, it is important that specific environments are “protected” to prevent unauthorized people from affecting them.
By default, a protected environment does one thing: it ensures that only people with the right privileges can deploy to it, thus keeping it safe.
Note:
A GitLab admin is always allowed to use environments, even if they are protected.
To protect, update, or unprotect an environment, you need to have at least Maintainer permissions.
Protecting environments
To protect an environment:
- Navigate to your project’s Settings > CI/CD.
- Expand the Protected Environments section.
- From the Environment dropdown menu, select the environment you want to protect.
- In the Allowed to Deploy dropdown menu, select the role, users, or groups you
want to give deploy access to. Keep in mind that:
- There are two roles to choose from:
- Maintainers: will allow access to all maintainers in the project.
- Developers: will allow access to all maintainers and all developers in the project.
- You can only select groups that are already associated with the project.
- Only users that have at least Developer permission level will appear in the Allowed to Deploy dropdown menu.
- There are two roles to choose from:
- Click the Protect button.
The protected environment will now appear in the list of protected environments.
Modifying and unprotecting environments
Maintainers can:
- Update existing protected environments at any time by changing the access in the Allowed to Deploy dropdown menu.
- Unprotect a protected environment by clicking the Unprotect button for that environment.
Help and feedback
If there's something you don't like about this feature
To propose functionality that GitLab does not yet offer
To further help GitLab in shaping new features
If you didn't find what you were looking for
If you want help with something very specific to your use case, and can use some community support
POST ON GITLAB FORUM
If you have problems setting up or using this feature (depending on your GitLab subscription)
REQUEST SUPPORT
To view all GitLab tiers and features or to upgrade
If you want to try all features available in GitLab.com
If you want to try all features available in GitLab self-managed
If you spot an error or a need for improvement and would like to fix it yourself in a merge request
EDIT THIS PAGE
If you would like to suggest an improvement to this doc