Hi community
I have a pipeline that I had developed on a standalone instance, and over there the execution is done every time, as expected. The rules work as expected. But, when I copy the EXACT same pipeline file to a GitLab premium instance, the pipeline just won’t execute when I commit to the feature branch. So far, the only difference I can come up with, is the fact that the premium setup contains Approval rules, but even if I disable all of them, my pipeline still does not work the way I want it to.
stages:
- dryrun
- test-topology
- apply-topology
# Job1
dry-run-julieops-on-kafka-tst:
stage: dryrun
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "test"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED == 'false'
script:
- echo "DryRun from JO on kafka-tst"
# Job2
dry-run-julieops-on-kafka-prd:
stage: dryrun
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "production"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED == 'false'
script:
- echo "DryRun from JO on kafka-prd"
# Job 3
current-commit-against-test-topology:
stage: test-topology
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED == 'false'
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "test"
script:
- echo "Run current commit on docker instance with test topology"
# Job 4
current-commit-against-prod-topology:
stage: test-topology
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "production"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED == 'false'
script:
- echo "Run current commit on docker instance with prod topology"
# Job 5
apply-julieops-on-kafka-tst:
stage: apply-topology
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "test" && $CI_MERGE_REQUEST_APPROVED == 'true'
script:
- echo "Run current commit on kafka-tst environment"
# Job 6
apply-julieops-on-kafka-prd:
stage: apply-topology
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "production" && $CI_MERGE_REQUEST_APPROVED == 'true'
script:
- echo "Run current commit on kafka-prd environment"
I have 3 protected branches: main, test
and production
My workflow at the moment is:
Create an issue and immediately create a branch + MR. Push code to this branch and then jobs 1,2,3 and 4 need to kick off. When the feature branch is merged to main, nothing should happen. At this point all testing should have been done and there is no need for another test.
Next step is merge from main
to test
. A new MR is created. At this point, jobs 1,3 & 5 needs to execute. When all testing is done, a new MR is created to merge from test
to production
. At this point I want jobs 2,4 & 6 to execute.
In my test instance this works great. In the production instance where we have a premium account, nothing happens when I push code to my Feature Branch. But the moment I merge from main
to test
all happens as expected.
The approval rules settings are as follows:
So what am I missing here? Why is nothing triggered when I commit to feature branch? And more importantly, why is my standalone working but premium not? Any ideas which settings in Premium can cause a ‘block’ for this pipeline to run during a commit to feature branch?
Thanks for any help in advance.