Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Jenkins "Console Output" after triggering build remotely?

Tags:

jenkins

perl

I am using a Perl script to trigger a build in Jenkins using LWP modules. This works but after executing the job, I would like to parse the console output.

Is there someway to get this?

like image 861
dr.jekyllandme Avatar asked Jun 12 '14 03:06

dr.jekyllandme


People also ask

Where is Jenkins console output?

View the console output:From the Jenkins dashboard, click the job link name from the table. Click the build number in the Build History table in the sidebar. If you need to send the console output to Perforce Support, send it as plain text. Click View as plain text in the sidebar menu.

How can we get the Jenkins console output in a text file?

In order to read the console output in Jenkins, All you need to do is copy and paste the code as a stage in your pipeline script. After the build is run, a file named buildConsolelog. txt will be stored in the home directory of your project.

How do you call a Jenkins build from outside Jenkins?

Install Generic Webhook Trigger plugin. Select generic webhook trigger in build trigger actions. Generate a random string and paste in token. Now your job can be triggered with a http request to the following url.


1 Answers

Log into Jenkins and take a look at the bottom of the webpage near the right hand side and click on the REST API link. This will give you information about the Jenkins RESTful API which is a great way to pull information off of Jenkins once you understand how to construct the URL.

And, here's how you get the console text:

$ curl "${JENKINS_URL}/job/${JOB_NAME}/lastBuild/consoleText" 

You can use Perl's various LWP modules to talk to Jenkins.

like image 185
David W. Avatar answered Sep 18 '22 19:09

David W.