Deployment Approvals API
What does this MR do and why?
Introduce an API endpoint to approve/reject a blocked deployment. Part of the Deployment Approvals MVC.
This API is indirectly behind the deployment_approvals
feature flag. Although the flag is not checked here, we only block deployments if this feature is enabled. See https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/ee/ci/process_build_service.rb#L14.
Related to #343864 (closed)
How to set up and validate locally
- Enable the
deployment_approvals
feature flag.
Feature.enable(:deployment_approvals)
- Set up a project to deploy to an environment. Example job from
.gitlab-ci.yml
:
production:
stage: deploy
script:
- echo done
environment:
name: production
-
Protect the environment being deployed to. See https://docs.gitlab.com/ee/ci/environments/protected_environments.html#protecting-environments.
-
Add some required approvals to the protected environment that was just created:
ProtectedEnvironment.last.update(required_approval_count: 1)
-
Start a pipeline. The
production
job should be in ablocked
state. -
Use the Deployment Approvals API to approve the deployment as a different user that has permission to deploy. See the documentation changes in this MR for details on endpoint and parameters.
-
Verify that the
production
job has started.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Merge request reports
Activity
added grouprelease [DEPRECATED] label
assigned to @ali-gitlab
mentioned in issue #343864 (closed)
- A deleted user
added backend label
2 Messages CHANGELOG missing: If you want to create a changelog entry for GitLab FOSS, add the
Changelog
trailer to the commit message you want to add to the changelog.If you want to create a changelog entry for GitLab EE, also add the
EE: true
trailer to your commit message.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge. Documentation review
The following files require a review from a technical writer:
doc/api/deployments.md
The review does not need to block merging this merge request. See the:
-
Metadata for the
*.md
files that you've changed. The first few lines of each*.md
file identify the stage and group most closely associated with your docs change. - The Technical Writer assigned for that stage and group.
- Documentation workflows for information on when to assign a merge request for review.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Reuben Pereira ( @rpereira2
) (UTC+5.5, 10.5 hours ahead of@ali-gitlab
)Doug Stull ( @dstull
) (UTC-5, same timezone as@ali-gitlab
)To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerSetting label(s) ~"devops::release" sectionops based on ~"group::release".
added devopsrelease [DEPRECATED] sectionops labels
added typefeature label
changed milestone to %14.7
- A deleted user
added documentation label
mentioned in merge request !75710 (merged)
added 1383 commits
-
9b71dc12...98f7acc2 - 1382 commits from branch
master
- c0b35054 - Add Deployment Approvals API endpoint
-
9b71dc12...98f7acc2 - 1382 commits from branch
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
- Resolved by Shinya Maeda
@bala.kumar can you please review this? Thanks!
requested review from @bala.kumar
requested review from @acook.gitlab and removed review request for @bala.kumar
@acook.gitlab
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
requested review from @shinya.maeda and removed review request for @acook.gitlab
added 910 commits
-
cccd0eb1...3b90b273 - 909 commits from branch
master
- bf50f379 - Add Deployment Approvals API endpoint
-
cccd0eb1...3b90b273 - 909 commits from branch
- Resolved by Shinya Maeda
- Resolved by Shinya Maeda
- Resolved by Shinya Maeda
requested review from @rdickenson and removed review request for @shinya.maeda
added Technical Writing docsfeature labels
added tw-weight1 label
requested review from @shinya.maeda