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

Bitbucket Plugin - Triggers the pipeline even when the repo is not configured with webhook

      Bitbucket Plugin - Triggers the Jenkins pipeline even when the repo is not configured with webhook. This happening only when we are using two or more different repos in the pipeline.

      Consider:

      We have two Bitbucket repos A and B one for hosting Codes and another one for hosting Build and Deployment scripts. (Devops related)

      1. Jenkins Pipeline - Configured to use Jenkinsfile from SCM in our case Repo A and Branch develop
      2. Jenkinsfile in turn will clone the Repo B for build and deployments scripts while pipeline is running using checkout step
      3. Repo A is configured with Webhook and Repo B is not configured with Webhook.

      Steps to Reproduce:

      1. Commit something in the develop branch of Repo A and its trigger the pipeline as expected. No issue.
      2. Commit Something in the Repo B. No triggers since it was not configured with Webhook and its expected no issue.
      3. Now Commit something in the different branch of Repo A and its trigger the pipeline since there is change in the Repo B. I verified this in the Bitbucket Webhook log.

      What we are expecting:

      Whenever there is a change in develop branch of Repo A it can trigger the pipeline. But it should not trigger the pipeline for other Branches for Repo A or other Repos itself.

       

        1. bitbucketpush.log
          1 kB
        2. jenkins.log
          25 kB
        3. push.log
          12 kB

          [JENKINS-64340] Bitbucket Plugin - Triggers the pipeline even when the repo is not configured with webhook

          SatheeshP added a comment -

          To temporarily fix this issue , i have replaced the checkout step with raw git clone command. Now pipeline is getting only triggered when there is a change in Repo A.

          SatheeshP added a comment - To temporarily fix this issue , i have replaced the checkout step with raw git clone command. Now pipeline is getting only triggered when there is a change in Repo A.

          Tzach Solomon added a comment - - edited

          satheeshpayoda can you please add logs so I would better understand why does this scenario occours?

          Tzach Solomon added a comment - - edited satheeshpayoda  can you please add logs so I would better understand why does this scenario occours?

          SatheeshP added a comment - - edited

          Hello tzach_solomon

          I have attached Jenkins Log + Bitbucket Push logs(From Jenkins UI).

          This is my test pipeline script:

           

          pipeline {
          	agent any 	
          	triggers {
          		bitbucketPush overrideUrl: 'https://bitbucket.org/dummy/testsatheesh.git'
          	}
          	stages {
          		stage('Checkout Devops Script') { 
          			steps {				
          				git credentialsId: 'xxxxxxxxxxxxxxxxxxxxx', url: 'https://xxxx@bitbucket.org/dummy/testsatheesh2.git'
          			}
          		}
              }
          }
          

           

           


           

          Also i have another questions. Will Pipeline's Workspace directory get deleted if Pipeline was not ran for few weeks?

          Because sometime committing on BitBucket repo triggers 2 Pipeline. Out of 2 pipeline, one was configured with that commited Repo but another one was configured totally different Bitbucket Repo. When i checked the Bitbucket Push logs, its says pipeline is triggered because Workspace was empty.

           

          2 Issue here:

          1. Pipeline's Workspace is getting deleted for somereason.
          2. This Bitbucket Pipeline trigger all the pipeline(webhook configured ones) when webhook is received even though received webhook is not related to that Pipeline.

           

          SatheeshP added a comment - - edited Hello tzach_solomon I have attached Jenkins Log + Bitbucket Push logs(From Jenkins UI). This is my test pipeline script:   pipeline { agent any triggers { bitbucketPush overrideUrl: 'https: //bitbucket.org/dummy/testsatheesh.git' } stages { stage( 'Checkout Devops Script' ) { steps { git credentialsId: 'xxxxxxxxxxxxxxxxxxxxx' , url: 'https: //xxxx@bitbucket.org/dummy/testsatheesh2.git' } } } }       Also i have another questions. Will Pipeline's Workspace directory get deleted if Pipeline was not ran for few weeks? Because sometime committing on BitBucket repo triggers 2 Pipeline. Out of 2 pipeline, one was configured with that commited Repo but another one was configured totally different Bitbucket Repo. When i checked the Bitbucket Push logs, its says pipeline is triggered because Workspace was empty.   2 Issue here: Pipeline's Workspace is getting deleted for somereason. This Bitbucket Pipeline trigger all the pipeline(webhook configured ones) when webhook is received even though received webhook is not related to that Pipeline.  

          Tzach Solomon added a comment -

          satheeshpayoda I'm not familiar with workspace getting deleted automatically, only if you configure it. But this is not related to bitbucket-plugin

          Tzach Solomon added a comment - satheeshpayoda  I'm not familiar with workspace getting deleted automatically, only if you configure it. But this is not related to bitbucket-plugin

          Tzach Solomon added a comment -

          satheeshpayoda 

          please see https://support.cloudbees.com/hc/en-us/articles/115000051112-Bitbucket-Webhooks-Troubleshooting on how to open the logs of the plugin for troubleshooting and then please upload them here. thanks 

          Tzach Solomon added a comment - satheeshpayoda   please see https://support.cloudbees.com/hc/en-us/articles/115000051112-Bitbucket-Webhooks-Troubleshooting  on how to open the logs of the plugin for troubleshooting and then please upload them here. thanks 

          SatheeshP added a comment -

          tzach_solomon

          Added push.log form Jenkins UI:

          SatheeshP added a comment - tzach_solomon Added push.log form Jenkins UI:

          SatheeshP added a comment - - edited

          Off Topic:

           

          SatheeshP I'm
           not familiar with workspace getting deleted automatically, only if you 
          configure it. But this is not related to bitbucket-plugin  

          tzach_solomon  To my knowledge i didn't configure. Can you tell me where i can find this settings?

           

          SatheeshP added a comment - - edited Off Topic:   SatheeshP I'm not familiar with workspace getting deleted automatically, only if you configure it. But this is not related to bitbucket-plugin tzach_solomon   To my knowledge i didn't configure. Can you tell me where i can find this settings?  

          Tzach Solomon added a comment -

          satheeshpayoda the plugin does not compare with branches, i.e. if there is a change in the repo, it will build

          Tzach Solomon added a comment - satheeshpayoda  the plugin does not compare with branches, i.e. if there is a change in the repo, it will build

            tzach_solomon Tzach Solomon
            satheeshpayoda SatheeshP
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: