I have tried the following solution:
def property = project.getProperty(ParametersDefinitionProperty.class)
def jobParams = property.getParameterDefinitions();

def newParam = new StringParameterValue('UPSTREAM_TRIGGER_CAUSE', 'true')
jobParams.add(newParam)

def parametersAction = new ParametersAction(jobParams)
def cause = new UpstreamCause(build)
def futureTask = project.scheduleBuild2(project.quietPeriod, cause, 
parametersAction)
However it gets stuck on scheduleBuild2 and does not return.


torsdag 26. november 2015 12.38.06 UTC+1 skrev Sverre Moe følgende:
>
> Groovy Code for triggering a build with a parameter
> def params = 
> [
>     new StringParameterValue('UPSTREAM_TRIGGER_CAUSE', 'true')
> ]
> def paramsAction = new ParametersAction(params)
>
> def cause = new UpstreamCause(build)
> def futureTask = project.scheduleBuild2(project.quietPeriod, cause, 
> paramsAction)
>
> I have configured parameters for each projects with default values. When I 
> supply this one extra parameter with scheduleBuild2 the other configured 
> parameters are not set. Thus getting:
>
>  > git rev-parse ${BUILD_BRANCH}^{commit} # timeout=10
> ERROR: Couldn't find any revision to build. Verify the repository and branch 
> configuration for this job.
>
>
> I reckon I have to first get the configured parameters from the project, 
> then add the new one. 
> Just not sure how. I can read the properties with
> def property = project.getProperty(ParametersDefinitionProperty.class)
> But that will not give me a map of key/value for each property.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/720e0854-3239-4c31-953d-1787b7db35de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to