Skip to content

Fix deployments waiting for user actions are marked as "created"

Shinya Maeda requested to merge track-manual-deployments-v2 into master

What does this MR do and why?

This MR fixes Approving a deployment puts it in a hidden state (#395808 - closed) and effectively resolve an issue like Track manual deployments (#373791).

Currently, when a deployment requires user's manual interaction by deployment approvals, the deployment is marked as blocked internal state. This blocked status will transition to created status once it got sufficient approvals, however, this causes awkward UX. It looks like the deployment is happening shortly but actually the deployment is still waiting for user's interaction, meaning a user has to click play button on the pipeline job.

This MR is to make the blocked state more comprehensive and cohesive. When a deployment requires user's manual interaction, not only deployment approvals but also manual execution, these deployments are marked as "waiting" status in the UI. As long as the deployment requires manual action, the state will stays as blocked. This means, even after sufficient deployment approvals were collected, the deployment stays in blocked state instead of transitioning to created state.

Note: This change is behind track_manual_deployments feature flag, which is disabled by default.

Related to !120699 (merged) and !120554 (closed), !97220 (closed), #373791

Screenshots or screen recordings

Manual Deployment Job

Peek_2023-07-10_11-27

Deployment Approval

Peek_2023-07-10_11-31

How to set up and validate locally

Manual Deployment Job

  1. In rails console enable the experiment fully
    Feature.enable(:track_manual_deployments)
  2. Create a project.
  3. Add gitlab-ci.yml to create a pipeline with a manual deployment job:
    deploy:
      script: echo
      environment: prod
      when: manual
  4. Navigate to Operate > Environments (Environment list). Expand the environment details and confirm that the deployment job is shown as a manual and upcoming deployment.
  5. Click the environment name in the page, which brings you to the environment details page. Confirm that the deployment job is shown as an manual and upcoming deployment.

Deployment Approval

  1. In rails console enable the experiment fully
    Feature.enable(:track_manual_deployments)
  2. Create a project.
  3. Add gitlab-ci.yml to create a pipeline with a deployment job:
    deploy:
      script: echo
      environment: prod
  4. Configure deployment approval in the project.
  5. Run a new pipeline. Confirm that the deployment job is waiting for approval in pipeline page or environment details page.
  6. Approve the deployment. You would need to enable Allow self-approval for convenience.
  7. Navigate to Operate > Environments (Environment list). Expand the environment details and confirm that the deployment job is still shown as a manual and upcoming deployment.
  8. Click the environment name in the page, which brings you to the environment details page. Confirm that the deployment job is still shown as an manual and upcoming deployment.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Shinya Maeda

Merge request reports