Expose "Draft:" status as $CI_ variable in pipeline builds linked to MRs
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Workaround
If you want to include or exclude jobs in case the pipeline is draft you can add the following rule to a job
rules:
- if: $CI_MERGE_REQUEST_TITLE !~ /^WIP.*$/ # or Draft
Release notes
Expose "Draft:" status as $CI_
style variable in pipeline builds when they are linked to merge requests
Problem to solve
When pushing change sets to a Gitlab merge request that have a resulting pipeline, I want to run tests in a tiered manner based on the status of the feature change. For instance, in draft mode, I may want to run a subset of tests to ensure major issues are covered, but not run the full suite of tests until the MR is set to the "ready" state.
Proposal
Expose the "Draft:" status as a pre-defined variable, such as $CI_DRAFT_STATUS
. This would be similar to $CI_MERGE_REQUEST_PROJECT_URL
in that it is only available in merge request pipelines. The value could be true/false
or some enumeration value like draft
that allows for future overloading of other "draft"-like states that are not yet defined.
feature ~"Category::Verify"
Intended users
Who will use this feature? If known, include any of the following: types of users (e.g. Developer), personas, or specific company roles (e.g. Release Manager). It's okay to write "Unknown" and fill this field in later.
Personas are described at https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/
- Delaney (Development Team Lead)
- Sasha (Software Developer)
- Devon (DevOps Engineer)
- Simone (Software Engineer in Test)
User experience goal
The user should be able to run test subsets according to the draft state of the merge request to increase development velocity and reduce resource use during implementation, while still having the ability to run full/different test sets when the MR is ready for merge.
Documentation
Need documentation for:
- Predefined variables page
- Page describing
rules
and other appropriate sections of the.gitlab-ci.yml
file.