Each branch pipeline has their own config.xml. A standard pipeline job does 
have support for parameterization. I think I read somewhere in Jenkins JIRA 
that such properties should be defined in the Jenkinsfile and set for the 
branch pipeline project on the first run. I am a bit unsure how to set 
them. Cannot find a single example of this.

https://issues.jenkins-ci.org/browse/JENKINS-30519

I know how to set them programatically in the Script console for "regular" 
projects.
    StringBuilder builder = new StringBuilder()
    builder.append("PROP1=true")
    builder.append("\n")
    builder.append("PROP2=true")
    final def propertiesContent = builder.toString()

    def info = new EnvInjectJobPropertyInfo(null, propertiesContent, null, 
null, null, false)
    def property = new EnvInjectJobProperty()
    property.setOn(true)
    property.setKeepJenkinsSystemVariables(true)
    property.setKeepBuildVariables(true)
    property.setInfo(info)

    project.addProperty(property)
    project.save()


mandag 13. juni 2016 10.20.55 UTC+2 skrev Sverre Moe følgende:
>
> Either I am doing it wrong, or Multibranch pipeline has no way of sending 
> parameters to downstream builds.
> Considering that each branch within a multibranch pipeline seems to be a 
> single Pipeline project and standard such Pipeline projects can be 
> parameterized.
>
> onsdag 8. juni 2016 12.42.01 UTC+2 skrev Sverre Moe følgende:
>>
>> Jenkins Pipeline can be parameterized, but not multibranch pipelines. 
>> There is no option for "This build is parameterized" in the configuration 
>> of a multibranch pipeline. Why is that?
>>
>> I have a multibranch project for each repository with multiple branches.
>>
>> ProjectA
>>     master
>>     develop
>>     releaseX
>> ProjectB
>>     master
>>     develop
>>     releaseX
>>
>> In this case ProjectB has a dependency on ProjectA on the same branch.
>>
>> The Jenkinsfile is sparse, while the common main build logic is stored in 
>> workflowLibs.git
>>
>> When a upstream project builds a dependent downstream project I need to 
>> provide them with build parameters.
>> def BUILD_PROJECT = "projectB"+"/"+env.BUILD_BRANCH
>> build job: BUILD_PROJECT, parameters: [[$class: 'BooleanParameterValue', 
>> name: 'UPSTREAM_TRIGGERED', value: true]]
>> I have some logic in the main build script for when the build is 
>> triggered by an upstream dependency.
>>
>> Not sure how I can do this since multibranch pipeline cannot be 
>> parameterized.
>>
>> I have even tried withEnv, but it did not work
>> withEnv(["UPSTREAM_TRIGGERED=true"]) {
>>     def BUILD_PROJECT = "projectB"+"/"+env.BUILD_BRANCH
>>     build BUILD_PROJECT
>> }
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b3d88160-269d-4e05-af18-471b4870dc1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to