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

Bitbucket payload not available in $BITBUCKET_PAYLOAD for multi-branch pipeline jobs

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • bitbucket-plugin
    • None
    • Jenkins: 2.277.4
      bitbucket-plugin: 1.1.28

      Job type: multi-branch pipeline

    Description

      Firstly, thank you for your timely help with JENKINS-65651.

      Now our Bitbucket multi-branch pipeline job is being triggered however the BITBUCKET_PAYLOAD environment variable is not set; this is the main reason I am considering using this plugin over the generic Git one.

      Looking into the code I see we have two trigger types BitBucketTrigger and BitBucketMultibranchTrigger. Specifically, the BitBucketTrigger has a onPost method that the BitBucketMultibranchTrigger does not have; this onPost method seems to do the work of injecting the payload from Bitbucket into the BITBUCKET_PAYLOAD env var.

      Some questions/ideas:

      • Does there need to be two types of triggers for single vs. multi-branch pipelines?
      • If each needs its own trigger then could most of the BITBUCKET_PAYLOAD insertion logic be re-used perhaps via an abstract base class?

      Attachments

        Activity

          tzach_solomon Tzach Solomon added a comment -

          ftclausen I think I've fixed this with version https://github.com/jenkinsci/bitbucket-plugin/releases/tag/223.vd12f2bca5430 ... can you please verify?

          tzach_solomon Tzach Solomon added a comment - ftclausen  I think I've fixed this with version https://github.com/jenkinsci/bitbucket-plugin/releases/tag/223.vd12f2bca5430  ... can you please verify?
          pnowy_hcl Przemyslaw added a comment -

          tzach_solomon I've checked the latest plugin version mentioned by you with last Jenkins version and have the same issue - there is not payload for multibranch pipeline.

          My job DSL configuraiton:

          multibranchPipelineJob('/mybuild') {
            factory {
                workflowBranchProjectFactory {
                    scriptPath('Jenkinsfile')
                }
            }
          
            branchSources {
              branchSource {
                source {
                  git {
                    id('123456789') // IMPORTANT: use a constant and unique identifier
                    remote('https://bitbucket.org/mygroup/myrepo.git')
                    credentialsId('bitbucket-access')
          
                    traits {
                      gitBranchDiscovery()
                      gitTagDiscovery()
                    }
                  }
                }
              }
            }
          
            orphanedItemStrategy {
              discardOldItems {
                numToKeep(3)
              }
            }
          
            triggers {
              bitbucketPush()
            }
          } 

          It would be nice to have it on scope of ENV as it would be possible to setup with shared library some `when` expression for merge requests 

          pnowy_hcl Przemyslaw added a comment - tzach_solomon I've checked the latest plugin version mentioned by you with last Jenkins version and have the same issue - there is not payload for multibranch pipeline. My job DSL configuraiton: multibranchPipelineJob( '/mybuild' ) { factory { workflowBranchProjectFactory { scriptPath( 'Jenkinsfile' ) } } branchSources { branchSource { source { git { id( '123456789' ) // IMPORTANT: use a constant and unique identifier remote( 'https: //bitbucket.org/mygroup/myrepo.git' ) credentialsId( 'bitbucket-access' ) traits { gitBranchDiscovery() gitTagDiscovery() } } } } } orphanedItemStrategy { discardOldItems { numToKeep(3) } } triggers { bitbucketPush() } } It would be nice to have it on scope of ENV as it would be possible to setup with shared library some `when` expression for merge requests 

          People

            tzach_solomon Tzach Solomon
            ftclausen Friedrich Clausen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: