I have the following gitlab pipeline:
stages:
- argocd-delete
- argocd-update
update-custom-argocd-with-new-group:
stage: argocd-update
image: alpine:latest
before_script: ...
script: ...
rules:
- changes:
- manifests/customer-resources/*
- when: never
delete-users-from-argocd:
stage: argocd-delete
image: alpine:latest
variables:
CUSTOMER_NAME: ""
GROUP_NAME: ""
before_script: ...
script: ...
rules:
- if: '$CUSTOMER_NAME!="" && $GROUP_NAME!=""'
when: always
- when: never
In case if I commit and there are changes in customer-resources/
job "update-custom-argocd-with-new-group" runs and if there are no changes it is skipped. All as expected. But if I trigger pipeline from Gitlab interface with CUSTOMER_NAME and GROUP_NAME varibles, to trigger "delete-users-from-argocd" job, then the other job is also executed. I do not understend why and how can I force to skip it?
You can add a new rule to force skip it:
update-custom-argocd-with-new-group:
stage: argocd-update
image: alpine:latest
before_script: ...
script: ...
rules:
- changes:
- manifests/customer-resources/*
- if: $CI_PIPELINE_SOURCE == 'web'
when: never
- when: never
As for why it triggers when you run it from the UI, which branch are you selecting? If you are in a working branch, the compare_to
will diff your branch with main
. This could make the pipeline think there were changes to the files and triggering the job.