Branch filtering is not working properly


#1

I have a .circleci/config.yml file with some jobs ignoring some specific branches:

Notice how I’m ignoring branches called l10n_. These branches are ignored because they are created automatically by Crowdin, which sends a new commit for each change in any language and that pollutes our CI. Note that the jobs being ignored are the first ones of the workflow, so if those don’t get executed the rest of the workflow isn’t going to be either.

But I have a lot of builds from PR https://github.com/decidim/decidim/pull/3369, which merges commits from a branch called l10n_0.11-stable into 0.11-stable. I’ve checked it and the PR is up to date with the base branch, so it has the config where the branch should be ignored.

I’ve tried ignoring branches by full name, (eg l10n_0.11-stable, without wildcards), and that works as expected, but when I use a wildcard it stops working.

Maybe it’s because I’m using dots and dashes in my branch name and the wildcard fails to find it? Or am I missing something else?

Can someone help me here please?

Thanks!


Branch filtering ignore
#2

Update: on a branch called l10n_master, the wildcard isn’t working either, so I’m having the workflows being scheduled :confused:


#3

Also note that this is due to not having the autocancel for workflows, which has been asked for a long time now :disappointed:

https://circleci.ideas.aha.io/ideas/CCI-I-194


#4

Try changing the filter from l10n_* to /^l10n_*/ and making sure this is in the default branch and parent branch of those autogenerated PRs.


#5

Argh, of course!

Thank you very much!


#6

To mark things as solved in Discourse, you don’t need to edit the title - there’s a proper acceptance system. See the toolbar under Feliciano’s answer? Next to the “like” and “link” buttons there is a “solved” button - tick that and the system will properly mark the thread as solved.


#7

@halfer thanks! I’ll do that!

@FelicianoTech I’m checking it and it doesn’t seem to be working actually :confused:

See this PR: https://github.com/decidim/decidim/pull/3408 if you open any commit from it, and browse the files, and visit the CircleCI config file, I’m using /^l10n_*/ as suggested previously, but I still see builds for those commits. Eg the first commit of that PR is fdb9dbc:

The config file for that commit:

The build in CircleCI:

https://circleci.com/workflow-run/bee53f81-dbb1-485c-a641-5e590f2780eb

Any idea of what might be happening here?

Thanks!


#8

I believe you can’t use a YAML list when trying to use regex. So for example, instead of doing this:

- build_design_app:
    filters:
      branches:
        ignore:
          - /^l10n_*/

try

- build_design_app:
    filters:
      branches:
        ignore: /^l10n_*/

#9

@FelicianoTech I’ll try it, but in this example you show how to use a regexp both as part of a list and as a single value:

https://circleci.com/docs/2.0/workflows/#branch-level-job-execution


#10

True. Let me know if that works, I would like to clarify how this is suppose to work and/or if there’s a bug we’re not aware of.


#11

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.