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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

       

        Attachments

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

          Activity

          Hide
          satheeshpayoda 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?

           

          Show
          satheeshpayoda 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?  
          Hide
          satheeshpayoda SatheeshP added a comment -

          Tzach Solomon

          Added push.log form Jenkins UI:

          Show
          satheeshpayoda SatheeshP added a comment - Tzach Solomon Added push.log form Jenkins UI:
          Hide
          tzach_solomon Tzach Solomon added a comment -

          SatheeshP 

          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 

          Show
          tzach_solomon Tzach Solomon added a comment - SatheeshP   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 
          Hide
          tzach_solomon Tzach Solomon added a comment -

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

          Show
          tzach_solomon Tzach Solomon added a comment - SatheeshP  I'm not familiar with workspace getting deleted automatically, only if you configure it. But this is not related to bitbucket-plugin
          Hide
          satheeshpayoda 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.

           

          Show
          satheeshpayoda 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.  
          Hide
          tzach_solomon Tzach Solomon added a comment - - edited

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

          Show
          tzach_solomon Tzach Solomon added a comment - - edited SatheeshP  can you please add logs so I would better understand why does this scenario occours?
          Hide
          satheeshpayoda 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.

          Show
          satheeshpayoda 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.

            People

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

              Dates

              Created:
              Updated: