Situation
- self managed v. 15.4
- We are using merge request pipelines, because we need dependency
job.rules.changes
on changes in merge request, not in current push (developer change c++ part and pipeline fail, developer change php part and pipeline succeed, because are tested only php part and c++ not). - We are running nightly regress tests on all branches at night by script in scheduled job.
- If nightly tests failed, merge of branch is not blocked, because script create non merge request pipeline and MR pipeline have priority.
- Api can create merge request pipelines, but can’t define variables - I can’t initiate specific nightly tests
Question
- Is any way, how run pipeline with variables so that the result affects the ability to perform a merge?
It occurred to me to set the project variable before creating the pipeline, but this looks like race-condition and if script crash, all next pipelines do nightly tests… and this would not be good.
Thanks for all the replies
Our workflow is:
workflow:
rules:
# Do not run a new pipelines on external ao3 repository
- if: '$CI_PROJECT_NAME == "ao3-externals"'
when: never
# Always run on default branch
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_BRANCH == "production"'
variables:
ACTION: 'regres_e2e'
# Always run on cbt branch, remove this huge branch after merge to default branch
- if: '$CI_COMMIT_BRANCH == "cbt"'
# Do not run new pipeline when commit is on branch without merge request
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "pipeline"'
- if: '$CI_PIPELINE_SOURCE == "trigger"'
- if: '$CI_PIPELINE_SOURCE == "api"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: '$CI_PIPELINE_SOURCE == "webide"'
# Run pipeline on Merge Requests
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
- if: "$CI_COMMIT_TAG"
- if: "$CI_COMMIT_BRANCH"
Typical job start is:
run_cppcheck_awsl:
stage: test
rules:
- if: '$ACTION == "build_gol"'
changes:
- core/Design/**/*
- ci/docker/cm-compiler/**/*
- ci/docker/cppcheck/**/*
- if: '$ACTION == "regres_e2e"'
- if: '$ACTION == "cppcheck"'
needs:
- build_cppcheck_image