Stage with "on: tags: true" runs when no tag for the current commit

https://travis-ci.com/rubencabrera/odoo-docker/builds/144181440

I have a deploy stage set up like:

jobs:
  include:
  [other stages]
  - stage: deploy
    on:
      tags: true
    provider: script
    script:
    - "./.travis/docker_push.bash"
    skip_cleanup: true

This stage was running on commits that didn’t have a tag created by the previous stage. You can see on the link that I changed to using the $TRAVIS_TAG env variable, but it fails. What am I misunderstanding here?

on: is only valid for, and located under, the deploy: clause. And it only sets a condition for a specific deployment in the deploy phase, not for the entire job.

If you need to run an entire job conditionally, use if: as per Conditional Builds, Stages and Jobs - Travis CI.

The condition to define a stage is explained in



What you need is:

jobs:
  include:
  - stage: deploy
    if: tag IS present
    # ⋮

Thank you very much, I was carrying this bit from another CI yaml and assumed it worked the same way.

Imprint