I have a non-deterministically working Jenkins build step that prints text. It's multi line and has lots of urls in it. It's a python build step.
print("""\
xxxx
yyy
")
It works many times, but not all the times - it messes up the next step when it fails.
I'm not sure how to debug, but maybe I should just add a step that displays the contents of a text file on the console output log. I can't find such a plugin? thank you!
The default location for Jenkins logs on Linux is /var/log/jenkins/jenkins.log. To view the log file, open it using a text editor such as Nano: On Windows, Jenkins log files are stored as jenkins.out (console output logs) and jenkins.err (error logs) in the Jenkins home folder.
In the following Jenkinsfile we have two stages. In the first stage we crete a variable called data that holds some text and the we use the writeFile function to write it out to a file. Then we execute ls as an external program using sh. In the second stage we use the readFile function to read in the content of the file.
Creating a Jenkinsfile, which is checked into source control [ 1] , provides a number of immediate benefits: Single source of truth [ 2] for the Pipeline, which can be viewed and edited by multiple members of the project. Pipeline supports two syntaxes, Declarative (introduced in Pipeline 2.5) and Scripted Pipeline.
If your Jenkins is running on Linux, a simple "Execute Shell" build-step with cat filename.txt will print the file to console If running Windows, an "Execute Windows batch command" build-step with type filename.txt will do the same.
If your Jenkins is running on Linux, a simple "Execute Shell" build-step with cat filename.txt
will print the file to console
If running Windows, an "Execute Windows batch command" build-step with type filename.txt
will do the same.
The filename path is relative to WORKSPACE
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