Cirrus-ci-docs: `only_if` and `auto_cancellation` don't work with branch named `integration`

Created on 6 May 2020  路  9Comments  路  Source: cirruslabs/cirrus-ci-docs

Expected Behavior

We have the following rules in .cirrus.yml (full source in related info):

# Build the branch if it is integration or ends in -ci/-cic (-cic targets only Cirrus CI)
only_if: $CIRRUS_BRANCH == 'integration' || $CIRRUS_BRANCH =~ '.*-ci$' || $CIRRUS_BRANCH =~ '.*-cic$'

# No auto-cancel on integration
auto_cancellation: $CIRRUS_BRANCH != 'integration'

We expect the integration branch to be tested on Cirrus-CI and not be cancelled when there are new commits.

We use the integration branch to test all commits before they are merged into master.

Real Behavior

However, the integration branch is never tested with these rules. If we comment out only_if the integration branch is tested but gets cancelled by a new commit. If we change the rules to use any other branch name, e.g. testbr then they work as expected. So these rules work as expected for the 'testbr` branch:
```

Build the branch if it is testbr or ends in -ci/-cic (-cic targets only Cirrus CI)

only_if: $CIRRUS_BRANCH == 'testbr' || $CIRRUS_BRANCH =~ '.-ci$' || $CIRRUS_BRANCH =~ '.-cic$'

No auto-cancel on testbr

auto_cancellation: $CIRRUS_BRANCH != 'testbr'
```

Related Info

https://github.com/pgbackrest/pgbackrest/blob/4c6dbe17eaea15b342f03292dd899de335ff2971/.cirrus.yml

bug

All 9 comments

Interesting. I don't believe $s work in only_if statements, but I'm not totally sure. I will take a further look into this out for you.

Their usage is in the documention, e.g. only_if: $BRANCH == "master".

But now I can see this is double-quoted. I wonder if that is the issue? If so, why would it work fine with testbr but not integration? I'll give it a try.

Something really strange is happening here, even when manually trying to trigger a build, it doesn't start. I'm going to try some things that may fix it.

Using double quotes did not change the outcome.

To be completely honest, I'm stumped. I don't know why this isn't working. @fkorotkov might have some insight though once he has free time.

Thanks for looking into it, @RDIL.

This isn't an emergency since we are just integrating Cirrus-CI, but it would be nice to get a fix.

@dwsteele I was able to reproduce it in a unit test so will be able to debug the issue. Will update the issue once I have more information

This should be fixed now. It was a weird bug in expression parses. It was confusing a string starting with in as in operator. 馃槳

I had a feeling it was something along those lines. The integration branch is now building as expected: https://cirrus-ci.com/build/6263694843707392.

Thank you for fixing this so quickly!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotdoom picture dotdoom  路  5Comments

fkorotkov picture fkorotkov  路  4Comments

RDIL picture RDIL  路  4Comments

dbolkensteyn picture dbolkensteyn  路  3Comments

dewyatt picture dewyatt  路  3Comments