Don't automatically run a deployment job post approval when using Unified Approval Setting

Problem

The current behavior of unified approval setting is to automatically execute a deployment job after approval.

However, this is not always desired. Some customers set deployment jobs to manual, even with approvals, they do not want the job to run automatically.

Proposal

  • Remove the hard-coded auto-execution logic. Like Multi Approval Rules, it just unblocks the deployment job after sufficient approvals have been collected. So that deployment executors can execute the job later at a preferred moment.
  • When the last approver comes to approve and has permission to execute the deployment, they see two approval options: Approve and Approve and Deploy.
  • When users click Approve, the deployment will not run. The deployment job stays as manual.
  • 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.
Screenshot
Screen_Shot_2022-10-06_at_11.51.29_AM

Technical details

  • Frontend can perform GraphQL query for fetching the job execution permission - deployment.job.userPermissions.updateBuild.
  • Frontend can perform GraphQL mutation for executing the job - Mutations::Ci::Job::Play. Alternatively, we should introduce a new mutation in the DeploymentType.
  • It's preferred to use a feature flag for gradually rolling out the change.
  • There are two places that show the deploy approval model - one is in Environment Index page, another is in Environment Details page. We update both.

Future Proposal (if needed)

Future Proposal (if needed)
  • Add a setting to the protected environments page that allows users to customize whether they would like deployments to automatically run after a final approval.
  • If users select not to automatically run, give a third CTA to the approval modal that lets them choose to either Approve or Approve and Deploy.
  • If users select to automatically run, change main CTA of the last approver to Approve and Deploy so they understand by clicking approve a deployment will also happen.
Proposed UX Flow
Screen_Shot_2022-10-04_at_11.07.45_AM
New Settings Page New Modal (When deployments are not automatic)
Screen_Shot_2022-10-04_at_11.11.36_AM Screen_Shot_2022-10-05_at_2.51.24_PM

Workaround

Switch to Multiple approval rules. This configuration doesn't automatically run deployment jobs and will supersede Unified Approval Setting. #357798 (closed)

Edited by Shinya Maeda