Skip to content

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

  1. Approval on the Environments details page

Screen_Recording_2024-04-18_at_21.42.03

  1. Approval on the Deployment page

Screen_Recording_2024-04-18_at_21.42.54

  1. Rejection on the Deployment page

Screen_Recording_2024-04-18_at_21.43.51

How to set up and validate locally

  1. make sure you have EE version of gitlab enabled
  2. 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
  1. 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)
  2. Screenshot_2023-04-12_at_12.29.47
  3. Run the pipeline to trigger a creation of pending deployment
  4. Locate your deployment on Deployments -> Environments -> Production, it should be in waiting state and there should be approve (👍 ) buttons present Screenshot_2023-04-12_at_17.29.59
  5. Press the approve button on the deployment in waiting state. The approval modal should appear
  6. Select a group to approve/reject for.
  7. 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)
  8. Enable the feature flag deployment_details_page
  9. Navigate to http://<gdk-url>/<namespace>/<project>/-/environments/<environment id>/deployments/<deployment iid>
  10. Select a group to approve/reject for.

Related to #448553 (closed)

Edited by Anna Vovchenko

Merge request reports