Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,909
Community Members
 
Community Events
184
Community Groups

Unable to resolve a class com.atlassian.bitbucket.build.BuildStatusService

Edited

Hi,

I'm trying to implement, ability to merge to develop only when a source branch on pull request got 6 successful builds. The below script doesn't throw any error when I run it through global script merge check. However, on the pull request it does not allow me to merge and shows that I need 6 successful builds even though I got 6 successful builds on the source branch. When I tried the below script on the repo level script merge check, it is  throwing the below error. 

<pre>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script484.groovy: 1: unable to resolve class com.atlassian.bitbucket.build.BuildStatusService @ line 1, column 1. import com.atlassian.bitbucket.build.BuildStatusService ^ 1 error </pre>

 

Did anyone face the similar issue? If yes, please point me in the right direction.

Below is the script I'm using.

 

import com.atlassian.bitbucket.build.BuildStatusService
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.bitbucket.auth.AuthenticationContext
import com.atlassian.bitbucket.scm.pull.MergeRequest
import com.atlassian.sal.api.component.ComponentLocator

@WithPlugin("com.atlassian.bitbucket.server.bitbucket-build")

def buildStatusService = ScriptRunnerImpl.getOsgiService(BuildStatusService)
def authenticationContext = ComponentLocator.getComponent(AuthenticationContext)

def mergeRequest = mergeRequest as MergeRequest
def pullRequest = mergeRequest.getPullRequest()
def summaries = buildStatusService.getSummaries(pullRequest.getCommits()*.id)

summaries.values().each {
log.debug("Successes:" + it.successfulCount)
}

def successfulBuild = summaries.values().find { it.successfulCount == 6 }

if ( !successfulBuild ) {
mergeRequest.veto("Unable to merge this pull reuquest", "You need 6 successful builds to merge to develop. Please contact")
}

 

 

 

 

 

1 answer

Hi Mani,

 

Did you solved this problem?

Hi @Alberto Gonzalez Tajuelo  The above script worked for me after upgrading the Script runner to latest version.

 

Thanks,
Mani

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events