Access a Component Object from Bamboo in a Bitbucket Merge Check Plugin

I have a merge check plugin where I want to get the list of failing tests associated with a given PR. I tried to import and use the BuildResultsSummaryManager (BuildResultsSummaryManager (Atlassian Bamboo 6.3.0 API)) interface in my merge check but it’s not working.

Is it possible to use a component from a different Atlassian product in my Bitbucket Merge Check?

1 Like

Hi Joel,

you cannot use components across products.
For Bitbucket use com.atlassian.bitbucket.build.BuildStatusService

Example

        final String csid = pullRequest.getFromRef().getLatestCommit();
        BuildSummary summary = securityService.withPermission(Permission.LICENSED_USER, "Escalated permission for anonymous 2LO").call(new UncheckedOperation<BuildSummary>() {
            @Override
            public BuildSummary perform() {
                return buildStatusService.getSummary(csid);

            }
        });

        if (summary != null) {
            int successfulCount = summary.getSuccessfulCount() - summary.getFailedCount() - summary.getInProgressCount();
            if (log.isDebugEnabled())
                log.debug(String.format("Successful Builds for csId %s : %s", csid, successfulCount));
            return successfulCount;
        }

        return 0;