Gitlabci runs all jobs on a new branch even when it does not meet specified changes

When I create a new feature branch from any branch and push it, regardless of the fact that it has no changes introduced, it runs all jobs by disregarding only.changes conditions.

.gitlab-ci.yml file:

System Proxy:
  stage: trigger
  script:
    - echo 'run me'
  only:
    changes:
      - playbooks/system_proxy.yml
      - environments/stl/dev/group_vars/system-proxy/*


App Proxy:
  stage: trigger
  script:
    - echo 'run me'
  only:
    changes:
      - playbooks/app_proxy.yml
      - environments/stl/dev/group_vars/app-proxy/*

Git operations

$ control-repo|feature/CD-04_test⇒ git checkout -b feature/CD-05_test
Switched to a new branch 'feature/PROCD-05_test'

$ control-repo|feature/CD-05_test ⇒ git push origin feature/CD-05_test
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for feature/CD-05_test, visit:
xxxxx
 * [new branch]      feature/CD-05_test -> feature/CD-05_test

This operation of simply creating and pushing the new branch with no changes causes both System Proxy and App Proxy jobs to run.

What am I missing here?

Looks like I found my answer in the Docs:

When pushing a new branch or a new tag to GitLab, the policy always evaluates to true and GitLab will create a job

As per CI/CD YAML syntax reference | GitLab

The only way to fix this by the looks of things is to use merge_requests and changes together.

See CI/CD YAML syntax reference | GitLab

1 Like

Hi Haani,

I work on a team and we tag our project after we had a successful pipeline for master. We’re facing the same issue, however, that tag pipelines are re-running all jobs, even with “only: changes” configured. So we do want to bypass them after they have already run successfully on master, but not necessarily within the context of a merge request.

Is this your case too? If so, how did you work around the issue? How can we have jobs bypassed in tag pipelines without depending on merge requests?

Thanks!
Diogo