Quantcast
Channel: A Portal to a Portal
Viewing all articles
Browse latest Browse all 1850

Further fun with the Jenkins Script "sandbox"

$
0
0

 I'm helping a colleague get to grips with Groovy scripting in Jenkins, and had introduced him to the "Sandbox"

I also wanted to provide some file I/O examples, as per the following: -


File greetingsFile = new File('/tmp/greetings.txt')

greetingsFile.write "Hello World!\n"


greetingsText = greetingsFile.getText('UTF-8')

println("Greeting is " + greetingsText)


All that does is (a) create a file containing the immoral phrase "Hello World!" and (b) read the content of the newly created file into a variable called greetingsText and (c) output the message to the console.



Viewing all articles
Browse latest Browse all 1850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>