Answers: <p>As I was not able to tackle the bug in the Java code and the bug was already reported in 2017 I decided to write <a href="https://github.com/030/golang-bitbucket-cloud-build-status-notifier" rel="nofollow noreferrer">this plugin</a>. This binary is able to send a build status even when a branch is built for the first time.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-03-13T11:40:27.590Z
Answers: 2019-03-13T11:40:27.590Z
Answers: 030
Body: <p><strong>Background</strong></p>
  
  <p><a href="https://plugins.jenkins.io/bitbucket-build-status-notifier" rel="nofollow noreferrer">The Bitbucket Status Notifier plugin</a> has been configured. The status was reported, but since more and more jobs have been moved to Jenkins-on-steroids that is running on k8s, buildStats are not reported if a branch is built for the first time.</p>
  
  <p><strong>Aim</strong></p>
  
  <p>The aim is to report the build status to bitbucket-cloud by jenkins multi-branch when a branch is built for the first time.</p>
  
  <p><strong>Attempts to solve the issue</strong></p>
  
  <p><a href="https://issues.jenkins-ci.org/browse/JENKINS-40456" rel="nofollow noreferrer">This related issue</a> was found and <a href="https://issues.jenkins-ci.org/browse/JENKINS-40456?focusedCommentId=318401&amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-318401" rel="nofollow noreferrer">a comment was added</a> on Jenkins' Jira.</p>
  
  <p>As a workaround, this suggestion was tried, but it caused a couple of issues and it is not a permanent solution.</p>
  
  <blockquote>
  <pre><code>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")
      }
  }
  </code></pre>
  </blockquote>
  
  <p><strong>Questions</strong></p>
  
  <p>The question is twofold. </p>
  
  <ul>
  <li>First, what other options are available to report build statuses from jenkins-on-steroids to <strong>bitbucket-cloud</strong> that also work if a build is run for the first time in a branch <code>(BUILD_ID==1)</code> if the <a href="https://wiki.jenkins.io/display/JENKINS/Pipeline+Multibranch+Plugin" rel="nofollow noreferrer">multi-branch plugin</a> is used?</li>
  <li>Second, if the first question cannot be answered, what steps could be taken to solve the bug?</li>
  </ul>
  
Tags: <kubernetes><jenkins-pipeline><builds><bcbsn>
Title: What options are available to report the build status of Jenkins Multi Pipeline's first branch build on k8s to bitbucket-cloud?
UserDisplayName: 030
ThreadText: # What options are available to report the build status of Jenkins Multi Pipeline's first branch build on k8s to bitbucket-cloud?
  
  (Asked by: username_0 on 2019-03-12)
  
  **Background**
  
  [The Bitbucket Status Notifier plugin](https://plugins.jenkins.io/bitbucket-build-status-notifier) has been configured. The status was reported, but since more and more jobs have been moved to Jenkins-on-steroids that is running on k8s, buildStats are not reported if a branch is built for the first time.
  
  **Aim**
  
  The aim is to report the build status to bitbucket-cloud by jenkins multi-branch when a branch is built for the first time.
  
  **Attempts to solve the issue**
  
  [This related issue](https://issues.jenkins-ci.org/browse/JENKINS-40456) was found and [a comment was added](https://issues.jenkins-ci.org/browse/JENKINS-40456?focusedCommentId=318401&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-318401) on Jenkins' Jira.
  
  As a workaround, this suggestion was tried, but it caused a couple of issues and it is not a permanent solution.
  
  > ```
  > 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")
  >     }
  > }
  >
  > ```
  
  **Questions**
  
  The question is twofold.
  
  * First, what other options are available to report build statuses from jenkins-on-steroids to **bitbucket-cloud** that also work if a build is run for the first time in a branch `(BUILD_ID==1)` if the [multi-branch plugin](https://wiki.jenkins.io/display/JENKINS/Pipeline+Multibranch+Plugin) is used?
  * Second, if the first question cannot be answered, what steps could be taken to solve the bug?
  
  **Tags:** kubernetes, jenkins-pipeline, builds, bcbsn
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-03-13. Score: 1 | Accepted answer
  
  As I was not able to tackle the bug in the Java code and the bug was already reported in 2017 I decided to write [this plugin](https://github.com/030/golang-bitbucket-cloud-build-status-notifier). This binary is able to send a build status even when a branch is built for the first time.
  
  
  ---
  
  