How to print to console in Travis CI

Viewed 5158

I'm trying to print some information using echo in my .travis.yml file, but I don't see anything in the log.

My .travis.yml file:

before_install:
  - echo $TRAVIS_COMMIT
  - echo $TRAVIS_TAG
  - echo $TRAVIS_BRANCH
  - echo $TRAVIS_BUILD_NUMBER
  - echo $TRAVIS_REPO_SLUG

My output:

enter image description here

2 Answers

Travis CI collapses the output for each phase except for the script phase.

If you print to the console with echo in the script phase, your output will be displayed.

If you print to the console in any other phase, you will need to expand the output for that phase to see your content.


Using this .travis.yml config:

script:
  - echo $TRAVIS_COMMIT
  - echo $TRAVIS_TAG
  - echo $TRAVIS_BRANCH
  - echo $TRAVIS_BUILD_NUMBER
  - echo $TRAVIS_REPO_SLUG

Yields this output:

enter image description here

Related