Pipeline is triggered when it shouldn't

We recently started to use self-hosted gitlab-ce and have created our first pipeline to build and deploy some docker-contaners.

As we have a monorepository with lots of dependent subprojects and this pipeline should be triggered only on changes in spicific path in master we have addded appropriate lines to gitlab-ci.yml:

[...]
only:
        refs:
            - master
        changes:
            - "trunk/source/Garnet/**/*"
[...]

So we thought pipeline should be triggered only if changes were made to trunk/source/Garnet/**/* and only in master.

But it’s trigger on any feature branch or every merge request on master even if those changes are not related to that specific project. And it’s always fails becasue we have configured “needs” to speed-up (running manually goes fine).

Are we misspointed something?

All the branches you have highlighted have an invalid yaml file - so that’s the problem, they are not using the rules you have written :slight_smile:

Thanks for reply.

according to gitlab pipeline configuration reference, they higlighted as invalid yaml because of “needs” directive in jobs config, so this is normal behaviour. But we want the pipeline to not be triggered by those branches at all.

We have tried to add “except” rules, so now it looks like:

[...]
only:
        refs:
            - master
        changes:
            - "trunk/source/Garnet/**/*"
except:
        - branches
        - tags
        - merge_requests
[...]

but it doesn’t seem helped. Actually it did exactly opposite: now pipeline is triggered on everything except the changes on trunk/source/Garnet/**/*

So now i’m totally confused

it would be great if you could guide me on the right path

Thanks

Is it possible that you’re updating the .gitlab-ci.yml on the master branch and not on the other branches? If that’s the case all those other branches still have the outdated ci file and that’s why they’re still being run.

What I would suggest is creating a new branch (from master I guess), update the .gitlab-ci.yml accordingly and then merge that branch to all other branches.

Thank you so much! This was exactly the issue.

Can’t believe that i missed such obvious thing

I decided to move my *.yml to a separate repo and now it works fine