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

Multibranch Pipelines: Override default parameters

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

       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 

        Attachments

          Activity

          Hide
          jamietanna Jamie Tanna added a comment -

          Hi, if you're doing this with the job-dsl-plugin, the expectation would be that you wouldn't define parameters but that they'd be handled through your Job DSL configuration

          Show
          jamietanna Jamie Tanna added a comment - Hi, if you're doing this with the job-dsl-plugin, the expectation would be that you wouldn't define parameters but that they'd be handled through your Job DSL configuration

            People

            Assignee:
            aytuncbeken Aytunc BEKEN
            Reporter:
            samuelh Sam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: