'if: tag IS present' does not work

Hi,

We have following configuration:

...
if: tag IS present

You can see here that Travis build did NOT kick in (even though the last commit is tagged AND on branch master - but I am only checking for tag).

If I trigger the build manually, I am always getting:

Skipped as per condition: IF tag IS present

It does not make much sense to me. What am I doing wrong?
Thanks a lot,

christian

Hey @ribose,

First is this still happening?

Please be sure to check all occurrences of branch filters in your .travis.yml file. Usually, you can have a root branch and a deploy provider.

In general, Travis differentiates between builds initiated by pushing a commit or pull request and builds initiated by pushing a tag.

So what this means is, when you’re pushing a commit with a tag, this will trigger two builds with different conditions, (if you only filter your branch names, the build for the tag won’t get triggered).

This is essentially a safeguard for any other branch to avoid publishing the same files multiple times. The released tag will show under active branches in Travis, and its build will trigger.

2 Likes

thanks @montana this has happened to me before, good explanation overall

Good morning @Montana,

Thanks a lot for taking the time and your detailed answer.

Unfortunately, it is still happening. I was able to manually trigger the build by overwriting the if condition in a custom build:

if: true

I do not filter in any way by branch name. The only condition I have in my .travis.yml file, is the one described above.

Would:

branches:
  only:
    - /^\d+\.\d+\.\d+$/

better work? Instead of my if condition which does NOT work…

No, does not work neither.

Have you tried using a compound build condition? Something like:

if: branch = master OR tag IS present

If I correctly understand your example (kindly correct me if I am wrong), it means: build whether master branch or whether the branch (any) is tagged. Or, in my case, master branch (for a couple of minutes until auto-tagging kicks in) could be untagged.

In such cases, I do not want to build. Only when master branch is tagged. So I could try if: master AND tag IS present. But this will not work as, up to my understanding, you will never have both conditions full-filled (see this post).

Do we have a bug here?

Imprint