Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis not accumulating build exit codes

Tags:

travis-ci

I have the following .travis.yml:

sudo: required
language: node_js
branches:
  only:
    - master
before_install:
  - curl https://install.meteor.com | /bin/sh
  - npm install standard -g
script:
  - standard
  - sh run_tests.sh
  - '[ "${TRAVIS_PULL_REQUEST}" != "false" ] && bash check_for_new_version_number.bash'
  - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && printf $LI | meteor login && meteor publish || exit 0'

If any of the build commands fail (exit code != 0) the build still is marked as a success, as the last command exists with 0. If I change the last command to exit with 1, the build does fail.

According to http://docs.travis-ci.com/user/customizing-the-build/#Customizing-the-Build-Step, this exit codes should accumulate and the build should fail if any fail. What am I missing?

Thanks!

like image 919
Tomas Romero Avatar asked Nov 10 '22 08:11

Tomas Romero


1 Answers

The problem here is that Travis takes your travis.yml and basically generates a huge bash script. If you do 'exit 0' that build script is terminated and you loose track of your execution. If you want to ignore the error on the last line I suggest something like this instead:

- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && printf $LI | meteor login && meteor publish || true
like image 74
brujoand Avatar answered Dec 26 '22 22:12

brujoand