Passing information between parent & child jobs in a matrix job

512 views
Skip to first unread message

Francois Ritaly

unread,
Mar 14, 2014, 1:17:39 PM3/14/14
to jenkins...@googlegroups.com
Hi,

I'm trying to implement an automated release process in jenkins relying on the use of a matrix job and the jenkins release plugin.

When used with a matrix job, the jenkins release plugin (in its latest version (2.5-SNAPSHOT)) provides a hook named "before matrix build" which runs before forking the parallel "configuration builds". With this hook, I create a staging repository in Nexus whose url is dynamically generated (it looks like "http://server:port/nexus/service/local/staging/deployByRepositoryId/12345").

I need this generated url to be passed to the "configuration builds" forked by Jenkins so that they can upload the built artifacts to the temporary staging repository. At the moment, this url is written into a properties file (NEXUS_STAGING_REPOSITORY_URL=http://...).

I used the "EnvInject" plugin (still in the "before matrix build", just after creating the staging repository) to read the properties file and set an environment variable from it. This works, I can see the environment variable set.

However I expected the forked "configuration builds" to inherit this environment variable but that's not the case. When the "configuration builds" kick in, I don't have the local properties file.

I tried using different plugins but I'm stuck. I have no idea how to propagate this information from the "before matrix build" hook to the "configuration builds".

Have you ever implemented such a trick ?

Thanks in advance.

-Francois

Francois Ritaly

unread,
Mar 14, 2014, 4:45:32 PM3/14/14
to jenkins...@googlegroups.com

Francois Ritaly

unread,
Mar 14, 2014, 4:53:34 PM3/14/14
to jenkins...@googlegroups.com
I was able to fulfill my need with this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Environment+Script+Plugin
Reply all
Reply to author
Forward
0 new messages