How to access secondary travis logs

筅森魡賤 提交于 2019-12-24 15:06:07

问题


I know the primary travis build logs are available on the web and with the logs command in the travis command line client, but I was wondering if there is a way to access other files generated as part of the build process, such as the file /home/travis/.rvm/log/1391454748_rbx-2.2.4/rubygems.install.log referenced in https://travis-ci.org/rspec/rspec-its/jobs/18148204


回答1:


Those files are lost once the build is finished. If you want to read them, you should add a cat command to print out to the log you see.

before_script: cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log

If the install command is failing, then you should override install to install the gem for which the installation is failing:

install: gem install XXX || cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log



回答2:


banzaiman's answer is good (it helped me!). But if you use:

install: gem install XXX || cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log

then the cat command will likely succeed, and so the line above will count as as success, and the build will continue. If you want the build to fail when the install fails, then you need to make sure the line has a non-zero exit status. So do something like this:

install: gem install XXX || { cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log && 1; }

The expression in curly braces will be run only if the gem install XXX fails (i.e., has a non-zero exit status). cat will presumably succeed, so the command after the && will be run. That 1 ensures a non-zero exit status for the whole line, causing the build to stop at that point.

Note the necessary whitespace around the curly braces.



来源:https://stackoverflow.com/questions/21538733/how-to-access-secondary-travis-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!