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

First time builds are not reporting to Bitbucket

    XMLWordPrintable

Details

    Description

      I'm using this plugin with a Multibranch Pipeline for reporting the status of a build to Bitbucket. The issue I'm seeing is that the first time a branch is built, the status is not being sent. I can see in the log that it does call the plugin, but the log that says that posting the status succeeded does not show up. Each time a build is run after the first run works as expected.

      Attachments

        Activity

          ethanfrogers Ethan Rogers created issue -

          Could you please add what is logged in case of error as you described and which version of the plugin are you using, so I'll be able to reproduce easily the error.

          Thanks and best regards

          flagbit Antonio Mansilla added a comment - Could you please add what is logged in case of error as you described and which version of the plugin are you using, so I'll be able to reproduce easily the error. Thanks and best regards
          flagbit Antonio Mansilla made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          rwfeather Ryan Feather made changes -
          Attachment screenshot-1.png [ 35952 ]
          rwfeather Ryan Feather made changes -
          Attachment screenshot-2.png [ 35953 ]
          rwfeather Ryan Feather added a comment - - edited

          Same issue here. Using mutlibranch and calling bitbucketstatusnotify within the pipeline. Plugin version 1.3.1, jenkins version 2.39. It seems to be failing silently as far as I can tell.

          First build

          Second build

          rwfeather Ryan Feather added a comment - - edited Same issue here. Using mutlibranch and calling bitbucketstatusnotify within the pipeline. Plugin version 1.3.1, jenkins version 2.39. It seems to be failing silently as far as I can tell. First build Second build

          Hi ethanfrogers, that a weird behaviour, since I'm as well using multibranch pipeline jobs and the build status is being reported to Bitbucket properly. Can you please post here the part relative to this plugin of your current Jenkinsfile, so I can find better the problem?

          I'll close this issue since I guess the problem is a misconfiguration o error on the Jenkinsfile and will reopen in case the error is still persisting.

          flagbit Antonio Mansilla added a comment - Hi ethanfrogers , that a weird behaviour, since I'm as well using multibranch pipeline jobs and the build status is being reported to Bitbucket properly. Can you please post here the part relative to this plugin of your current Jenkinsfile, so I can find better the problem? I'll close this issue since I guess the problem is a misconfiguration o error on the Jenkinsfile and will reopen in case the error is still persisting.
          flagbit Antonio Mansilla made changes -
          Status In Progress [ 3 ] Open [ 1 ]
          flagbit Antonio Mansilla made changes -
          Resolution Cannot Reproduce [ 5 ]
          Status Open [ 1 ] Closed [ 6 ]

          Hi amansilla

          I have same issue. I'm using multibranch pipeline projects with latest plugins. Notifications are sent inside node block but not in any stage block. INPROGRESS is sent after checkout stage with checkout scm step. SUCCESSFUL and FAILED are sent inside node but outside stage blocks too. All notifications are sent with same buildKey. First build is not notified with any state, second and next ones are notified.

          pszczekutowicz Paweł Szczekutowicz added a comment - Hi amansilla I have same issue. I'm using multibranch pipeline projects with latest plugins. Notifications are sent inside node block but not in any stage block. INPROGRESS is sent after checkout stage with checkout scm step. SUCCESSFUL and FAILED are sent inside node but outside stage blocks too. All notifications are sent with same buildKey. First build is not notified with any state, second and next ones are notified.
          adriancarriger Adrian Carriger added a comment - - edited

          Hi flagbit, thanks for the awesome plugin! I'm also experiencing the issue and have created a minimal repo to demonstrate what I'm experiencing.

          Steps to reproduce

          1. Create a mutlibranch Jenkins (v2.51) project with a Jenkinsfile like this
          2. Create a branch, publish it, make a commit
            • This does not post to Bitbucket
          3. Make another change on the branch
            • This does post to Bitbucket

          No Error Message

          In the Jenkins log for the build that does not post to Bitbucket there is no error message and there is no success message.

          Log

          Here is the log for the build that does not post to Bitbucket
          Branch indexing
          > git rev-parse --is-inside-work-tree # timeout=10
          Setting origin to git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git
          > git config remote.origin.url git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git # timeout=10
          Fetching origin...
          Fetching upstream changes from origin
          > git --version # timeout=10
          using GIT_ASKPASS to set credentials Bitbucket Notify
          > git fetch --tags --progress origin +refs/heads/:refs/remotes/origin/
          Seen branch in repository origin/issue-example
          Seen branch in repository origin/master
          Seen 2 remote branches
          Obtained Jenkinsfile from be3deb74d3c0f1f489c64e76827606ece518131b
          [Pipeline] node
          Running on master in /Users/acarriger/.jenkins/workspace/tifier-plugin_issue-example-7CIO4G3WKWGDSZ73ZRBWZTTA265YQQSKAEKGOJOPCLK5RW635WYQ
          [Pipeline] {
          [Pipeline] checkout
          Cloning the remote Git repository
          Cloning repository git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git
          > git init /Users/acarriger/.jenkins/workspace/tifier-plugin_issue-example-7CIO4G3WKWGDSZ73ZRBWZTTA265YQQSKAEKGOJOPCLK5RW635WYQ # timeout=10
          Fetching upstream changes from git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git
          > git --version # timeout=10
          using GIT_ASKPASS to set credentials Bitbucket Notify
          > git fetch --tags --progress git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git +refs/heads/:refs/remotes/origin/
          > git config remote.origin.url git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git # timeout=10
          > git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
          > git config remote.origin.url git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git # timeout=10
          Fetching upstream changes from git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git
          using GIT_ASKPASS to set credentials Bitbucket Notify
          > git fetch --tags --progress git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git +refs/heads/:refs/remotes/origin/
          Checking out Revision be3deb74d3c0f1f489c64e76827606ece518131b (issue-example)
          > git config core.sparsecheckout # timeout=10
          > git checkout -f be3deb74d3c0f1f489c64e76827606ece518131b
          First time build. Skipping changelog.
          [Pipeline] stage
          [Pipeline] { (test)
          [Pipeline] bitbucketStatusNotify
          [Pipeline] bitbucketStatusNotify
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS

           

          Thank you for your help!

           

          adriancarriger Adrian Carriger added a comment - - edited Hi  flagbit , thanks for the awesome plugin! I'm also experiencing the issue and have created a minimal repo  to demonstrate what I'm experiencing. Steps to reproduce Create a mutlibranch Jenkins (v2.51) project with a Jenkinsfile like this This does post to Bitbucket Create a branch, publish it, make a commit This does not post to Bitbucket Make another change on the branch This does post to Bitbucket No Error Message In the Jenkins log for the build that does not post to Bitbucket there is no error message and there is no success message. Log Here is the log for the build that does not post to Bitbucket Branch indexing > git rev-parse --is-inside-work-tree # timeout=10 Setting origin to git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git > git config remote.origin.url git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git # timeout=10 Fetching origin... Fetching upstream changes from origin > git --version # timeout=10 using GIT_ASKPASS to set credentials Bitbucket Notify > git fetch --tags --progress origin +refs/heads/ :refs/remotes/origin/ Seen branch in repository origin/issue-example Seen branch in repository origin/master Seen 2 remote branches Obtained Jenkinsfile from be3deb74d3c0f1f489c64e76827606ece518131b [Pipeline] node Running on master in /Users/acarriger/.jenkins/workspace/tifier-plugin_issue-example-7CIO4G3WKWGDSZ73ZRBWZTTA265YQQSKAEKGOJOPCLK5RW635WYQ [Pipeline] { [Pipeline] checkout Cloning the remote Git repository Cloning repository git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git > git init /Users/acarriger/.jenkins/workspace/tifier-plugin_issue-example-7CIO4G3WKWGDSZ73ZRBWZTTA265YQQSKAEKGOJOPCLK5RW635WYQ # timeout=10 Fetching upstream changes from git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git > git --version # timeout=10 using GIT_ASKPASS to set credentials Bitbucket Notify > git fetch --tags --progress git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git +refs/heads/ :refs/remotes/origin/ > git config remote.origin.url git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/ :refs/remotes/origin/ # timeout=10 > git config remote.origin.url git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git # timeout=10 Fetching upstream changes from git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git using GIT_ASKPASS to set credentials Bitbucket Notify > git fetch --tags --progress git@bitbucket.org:dt-acarriger/bitbucket-build-status-notifier-plugin-issue.git +refs/heads/ :refs/remotes/origin/ Checking out Revision be3deb74d3c0f1f489c64e76827606ece518131b (issue-example) > git config core.sparsecheckout # timeout=10 > git checkout -f be3deb74d3c0f1f489c64e76827606ece518131b First time build. Skipping changelog. [Pipeline] stage [Pipeline] { (test) [Pipeline] bitbucketStatusNotify [Pipeline] bitbucketStatusNotify [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS   Thank you for your help!  
          dbows David Bows added a comment - - edited

          Hello - having the same issue.  First  build is not being notified, all others working fine.

          You can see from the log that it is calling the notify but it fires:


          First time build. Skipping changelog.
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Notify)
          [Pipeline] bitbucketStatusNotify
          [Pipeline] slackSend
          run slackstepsend, step null:false, desc :false
          Slack Send Pipeline step configured values from global config - baseUrl: true, teamDomain: true, token: true, channel: false, color: false
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] stage
          [Pipeline] { (Setup)
          [Pipeline] echo

              • Installing NodeJS ***

          Here is the second build. You can see that it fires.

           
          Pipeline] }
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Notify)
          Sending build status INPROGRESS for commit eaf1de07954dba605e2ed9f60e9b22e9bf17bdbd to BitBucket is done!
          [Pipeline] bitbucketStatusNotify
          run slackstepsend, step null:false, desc :false
          Slack Send Pipeline step configured values from global config - baseUrl: true, teamDomain: true, token: true, channel: false, color: false
          [Pipeline] slackSend
          [Pipeline] }
          [Pipeline] // stage

          dbows David Bows added a comment - - edited Hello - having the same issue.  First  build is not being notified, all others working fine. You can see from the log that it is calling the notify but it fires: First time build. Skipping changelog. [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Notify) [Pipeline] bitbucketStatusNotify [Pipeline] slackSend run slackstepsend, step null:false, desc :false Slack Send Pipeline step configured values from global config - baseUrl: true, teamDomain: true, token: true, channel: false, color: false [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Setup) [Pipeline] echo Installing NodeJS *** Here is the second build. You can see that it fires.   Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Notify) Sending build status INPROGRESS for commit eaf1de07954dba605e2ed9f60e9b22e9bf17bdbd to BitBucket is done! [Pipeline] bitbucketStatusNotify run slackstepsend, step null:false, desc :false Slack Send Pipeline step configured values from global config - baseUrl: true, teamDomain: true, token: true, channel: false, color: false [Pipeline] slackSend [Pipeline] } [Pipeline] // stage
          aloi Alan Loi added a comment -

          Our team is also hitting the same issue.

          flagbit Any chance this ticket could be re-opened given that multiple people have reported it and the steps to reproduce have been included in a previous comment?

          aloi Alan Loi added a comment - Our team is also hitting the same issue. flagbit Any chance this ticket could be re-opened given that multiple people have reported it and the steps to reproduce have been included in a previous comment?
          dzwarg David Zwarg added a comment -

          flagbit - This is happening to our team and build jobs as well. We use phoenix environments, and every time we create a new branch in our multipipeline setup, the log indicates that the status is sent to bitbucket, but no icon shows for the first pipeline run in the Bitbucket interface. The status appears only after the first run of the pipeline in a new branch of a multibranch pipeline. There are no error messages in either the build log or the Jenkins log to indicate that the status is not being sent.

          Please re-open.

          dzwarg David Zwarg added a comment - flagbit - This is happening to our team and build jobs as well. We use phoenix environments, and every time we create a new branch in our multipipeline setup, the log indicates that the status is sent to bitbucket, but no icon shows for the first pipeline run in the Bitbucket interface. The status appears only after the first run of the pipeline in a new branch of a multibranch pipeline. There are no error messages in either the build log or the Jenkins log to indicate that the status is not being sent. Please re-open.
          dzwarg David Zwarg added a comment -

          flagbit - For the first build on a branch in a multibranch pipeline configuration, this is the output in the Jenkins log when invoking "sendBuildStatusNotification":

          May 09, 2017 1:18:01 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper sendBuildStatusNotification
          This request was sent: {
            "state": "INPROGRESS",
            "key": "deadbeef",
            "url": "https://jenkins/job/myjob/job/branch-name/1/",
            "name": "Test App",
            "description": "Running \"test-app\""
          }
          May 09, 2017 1:18:01 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper sendBuildStatusNotification
          This response was received: {"type": "error", "error": {"message": "Changeset not found."}}
          
          dzwarg David Zwarg added a comment - flagbit - For the first build on a branch in a multibranch pipeline configuration, this is the output in the Jenkins log when invoking "sendBuildStatusNotification": May 09, 2017 1:18:01 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper sendBuildStatusNotification This request was sent: { "state" : "INPROGRESS" , "key" : "deadbeef" , "url" : "https: //jenkins/job/myjob/job/branch-name/1/" , "name" : "Test App" , "description" : "Running \" test-app\"" } May 09, 2017 1:18:01 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper sendBuildStatusNotification This response was received: { "type" : "error" , "error" : { "message" : "Changeset not found." }}
          flagbit Antonio Mansilla made changes -
          Resolution Cannot Reproduce [ 5 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          gaieges Evin Callahan added a comment -

          Can confirm that we see the same thing. Curious if flagbit has been able to reproduce the issue as well?

          Also - for those that HAVE been having the problem, have you found any more effective workarounds in the meantime?

          gaieges Evin Callahan added a comment - Can confirm that we see the same thing. Curious if flagbit has been able to reproduce the issue as well? Also - for those that HAVE been having the problem, have you found any more effective workarounds in the meantime?
          gaieges Evin Callahan made changes -
          Priority Minor [ 4 ] Major [ 3 ]
          gaieges Evin Callahan added a comment -

          Any thoughts here flagbit?

          gaieges Evin Callahan added a comment - Any thoughts here flagbit ?
          ihor_sviziev Ihor Sviziev added a comment - - edited

          I have the same issue, "In progress" status isn't reporting if it runs before "checkout scm" step. Please fix it. Also it reproducing on all builds.

          ihor_sviziev Ihor Sviziev added a comment - - edited I have the same issue, "In progress" status isn't reporting if it runs before "checkout scm" step. Please fix it. Also it reproducing on all builds.
          zaytsev_work Yury Zaytsev added a comment -

          I have the same problem. The status for the first build in branch is not reported for unknown reasons and the most confusing part is that I don't even see anything in Jenkins logs, so no idea what goes wrong.

          As to 'In progress' not being reported before 'checkout scm', this is actually logical. The plugin needs current commit hash and repo url, and it's getting it from the checkout. No checkout = no build data = no report. Not sure if there are other better ways to get this information from within the step... need to ask someone familiar with Jenkins VCS API.

          zaytsev_work Yury Zaytsev added a comment - I have the same problem. The status for the first build in branch is not reported for unknown reasons and the most confusing part is that I don't even see anything in Jenkins logs, so no idea what goes wrong. As to 'In progress' not being reported before 'checkout scm', this is actually logical. The plugin needs current commit hash and repo url, and it's getting it from the checkout. No checkout = no build data = no report. Not sure if there are other better ways to get this information from within the step... need to ask someone familiar with Jenkins VCS API.

          Hi all you guys!! First thank you for the information: Finally I got time to check this in detail and debugging the plugin I found what is the reason why first job are not properly reported to bitbucket. The problem is that somehow first time a job is executed the getSCMs() method of the Run object where this plugin reads the repository URL information from is still not initialised, since this information is needed to notify Bitbucket the build status is not sent. Any help of someone more experienced with the VCS API will be appreciated.

          flagbit Antonio Mansilla added a comment - Hi all you guys!! First thank you for the information: Finally I got time to check this in detail and debugging the plugin I found what is the reason why first job are not properly reported to bitbucket. The problem is that somehow first time a job is executed the getSCMs() method of the Run object where this plugin reads the repository URL information from is still not initialised, since this information is needed to notify Bitbucket the build status is not sent. Any help of someone more experienced with the VCS API will be appreciated.
          gaieges Evin Callahan added a comment -

          flagbit sorry I don't have enough context to help.   Seems strange to me that would only be on the first build, do you agree?  Is that because there isn't a local configuration created for the new branch?  

           

          Perhaps some of the guys deeper in the jenkins stack can help answer that? abayer jglick

          gaieges Evin Callahan added a comment - flagbit sorry I don't have enough context to help.   Seems strange to me that would only be on the first build, do you agree?  Is that because there isn't a local configuration created for the new branch?     Perhaps some of the guys deeper in the jenkins stack can help answer that? abayer jglick
          abayer Andrew Bayer added a comment -

          stephenconnolly probably would have a better idea than anyone else.

          abayer Andrew Bayer added a comment - stephenconnolly probably would have a better idea than anyone else.

          So what the plugin should probably do is add some custom inference to the step. It should be able to look for the SCMRevisionAction on the build just like the built-in notification does and only fall back to using the checkout if the job is not a Bitbucket branch

          Won't help for multibranch where people are using a source other than the bitbucket branch source, but they will just have to pull out the hash directly.

          I wonder if people using the notifier before checkout have actually been notifying the previous commit status?

          stephenconnolly Stephen Connolly added a comment - So what the plugin should probably do is add some custom inference to the step. It should be able to look for the SCMRevisionAction on the build just like the built-in notification does  and only fall back to using the checkout if the job is not a Bitbucket branch Won't help for multibranch where people are using a source other than the bitbucket branch source, but they will just have to pull out the hash directly. I wonder if people using the notifier before checkout have actually been notifying the previous commit status?
          steve_cobe Steven Clark added a comment -

          I got around this issue by creating this function in our Global Pipeline Library and calling it at the beginning of each pipeline I have.

          def call(buildId, jobName) {
              if ("${buildId}" == "1") {
                  build job: "${jobName}", wait: false
                  currentBuild.result = 'ABORTED'
                  error("Skipping build ${buildId} as it doesn't play nice with bitbucket notifications")
              }
          }
          

          And it's called with this line in the Pipeline

          script {
              rerunBuildOne(env.BUILD_ID, env.JOB_NAME)
          }
          

          It's pretty crude, but all is does is abort the build and start a new build for the same job if it's the first build. Which fixes the issue while I wait for this bug to be fixed.

          Also if it helps I've noticed that the commit ID that the notifier is supplying to BitBucket is the same commit ID as my Global Pipeline Library repository instead of the commit for the code being built. This explains why BitBucket says that it can't find the commit for the given repo, and will hopefully give you an easier way to recreate the bug.

          steve_cobe Steven Clark added a comment - I got around this issue by creating this function in our Global Pipeline Library and calling it at the beginning of each pipeline I have. def call(buildId, jobName) { if ( "${buildId}" == "1" ) { build job: "${jobName}" , wait: false currentBuild.result = 'ABORTED' error( "Skipping build ${buildId} as it doesn't play nice with bitbucket notifications" ) } } And it's called with this line in the Pipeline script { rerunBuildOne(env.BUILD_ID, env.JOB_NAME) } It's pretty crude, but all is does is abort the build and start a new build for the same job if it's the first build. Which fixes the issue while I wait for this bug to be fixed. Also if it helps I've noticed that the commit ID that the notifier is supplying to BitBucket is the same commit ID as my Global Pipeline Library repository instead of the commit for the code being built. This explains why BitBucket says that it can't find the commit for the given repo, and will hopefully give you an easier way to recreate the bug.

          We too suffer from this annoying problem. Just like Antonio mentioned in August, the problem is the call to WorkflowJob.getSCMs() of workflow-job-2.15.jar. This method gets the SCMs from the last successful build or the last completed build. Obviously, for the first build on a branch there isn't either. So it does not return any SCM information, hence Bitbucket status notifier does not notify any SCM. So this might be a problem of the workflow-job plugin after all.

              @Override public Collection<? extends SCM> getSCMs() {
                  WorkflowRun b = getLastSuccessfulBuild();
                  if (b == null) {
                      b = getLastCompletedBuild();
                  }
                  if (b == null) {
                      return Collections.emptySet();
                  }
                  Map<String,SCM> scms = new LinkedHashMap<>();
                  for (WorkflowRun.SCMCheckout co : b.checkouts(null)) {
                      scms.put(co.scm.getKey(), co.scm);
                  }
                  return scms.values();
              }
          

          As for the proposal to use the SCMRevisionAction.getRevision() method : it does not seem to yield enough information. The plugin needs userName and repoName of the repository in addition to the commit hash.

          cschwarz Christoph Schwarz added a comment - We too suffer from this annoying problem. Just like Antonio mentioned in August, the problem is the call to WorkflowJob.getSCMs() of workflow-job-2.15.jar. This method gets the SCMs from the last successful build or the last completed build. Obviously, for the first build on a branch there isn't either. So it does not return any SCM information, hence Bitbucket status notifier does not notify any SCM. So this might be a problem of the workflow-job plugin after all. @Override public Collection<? extends SCM> getSCMs() { WorkflowRun b = getLastSuccessfulBuild(); if (b == null ) { b = getLastCompletedBuild(); } if (b == null ) { return Collections.emptySet(); } Map< String ,SCM> scms = new LinkedHashMap<>(); for (WorkflowRun.SCMCheckout co : b.checkouts( null )) { scms.put(co.scm.getKey(), co.scm); } return scms.values(); } As for the proposal to use the SCMRevisionAction.getRevision() method : it does not seem to yield enough information. The plugin needs userName and repoName of the repository in addition to the commit hash.
          gaieges Evin Callahan added a comment -

          cschwarz if it helps at all, we moved over to the Bitbucket source branch plugin, and it does the start / finish / failure notifications without even having to think about it (including solving this issue).

          https://wiki.jenkins.io/display/JENKINS/Bitbucket+Branch+Source+Plugin

          gaieges Evin Callahan added a comment - cschwarz if it helps at all, we moved over to the Bitbucket source branch plugin, and it does the start / finish / failure notifications without even having to think about it (including solving this issue). https://wiki.jenkins.io/display/JENKINS/Bitbucket+Branch+Source+Plugin
          030 030 030 added a comment -

          Any update on this issue? Is there anything I can do in order to help?

          030 030 030 added a comment - Any update on this issue? Is there anything I can do in order to help?
          030 030 030 added a comment - I created another plugin, see https://github.com/030/golang-bitbucket-cloud-build-status-notifier

          Why do we need to fetch previous build scm values here https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/blob/df373d0ae3ac32a5337c1c002505dee0c85ff5b0/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java#L142?

          Couldn't we replace this line with 

          Map<String,SCM> scm_map = new LinkedHashMap<>();
          for (WorkflowRun.SCMCheckout co : build.checkouts(null)) {
              scm_map.put(co.scm.getKey(), co.scm);
          }
          Collection<? extends SCM> scms = scm_map.values()
          
          joesolly Joseph Solomon added a comment - Why do we need to fetch previous build scm values here https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/blob/df373d0ae3ac32a5337c1c002505dee0c85ff5b0/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java#L142 ? Couldn't we replace this line with  Map< String ,SCM> scm_map = new LinkedHashMap<>(); for (WorkflowRun.SCMCheckout co : build.checkouts( null )) { scm_map.put(co.scm.getKey(), co.scm); } Collection<? extends SCM> scms = scm_map.values()
          kevstev01 Kevin Stevens added a comment -

          I copied the workaround to fail on first build to get around this bug, but changed the status to NOT_BUILT and added a re-trigger of the build by adding the following stage

          stage('conditional abort first build') {
              when {
                  expression { "${env.BUILD_NUMBER}" == "1" }
              }
              steps {
                  echo "Aborting first build to workaround bitbucketStatusNotify issue"
                  /* re-trigger this build job */
                  build job: "${env.JOB_NAME}", wait: false
                  script {
                      currentBuild.result = 'NOT_BUILT'
                      return
                  }
              }
          }
              
          
          kevstev01 Kevin Stevens added a comment - I copied the workaround to fail on first build to get around this bug, but changed the status to NOT_BUILT and added a re-trigger of the build by adding the following stage stage( 'conditional abort first build' ) { when { expression { "${env.BUILD_NUMBER}" == "1" } } steps { echo "Aborting first build to workaround bitbucketStatusNotify issue" /* re-trigger this build job */ build job: "${env.JOB_NAME}" , wait: false script { currentBuild.result = 'NOT_BUILT' return } } }

          People

            flagbit Antonio Mansilla
            ethanfrogers Ethan Rogers
            Votes:
            8 Vote for this issue
            Watchers:
            20 Start watching this issue

            Dates

              Created:
              Updated: