Alka Sharma
Alka Sharma

Reputation: 1

pass shell script output to jenkins environment variable

I have a requirement where we have to call a shell script present on remote linux server and then its output which is a text msg need to be stored in jenkins environment variable and then that environment variable value shall by displayed tin the email sent in post build step of jenkins job. below is the command I am using in 'Execute shell script on remote host using ssh' section : sudo su - aem -c /xyz/author_start.sh > env.script_result

Please let me know in case more details needed on the issue.

Upvotes: 0

Views: 631

Answers (1)

PCastedo
PCastedo

Reputation: 74

You should check out this plugin https://plugins.jenkins.io/lambdatest-automation/ it allows you to save values in environment variables, there's more info here: https://www.lambdatest.com/blog/set-jenkins-pipeline-environment-variables-list/

Basically you should execute the shell script and save the result with this plugin, later on and if your configuration of jenkins you can just add to that e-mail whatever you want including environment variables.

If you want more info about e-mail sending with jenkins this is also a nice tutorial step-by-step: https://medium.com/@gustavo.guss/jenkins-sending-email-on-post-build-938b236545d2

Upvotes: 0

Related Questions