Make environment pin work with GraphQL
What does this MR do and why?
The new environments page is built using local GraphQL state management, and so the ability to cancel the auto-stopping of environments needs to rely on it instead of the event hub.
To ensure everything still works until I am ready to delete the old environments page, the new opt-in graphql prop is added to enable this functionality.
Screenshots or screen recordings
No visual changes
How to set up and validate locally
- Make sure to turn on the
new_environments_table
feature flag. On the GitLab repository, run:
cd ./bin
./rails console
Feature.enable(:new_environments_table) //turns on the feature flag
Feature.disable(:new_environments_table) //turns off the feature flag, takes some time to kick in
- Enable runners in your GDK/Gitpod -- see instructions
- Then add the following
.gitlab-ci.yml
to a project for some deployments:
stages:
- deploy
- stop
image: alpine:latest
deploy-prod:
stage: deploy
script:
- sleep 6000
- 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
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
Make an MR, run a pipeline for it, and check out the environments page!
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Andrew Fontaine