Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66664

Multibranch Pipelines: Override default parameters

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • job-dsl-plugin, pipeline
    • None
    • Jenkins: 2.289.3
      job-dsl: 1.77
      pipeline: multibranch: 2.26

       I can see that with multibranch pipeline jobs and parameters, you need to define the parameters in the Jenkinsfile that you're calling and then run it once for the trigger to detect the parameters going forward. Then you can manually run buildWithParameters. This is fine for manual triggering but I cannot see an elegant solution for automated builds. 

      I would like to be able to setup multiple multibranch pipeline jobs which point to the same Jenkins file, but with different parameter values.

      For example, for this Jenkinsfile:

       

      pipeline {
        agent any
        parameters {
          string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')
          }
        stages {
          stage('Example') {
            steps {
              echo "Hello ${params.PERSON}"
            }
               }
          }
      }

       

      I would like to setup multiple "automated" builds with different values for parameter "PERSON" without having to manually trigger them and update them at runtime myself.

       

      I know you can get round this by using Folder Properties, but this, to me, would feel like a bit of a hacky solution.

       

      I'm defining my jobs with job-dsl multibranchPipelineJob and can't currently see a way of doing this, unlike pipelineJob 

            jamietanna Jamie Tanna
            samuelh Sam
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: