Approving a deployment puts it in a hidden state
Summary
When approving a deployment, the state is changed to one not displayed by the UI. It is impossible to find until the job is run manually.
Steps to reproduce
Set up a simple environment deployment pipeline:
stages:
- deploy
- stop
image: alpine:latest
deploy-prod:
stage: deploy
script:
- sleep 10
- echo "deploying prod"
environment:
name: production
url: postgres://example.com
deploy-staging:
stage: deploy
script:
- echo "deploying staging I hope"
environment:
name: staging
url: https://example.com
deploy-development:
stage: deploy
script:
- echo "deploying development"
environment:
name: development
url: https://example.com
when: manual
deploy-review:
stage: deploy
script:
- echo "Deploying review/$CI_COMMIT_REF_NAME"
environment:
name: review/$CI_COMMIT_REF_NAME
auto_stop_in: 1 week
only:
- branches
except:
- main
when: manual
stop_review_app:
script: stop-review-app
stage: stop
environment:
name: review/$CI_COMMIT_REF_SLUG
action: stop
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- Run the pipeline to create environments
- Protect one of the environments with multiple approval rules (either via
- the API or :multiple_approval_rules_fe feature flag enabled)
- Run a pipeline, now a deployment should be pending approval.
- Approve the deployment
- Refresh the page
What is the current bug behavior?
A different, previous deployment is shown in the "Upcoming deployment" block, the approved deployment is hidden from the environment details page.
What is the expected correct behavior?
The deployment is shown, maybe with a "start job" button?
Relevant logs and/or screenshots
Screen_Recording_2023-03-10_at_1.37.57_PM
Screen_Recording_2023-03-10_at_1.39.27_PM
Possible fixes
Fully approved deployments that are in the blocked
state should be shown both in the environments page and environment details page.
Implementation guide
Environment details page
solved by the rollout of #384914 (closed)
Environments page
The Environments page still uses the EnvironmentsController
instead of the Environments GraphQL API. The upcoming_deployments
for each environment are gathered in the EnvironmentEntity serializer.
The Environment.upcoming_deployment
query should be changed to include created
deployments. To do so, update the Deployment.upcoming
scope to use Deployment::UPCOMING_STATUSES
to make sure that all the upcoming statuses are included.