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

Multibranch Pipelines: Override default parameters

    XMLWordPrintable

Details

    • Improvement
    • Status: Open (View Workflow)
    • Trivial
    • Resolution: Unresolved
    • job-dsl-plugin, pipeline
    • None
    • Jenkins: 2.289.3
      job-dsl: 1.77
      pipeline: multibranch: 2.26

    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

          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

          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
          aytuncbeken Aytunc BEKEN added a comment -

          This is not related to multibranch-action-triggers plugin

          aytuncbeken Aytunc BEKEN added a comment - This is not related to multibranch-action-triggers plugin
          felipecassiors Felipe Santos added a comment -

          jamietanna it would be really nice if there were a way to *block/reject/ignore* any parameters set in a Jenkinsfile when using JobDSL, so that Jenkins does not keep editing the config.xml automatically bypassing JobDSL.

          felipecassiors Felipe Santos added a comment - jamietanna it would be really nice if there were a way to * block / reject / ignore * any parameters set in a Jenkinsfile when using JobDSL, so that Jenkins does not keep editing the config.xml automatically bypassing JobDSL.

          People

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

            Dates

              Created:
              Updated: