0

I am currently looking for ways to obtain all job log files(such as https://api.travis-ci.org/v3/job/6073028/log.txt) from public repositories (such as apache/commons-math) in Travis CI using Travis CI API.

I would like to know if it is possible, and how to do it.

1 Answers1

0

You can create a script and inside it make an API call , such as :

get-logs.sh

echo "Getting logs job from ${TRAVIS_JOB_ID}"

REQUEST_RESULT=$(curl -s -X GET \
-H "Travis-API-Version: 3" \
-H "Accept: text/plain" \
-H "Authorization: token ${TOKEN}" \
https://api.travis-ci.org/api/job/${TRAVIS_JOB_ID}/log)

echo " * request result:"
echo "${REQUEST_RESULT}"

then call the script later: sh get-logs.sh > travisLogs.log

${TOKEN} is the token you have for your travis repository. https://blog.travis-ci.com/2013-01-28-token-token-token

${TRAVIS_JOB_ID} the id of the job, this is a travis variable too, so if this is inside a .travis.yml it will get the current job Id.

Ref: https://developer.travis-ci.org/resource/log#Log

dotch3
  • 11
  • 2