Quantcast

passing parameters with build flow plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

passing parameters with build flow plugin

Tomek Kaczanowski
Hi All,

could someone post an example on how to read parameters passed from
one job to another using Build Flow plugin? Plugin documentation
https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin gives
information on how to put a parameter to the job, but does not show
how to use them there.

The scenario I'm trying to implement is that:
a) job "compile" checks sources from SVN and compiles things:
    b = build( "compile" )
b) flow job passes this value to another job, like this:
    svn_rev = b.build.properties.environment['SVN_REVISION']
    bUnit = build( "unit-tests" , svn_revision: svn_rev)
c) job "unit-tests" should use this value in setting build name (using
https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin),
however I can't figure out how to do it. Can't seem to be able to
access svn_revision, from "unit-tests" job.

Could someone enlighten me? I feel like missing something obvious.

--
Regards,
Tomek Kaczanowski
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: passing parameters with build flow plugin

Tomek Kaczanowski
Hi All,

any hints?

--
Regards,
Tomek Kaczanowski

On 13 Sie, 17:45, Tomek Kaczanowski <[hidden email]>
wrote:

> Hi All,
>
> could someone post an example on how to read parameters passed from
> one job to another using Build Flow plugin? Plugin documentationhttps://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugingives
> information on how to put a parameter to the job, but does not show
> how to use them there.
>
> The scenario I'm trying to implement is that:
> a) job "compile" checks sources from SVN and compiles things:
>     b = build( "compile" )
> b) flow job passes this value to another job, like this:
>     svn_rev = b.build.properties.environment['SVN_REVISION']
>     bUnit = build( "unit-tests" , svn_revision: svn_rev)
> c) job "unit-tests" should use this value in setting build name (usinghttps://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin),
> however I can't figure out how to do it. Can't seem to be able to
> access svn_revision, from "unit-tests" job.
>
> Could someone enlighten me? I feel like missing something obvious.
>
> --
> Regards,
> Tomek Kaczanowski
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: passing parameters with build flow plugin

ola nilsson
Use the parameterized build plugin (for the unit-tests job) and setup a string variable called MYSVN_REV (SVN_REVISION is a 'built-in'). Pass the variable into the build from the flow DSL like you show above. Then, in the unit-tests job config use MYSVN_REV (it's an environment variable) in the Build Name Setter plugin.

Ola

On Monday, August 20, 2012 8:00:23 PM UTC+2, Tomek Kaczanowski wrote:
Hi All,

any hints?

--
Regards,
Tomek Kaczanowski

On 13 Sie, 17:45, Tomek Kaczanowski <[hidden email]>
wrote:

> Hi All,
>
> could someone post an example on how to read parameters passed from
> one job to another using Build Flow plugin? Plugin documentationhttps://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugingives
> information on how to put a parameter to the job, but does not show
> how to use them there.
>
> The scenario I'm trying to implement is that:
> a) job "compile" checks sources from SVN and compiles things:
>     b = build( "compile" )
> b) flow job passes this value to another job, like this:
>     svn_rev = b.build.properties.environment['SVN_REVISION']
>     bUnit = build( "unit-tests" , svn_revision: svn_rev)
> c) job "unit-tests" should use this value in setting build name (usinghttps://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin),
> however I can't figure out how to do it. Can't seem to be able to
> access svn_revision, from "unit-tests" job.
>
> Could someone enlighten me? I feel like missing something obvious.
>
> --
> Regards,
> Tomek Kaczanowski
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: passing parameters with build flow plugin

vdvorkin
This post has NOT been accepted by the mailing list yet.
In reply to this post by Tomek Kaczanowski
I have some job "Parent" with "This build is parameterized" -> "String Parameter" -> "Name" -> "Baseline".

In "Flow Definition" -> "DSL" I wrote:
...
build( "Child", Repository:params.Baseline)
...

So job "Child" get variable ${Repository} assigned by ${Baseline} value:

In job "Child" -> "Build" -> "Execute shell" -> "Command":
[ "X${Repository}" != "X" ] || {
  echo "Repository name not defined"
  exit 1
}
...

It's working.
Loading...