Add branch selector for pipeline simulation
What does this MR do and why?
Add branch selector for pipeline simulation
Select branch for which to simulate a pipeline. By default use the branch selected for pipeline configuration.
Changelog: added
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
Screen_Recording_2025-08-18_at_17.20.53
How to set up and validate locally
- Add a basic
.gitlab-ci.ymlfile. Example:
variables:
ALL_JOBS_VAR:
value: "staging"
options:
- "production"
- "staging"
- "canary"
description: "The deployment target. Set to 'staging' by default."
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
on_stop: stop-staging
when: manual
stop-staging:
stage: stop
script:
- echo "stopping staging"
- echo ALL_JOBS_VAR
- echo $ALL_JOBS_VAR
- sleep 60
environment:
name: staging
action: stop
when: manual
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:
- master
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
- Visit Build -> Pipeline Editor and select Validate tab
- Verify the source selector is set to the current branch by default.
- Run the validation and verify the current branch was used as a
reffor theci_lintmutation. - Select a different branch and run validation. Verify the correct branch is used as a
reffor theci_lintmutation.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #482676 (closed)
Edited by Anna Vovchenko

