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

Bitbucket plugin triggers multiple jobs in different Multi-branch pipelines

    XMLWordPrintable

Details

    Description

      Hi,

       

      Using Jenkins 2.263.2, I configured Bitbucket webhook and Jenkinsfile (declarative jenkins pipeline).

       

      When I push a commit, other multi-branch pipelines' jobs are triggered.

       

      I tried all of these:

       

      triggers { 
         bitbucketPush()
      }

       

       

      Tried overriding Repository URL (https://github.com/jenkinsci/bitbucket-plugin#override-repository-url)

      triggers { 
         bitbucketPush overrideUrl: 'https://bitbucket.org/xxx/repo-name'  
      }

      Tried adding property "Suppress Automatic SCM Trigger" to job configuration(https://stackoverflow.com/a/53769527)

       

      What I'm observing is when unrelated repo's jobs are triggered, their repo's webhook request are not there, neither is Jenkins scan log for that repo.

       

       

      Any ideas how to stop multiple unrelated Jenkins jobs to be triggered?

       

      Attachments

        Activity

          tzach_solomon Tzach Solomon added a comment -

          hasakura can you please provide logs to understand which jobs and why are they triggered? See section 4 in https://support.cloudbees.com/hc/en-us/articles/115000051112-Bitbucket-Webhooks-Troubleshooting?page=12

           

          tzach_solomon Tzach Solomon added a comment - hasakura  can you please provide logs to understand which jobs and why are they triggered? See section 4 in https://support.cloudbees.com/hc/en-us/articles/115000051112-Bitbucket-Webhooks-Troubleshooting?page=12  
          tzach_solomon Tzach Solomon added a comment - hasakura  ?
          sweepchild Kemalettin Yesilkaya added a comment - - edited

          This is how i accomplished, hope it works for you too.

          • for pipelineJob
          pipelineJob('pipeline-job-1') {
          
              configure { project ->
              
                  project / 'properties' / 'org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty' / triggers / 'com.cloudbees.jenkins.plugins.BitBucketTrigger' {
                      spec()
                      overrideUrl('git@foo.bar:baz/repo.git')
                  }
              }
          
              /// some codes
          
          }
          
          • for multibranchPipelineJob
          multibranchPipelineJob('my-multibranch-job1') {
          
           configure { project ->
                  
                  project / triggers / 'com.cloudbees.jenkins.plugins.BitBucketMultibranchTrigger' {
                      spec()
                      overrideUrl('git@foo.bar:baz/repo.git')
                  }
              }
          
              /// some codes
          
          }
          
          sweepchild Kemalettin Yesilkaya added a comment - - edited This is how i accomplished, hope it works for you too. for pipelineJob pipelineJob( 'pipeline-job-1' ) { configure { project -> project / 'properties' / 'org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty' / triggers / 'com.cloudbees.jenkins.plugins.BitBucketTrigger' { spec() overrideUrl( 'git@foo.bar:baz/repo.git' ) } } /// some codes } for multibranchPipelineJob multibranchPipelineJob( 'my-multibranch-job1' ) { configure { project -> project / triggers / 'com.cloudbees.jenkins.plugins.BitBucketMultibranchTrigger' { spec() overrideUrl( 'git@foo.bar:baz/repo.git' ) } } /// some codes } https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block

          People

            tzach_solomon Tzach Solomon
            hasakura Art
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: