Allow "Approve & Deploy" when all approval conditions for a protected environment are met
Proposal
When a deployment is approved it still has to be manually initiated afterwards, even if there are no remaining approvals to be given. While this is the desired behavior for some users ("I agree that this is okay to deploy, but that doesn't mean I also want to deploy it right now"), some do not want this extra step ("Why is this not automatically deploying even though I just said it is okay to deploy?") in the process.
To meet both these use cases, a "Approve & Deploy" option as depicted in Don't automatically run a deployment job post a... (#367943 - closed) would be ueful. Copying over the description from there:
- When the last approver comes to approve and has permission to execute the deployment, they see two approval options:
ApproveandApprove and Deploy.- When users click
Approve, the deployment will not run. The deployment job stays asmanual.- When users click
Approve and Deploy, the deployment will run.
- Frontend additionally requests to the play job endpoint if the user clicked this button.
- Change the subtext in the modal to: View approval/rejection history for deployment 8. By selecting Approve and Deploy the job will run, by selecting approve the job will wait to be manually run, and rejecting will fail the job.
Additionally, a project level setting could be useful to allow users specifying a default action for the dialog: "Always Approve & Deploy", if set would make "Approve & Deploy" the default button and still offer "Approve" as an option, and vice versa.
The corresponding API endpoint also has to be considered. A new - Instead of a dedicated API, I recommend two API calls as it's already possible and APIs are great to handle multiple calls in a sequence. - added by approve_and_deploy parameter could be used to let users signify which action they want the API request to trigger (if possible).@nagyv-gitlab