0

Background

The Bitbucket Status Notifier plugin 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 was found and a comment was added 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 is used?
  • Second, if the first question cannot be answered, what steps could be taken to solve the bug?
030
  • 13,383
  • 17
  • 76
  • 178

1 Answers1

1

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. This binary is able to send a build status even when a branch is built for the first time.

030
  • 13,383
  • 17
  • 76
  • 178