I want that the CI only execute this job if I am on master, merge request, scheduled pipeline OR if the variable COVERAGE_TEST is equal to ON:
c++TestCoverage:
stage: analysis
script: "./ciScripts/testCoverageScript.sh"
tags:
- framework
dependencies:
- c++Build
variables:
GIT_STRATEGY: fetch
artifacts:
paths:
- ./build/test_coverage/
expire_in: 1 week
when: on_success
I tried adding the next lines:
only:
refs:
- master
- merge_requests
- schedule
variables:
- $COVERAGE_TEST == "ON"
But the result is actully -> If ((Master || MergeRequest || ScheduledPipeline) && COVERAGE_TEST == ON)
I also tried with:
only:
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
- $CI_PIPELINE_SOURCE == 'merge_request_event'
- $CI_PIPELINE_SOURCE == 'schedule'
- $COVERAGE_TEST == "TRUE"
but CI_PIPELINE_SOURCE == 'merge_request_event' does not work as I want because If I have the branch in merge request and I push some changes the value of CI_PIPELINE_SOURCE is push
Is there a way to do it?