2

My Jenkins (1.539 on RHEL) job, named "Parent-Job", is configured to "Trigger/call builds on other projects"; the project triggered is named "Child-Job".

Jenkins "console output" shows the proper output (plain text with HTML links to the Child-Job that was triggered), as shown below:

Console Output

Started by user Rodin, A
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/test/build/jendev_home/jobs/Parent-Job/workspace
No emails were triggered.
Waiting for the completion of Child-Job
Child-Job #44 completed. Result was SUCCESS
...

But in the "log" file in the build directory, the links that were present in the console output are all encoded, and I am unable to parse these links because the encoded text does not match expected value, as shown below:

Building on master in workspace /var/test/...
No emails were triggered.
Waiting for the completion of ESC[8mha:A..._very_long_encoded_value_...9M1g0N0AcApv0yfqQAAAA=ESC[0mChild-Job
...

How can I extract the text of the console output, exactly in the same plain text/html format as is displayed on the Jenkins console?

I need to email the log to various users, and long encoded links in the attachment will make them overlook other important details in the log file.

zgsh
  • 23
  • 5

1 Answers1

2

You can get the console output with the wget command (in a post build step script):

wget -O my_console.log ${BUILD_URL}consoleText
Bruno Lavit
  • 10,184
  • 2
  • 32
  • 38
  • **Thanks! This worked.** Had to tweak it a little for the authentication etc. but in the end, the fact that the consoleText can directly be fetched using wget really helped! – zgsh May 21 '15 at 19:37