Hello all,

I have this scenario:  We have approx. 225 different builds for components 
in a large project I'm responsible for.  Each of those builds needs to be 
able to build from any of 3 different branches in subversion, or any 
arbitrary number of tags; so, we're using the Subversion plugin to allow us 
to select the branch or tag as a parameter for the job.   Now, we are 
trying to have jobs triggered directly via a post-commit hook, so, since 
the stock Subversion plugin doesn't really support passing parameters to 
the build jobs once it tells them to poll SVN, I'm trying to write a new 
plugin that is modeled after the Subversion plugin with the change that 
instead of telling the job to poll, the plugin actually queue's the job 
instead, and accepts the needed parameters.  I'm opting for a generic 
plugin approach since specifically defining 225+ jobs discreetly in a 
post-commit hook is just not very efficient or scaleable.  However, I'm 
having one issue that I'm hoping you may be able to steer me in the 
direction of how to fix:

The builds don't seem to be accepting the parameter I'm passing in, but the 
job runs anyway and fails because the parameter doesn't seem to be being 
set.  The format of the URL that's defined in the job's Subversion 
Repository URL is something like this: 
 http://svn.mycompany.com/svn/MyProject/${branch_tag}/backend-domain  (with 
the branch_tag variable populated by the "List Sunbversion Tags (and more)" 
parameter value.)

The plugin I've written is basically a clone of the Subversion plugin with 
all the guts ripped out so I can publish a different trigger URL that's 
very similar to the URL used in the subversion plugin. My URL that wget 
calls is: 
 http://jenkins.mycompany.com/trigger/${UUID}/notifyTrigger?branch_tag=$BRANCH 
 The job does indeed seem to be being triggered, but fails almost 
immediately because the ${branch_tag} parameter doesn't seem to have been 
set.  Here's a snippet of the relevant code from the plugin: 

if (loc.getSVNURL().toDecodedString().contains("${branch_tag}")) {

    //trigger a build directly passing in the arg
    ParametersDefinitionProperty pdp = 
p.getProperty(ParametersDefinitionProperty.class);
    ParameterDefinition pd = pdp.getParameterDefinition("branch_tag");
    if (null != pd) {
        QueueTaskFuture<? extends AbstractBuild> f = p.scheduleBuild2(0, 
new Cause.RemoteCause(SVNUrl, TriggerCause),
                new ParametersAction(new StringParameterValue("branch_tag", 
branchOrTag)));
    }

        }  

I AM properly finding all build jobs that correspond to the Subversion 
repo's UUID, so, I'm sure that I'm simply not launching the build properly 
with parameters, so any direction you can point me to would help immensely!

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to