Skip to content

Expose CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED as CI Variable

What does this MR do and why?

This adds the CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED variable, so it can be used as example in the rules of a job to control behaviour based on the protection status from the target branch

Screenshots or screen recordings

image

image

How to set up and validate locally

  1. Checkout branch
  2. Start GDK
  3. Create a pipeline
job:
  script:
    - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - echo $CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED
  rules:
    - if: $CI_MERGE_REQUEST_ID
  1. Create a merge request with some changes to the file against a protected branch
  2. Create a merge request with some changes to the file against a not protected branch

MR acceptance checklist

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

Related to #364774 (closed)

Merge request reports