Skip to content

Refetch deployments on user interaction

Andrew Fontaine requested to merge afontaine/deployment-refetch-in-mr into master

What does this MR do and why?

Polling for the deployments block is configured for 4 minutes at the longest. While there is work to be done there refining the rate, we can assume that if the user triggers an action, we should refetch the deployments immediately after the request finishes.

This is done via the event hub, as otherwise we need to send a Vue event up too many layers of components.

Changelog: changed

Screenshots or screen recordings

Working on a screencap, but very testable in a review app for now.

How to set up and validate locally

  1. add the following .gitlab-ci.yml to a project for some deployments:
stages:
    - deploy
    - stop
image: alpine:latest

deploy-prod:
    stage: deploy
    script:
        - sleep 60
        - echo "deploying prod"
    environment:
        name: production

deploy-staging:
    stage: deploy
    script:
        - echo "deploying staging"
    environment:
        name: staging
        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
  1. Make an MR
  2. Hit "deploy" under the deployment widget
  3. Watch it change

MR acceptance checklist

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

For #323660 (closed)

Edited by Andrew Fontaine

Merge request reports

Loading