Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I cat a file on the filesystem from within Jenkins' Groovy

In Jenkins, how do I cat a file that's in my filesystem and not part of any job's workspace?

like image 304
interestedparty333 Avatar asked Sep 07 '25 03:09

interestedparty333


1 Answers

Go to "manage jenkins", then "script console." To cat your file, substitute your file name and path for /var/lib/jenkins/evn.sh in the below code, paste the code into the box, and hit "Run":

def sout = new StringBuffer(), serr = new StringBuffer()
def proc ='cat /var/lib/jenkins/env.sh'.execute()

proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
return sout
like image 198
interestedparty333 Avatar answered Sep 10 '25 04:09

interestedparty333