0

Can we configure the jenkins editable email notification default content that calls the groovy script from a particular server instead of jenkins master.

I have my groovy script in my dev server and i have added this server name in the jenkins configuration label expression. But still i believe its trying to find out the groovy from master . When i build i get the below content in email.

Groovy template file was not found in $JENKINS_HOME/email-templates.

Any suggestion - how can i have the email content filled from my dev server groovy script?

user1706047
  • 369
  • 3
  • 7
  • 19

1 Answers1

0

You are correct it only ever gets the templates from the master there is no way round this.

David van Laatum
  • 634
  • 4
  • 13
  • Thanks..I was trying an alternative approach to call the template script from Execute shell and assign that to a variable. Then refer that variable in email-content. But there also i see the variable is empty. So it means i can only call the template from master. – user1706047 Oct 24 '17 at 01:30
  • shell variables do not propagate back up to jenkins variables. Take a look at pipelines they allow you to grab file contents or outputs from commands which you can then feed into the email body – David van Laatum Oct 24 '17 at 01:33
  • I tried adding these lines in execute shell as def email_content = ${SCRIPT, template="email template name.groovy"}..but it populates as empty..As i m new to jenkin and groovy, can you pls suggest if i m missing any syntax here.. – user1706047 Oct 24 '17 at 14:45
  • It will not work in a shell step as that executes via a unix shell ie bash which is not jenkins – David van Laatum Oct 25 '17 at 10:09