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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With