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

Jenkins Pipeline requires at least one successfull build for the trigger to work

    XMLWordPrintable

Details

    • 1.1.0

    Description

      After configuring everything like described on https://community.atlassian.com/t5/Bitbucket-articles/Atlassian-supported-Jenkins-integration-for-Bitbucket-Server/ba-p/1148326 , I get the same behavior as described by Kevin Reynolds: the trigger is executed in bitbucket, receives a 200 back from Jenkins, but no build is started.

      In the Jenkins logs I see:

       

      Payload: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent@1b554079
      Received refs changed event from repo: JG/bitbucket-sonarqube-integration
      

      I've debugged the code and traced it down to the getScms method in BitbucketWebhookConsumer returning an empty collection.

      Tracing further why it's empty, I end up in the implementation in

      https://github.com/jenkinsci/workflow-job-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java#L528

      which shows it needs at least a completed build to return a non empty collection.

      I feel this should rather use (from script console)

       

      Jenkins.instance.getItem('bitbucket-sonarqube-integration').definition.scm 
      

      which returns a BitbucketSCM instance as defined in the job definition.

      Can easily be reproduced when removing all builds from a job.

      Attachments

        Issue Links

          Activity

            sbv Sven Bovens added a comment -

            mhenschke_atlassian: How is this a duplicate of JENKINS-60649 ? That one is about the webhook not being created. This one is about the webhook not triggering the job. (I created the webhook manually, it fires, it returns an ok result, but no build is being run - all of which is not described in JENKINS-60649)

            sbv Sven Bovens added a comment - mhenschke_atlassian : How is this a duplicate of JENKINS-60649 ? That one is about the webhook not being created. This one is about the webhook not triggering the job. (I created the webhook manually, it fires, it returns an ok result, but no build is being run - all of which is not described in JENKINS-60649 )

            Hi Sven,

            My initial read of the bug suggested this was likely the same root cause as JENKINS-60649- but doing a bit more investigation it looks like they have separate causes. Accordingly, I've reopened the ticket.

            mhenschke_atlassian Martin Henschke added a comment - Hi Sven, My initial read of the bug suggested this was likely the same root cause as JENKINS-60649 - but doing a bit more investigation it looks like they have separate causes. Accordingly, I've reopened the ticket.
            aidin Aidin F added a comment - - edited

            I see the same behavior. Exactly as if "Bitbucket Server trigger build after push" is not checked. This does not happen with freestyle projects, only with pipelines. 
            I see the webhooks coming in, but nothing triggered

             -------------------

            Payload: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent@117c02d
            Feb 20, 2020 6:15:25 PM FINE com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookConsumer
            Received refs changed event from repo: HAL/dobby
            Feb 20, 2020 6:15:25 PM FINE com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookConsumer
            --------------------

            Also, sbv I'm assuming you saw the rest of the conversation in case of Kevin Reynolds. In his case, the "Bitbucket Server trigger build after push"  option was not selected, and instead a similar sounding checkbox related to a different Bitbucket plugin (Bitbucket branch plugin? ) was selected. 

            aidin Aidin F added a comment - - edited I see the same behavior. Exactly as if "Bitbucket Server trigger build after push" is not checked. This does not happen with freestyle projects, only with pipelines.  I see the webhooks coming in, but nothing triggered  ------------------- Payload: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent@117c02d Feb 20, 2020 6:15:25 PM FINE com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookConsumer Received refs changed event from repo: HAL/dobby Feb 20, 2020 6:15:25 PM FINE com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookConsumer -------------------- Also,  sbv I'm assuming you saw the rest of the conversation in case of Kevin Reynolds. In his case, the "Bitbucket Server trigger build after push"  option was not selected, and instead a similar sounding checkbox related to a different Bitbucket plugin (Bitbucket branch plugin? ) was selected. 

            People

              mhenschke_atlassian Martin Henschke
              sbv Sven Bovens
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: