pass values from build step to post build action

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

pass values from build step to post build action

Sergey Vidyuk
Hello

I wonder if there is any direct posibility to pass some data from
execute shell script to post build action.

I have a script which generates version string using git describe
output. I need to publish build results on samba share in a folder
which name should be version string and then send mail to testers with
the path to the build results. I'm sending those files using CLI
utility smbclient since can't pass version name to the "Publish CIFS"
plugin. I'm using ${BUILD_LOG_REGEX} function in "Email-ext" plugin to
grep through the log output and add path to the build results into
email. I would like to be able to set build parameter value from the
execute shel step and use this value in publish CIFS and email ext
plugins. Does anybody know how to do this?

Sergey Vidyuk
Reply | Threaded
Open this post in threaded view
|

Re: pass values from build step to post build action

Gregory Boissinot
The EnvInject Jenkins plugin could meet your needs.

In a first build step, you select shell script and you create a properties file (located in your job workspace).
For exemple: echo "A=B" > myfile.properties

And in a second step, you select 'Inject environment variables' and give 'myfile.properties' as value for 'Properties file Path' field.
The file content (A=B in your case) will be injected in the job for the end of the build

Then, you can use the $A variable in your post build actions.

On Tue, Dec 6, 2011 at 5:39 AM, Sergey Vidyuk <[hidden email]> wrote:
Hello

I wonder if there is any direct posibility to pass some data from
execute shell script to post build action.

I have a script which generates version string using git describe
output. I need to publish build results on samba share in a folder
which name should be version string and then send mail to testers with
the path to the build results. I'm sending those files using CLI
utility smbclient since can't pass version name to the "Publish CIFS"
plugin. I'm using ${BUILD_LOG_REGEX} function in "Email-ext" plugin to
grep through the log output and add path to the build results into
email. I would like to be able to set build parameter value from the
execute shel step and use this value in publish CIFS and email ext
plugins. Does anybody know how to do this?

Sergey Vidyuk

Reply | Threaded
Open this post in threaded view
|

Re: pass values from build step to post build action

Sergey Vidyuk
On 7 дек, 22:34, Grégory Boissinot <[hidden email]>
wrote:

> The EnvInject Jenkins plugin could meet your needs.https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
>
> In a first build step, you select shell script and you create a properties
> file (located in your job workspace).
> For exemple: echo "A=B" > myfile.properties
>
> And in a second step, you select 'Inject environment variables' and give
> 'myfile.properties' as value for 'Properties file Path' field.
> The file content (A=B in your case) will be injected in the job for the end
> of the build
>
> Then, you can use the $A variable in your post build actions.

Thanks looks like it's exactly what I need

Sergey Vidyuk
Reply | Threaded
Open this post in threaded view
|

Re: pass values from build step to post build action

ciprian_vintea
This post has NOT been accepted by the mailing list yet.
In reply to this post by Gregory Boissinot
This is an useful plugin, but if I have exit 1 in my script (first build step), the second build step won't be executed anymore. So no variables will be imported to post build action.
Is there any way to import variables using envInject plugin as a post build action?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: pass values from build step to post build action

harishkumartr21@gmail.com
This post has NOT been accepted by the mailing list yet.
In reply to this post by Gregory Boissinot
Thanks a lot.. It helped me a lot
i could do this