Archive March 2017

grep some expression in full logs of multiple jenkins builds

This trick is useful if you don’t have access to jenkins machine.

In following example we will search “my expression” in full logs of builds 10 to 14 of job my-job

read -p "login:" jenkins_login
read -s -p "password:" jenkins_password
for BUILD_ID in {10..14}; do curl -u $jenkins_login:$jenkins_password https://my-jenkins-server/job/my-job/$BUILD_ID/consoleFull | grep "my expression"; echo; done

In one line

read -p "login:" jenkins_login; read -s -p "password:" jenkins_password; for BUILD_ID in {10..14}; do curl -u $jenkins_login:$jenkins_password https://my-jenkins-server/job/my-job/$BUILD_ID/consoleFull | grep "my expression"; echo; done