0

So I have a Multijob Project in Jenkins and I artifact a txt file after the build has been completed, so nothing special really..

I am using the email-ext plugin to send E-mails with the links to the artifacted files. Now I want to extract the [first] line of this particular artifacted .txt File and include it in the E-Mail using a Script, but since I am totally new to the Jenkins Environment, I'd really appreciate some help.

I know that this can be done with Groovy but I am not sure how to begin.

Thanks in advance!

yousafe007
  • 119
  • 1
  • 8

1 Answers1

0

In groovy you can do this to get the first line and then can use this groovy variable in your mail function.

def firstLine  
new File("artifacted.txt").withReader { firstLine = it.readLine() }  
println firstLine  
Pankaj Saini
  • 1,493
  • 8
  • 13