I have N build plans for one branch in Bitbucket server (git).
If I commit and push to my branch build plans are trigger and N-1 plans fails and only 1 succeed (It's wanted behavior)
But in the Bitbucket server I have red icon which inform me that build fail which is not right (in my situation).
Is there any option to tell bitbucket that only "one succeeded build is enough" (at least one succeed is enaugh)?
I use Bitbucket Server (hosted in office) and own instance of Bamboo
HI @Jan Kubalek
If you check out the source code from the particular branch and run the build automatically/manual it will display the build status on that particular branch and the build status for branch level which is great for the distributed team.
I don't think so we can restrict red icon which informs you once the build was failed.
Yeah, thanks for reply :).
I am going to write plugin for that but I do not know if I can modify build status by plugin api.
Is there any API call for retrieve and modify build branch status on Bitbucket?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please visit this article maybe it will help you on this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the link.
I was looking at Bitbucket Build Plugin Api but I found only Event
If anyone knows If there is a public plugin API for manage commit build results at Bitbucket...?
Or - how can I use Bitbucket REST from Bitbucket plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To adjust build-status directly within a plugin use com.atlassian.bitbucket.build.BuildStatusService:
@ComponentImport
private final BuildStatusService buildStatusService;
Here's an example from my own add-on's source code (Bit-Booster - Rebase Squash Amend). This example also includes use of an EscalatedSecurityContext so you can set the build-status without needing a valid authenticated user in the current context.
In this particular example I'm changing a pre-existing "BuildStatus bs" to mark it as successful.
Set<Permission> perms = Sets.newHashSet(LICENSED_USER, REPO_READ);
EscalatedSecurityContext ctx = securityService.withPermissions(perms, "UsefulName");
BuildStatusSetRequest bssr = new BuildStatusSetRequest.Builder(commitId)
.dateAdded(new Date())
.description(bs.getDescription())
.key(key)
.name(bs.getName())
.state(BuildState.SUCCESSFUL)
.url(bs.getUrl())
.build();
Operation<Boolean, RuntimeException> setOp =
new Operation<Boolean, RuntimeException>() {
@Override
public Boolean perform() throws RuntimeException {
buildStatusService.set(bssr);
return true;
}
};
ctx.call(setOp);
Background about this particular code (OT for this thread):
It helps avoid nasty rebase fights in fast-forward-only shops where the branch has build status SUCCESS but a rebase resets the build status to IN_PROGRESS. Rebase fights can cause brutal productivity losses across a team if the build is a little slow (e.g., 5 mins or worse), since fast-forward-only policy creates a serialization of commits, which can contribute to a bit of a livelock (e.g., "most recent rebase wins, but each rebase triggers a 12 minute build...").
My plugin uses "git patch-id" as a heuristic to pre-determine if the branch's build post-rebase will probably succeed, since the rebase was clean and is essentially an immaterial change to the branch. Nonetheless if the build eventually returns with FAILURE that is respected. It's only during the IN_PROGRESS state that the heuristic is used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for really nice example :).
I gues that code sample is part of BuildStatusSetEvent event?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct! The example code above was all inside the following method:
@EventListener
public void onBuildStatusEvent( BuildStatusSetEvent event ) {
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks all for help. Code works perfectly. Now I need get data about build plans from bamboo.
So I create new question for that.
Thanks :).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.