Allow users to select which group to approve as
What does this MR do and why?
This MR adds a possibility to select which group to approve for. The update is applicable both in the approval modal on the Environment details page and on the Deployment page.
The approval table is only shown if the user has permissions to approve the deployment. The radio button is shown only for the rules user can approve for. By default, we show the first applicable rule as selected. If the user has already approved/rejected, radio buttons should be disabled and reflect their selection
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
- Approval on the Environments details page
Screen_Recording_2024-04-18_at_21.42.03
- Approval on the Deployment page
Screen_Recording_2024-04-18_at_21.42.54
- Rejection on the Deployment page
Screen_Recording_2024-04-18_at_21.43.51
How to set up and validate locally
- make sure you have EE version of gitlab enabled
- create a project and add the following
.gitlab-ci.yaml
file
stages:
- deploy
image: alpine:latest
deploy-prod:
stage: deploy
script:
- sleep 10
- echo "deploying prod"
environment:
name: production
url: postgres://example.com
when: manual
deploy-staging:
stage: deploy
script:
- echo "deploying staging"
environment:
name: staging
url: https://example.com
when: manual
- go to Settings -> CI/CD -> Protected environments and protect the production environment (assign at least one more user to approvers so you could test approval logic)
- Run the pipeline to trigger a creation of pending deployment
- Locate your deployment on Deployments -> Environments -> Production, it should be in
waiting
state and there should be approve (👍 ) buttons present - Press the approve button on the deployment in
waiting
state. The approval modal should appear - Select a group to approve/reject for.
- Do note, that you need to refresh the page to see the change in deployment statuses. Page responses to actions will be implemented next as part of #388950 and #388383 (closed)
- Enable the feature flag
deployment_details_page
- Navigate to
http://<gdk-url>/<namespace>/<project>/-/environments/<environment id>/deployments/<deployment iid>
- Select a group to approve/reject for.
Related to #448553 (closed)