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

[bamboo 5.14.3.1] How to get repositories data?

Marcin Jasiński December 19, 2016

Hello,

where I found repositories data? repositoryUrl, current branch, etc. A write plugin and I have:

//context == TaskContext
final BuildContext parentBuildContext =
        Optional.ofNullable(context.getBuildContext().getParentBuildContext())
                .orElseThrow(() -> new RuntimeException("No parent context!"));

final List<PlanRepositoryDefinition> repositories = parentBuildContext.getVcsRepositories();
 
for (final PlanRepositoryDefinition repo : repositories) {
	//repo.getBranch().getVcsBranch() // I have name or displayName methods
}

I need repository url and other informations.

Someone can help me?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 20, 2016

It depends on the repository type. Look at this:

Map<String, String> serverConfig = repo.getVcsLocation().getConfiguration();

The exact key you need to pull out of the map depends on what repository type it is.

 

 

Marcin Jasiński December 20, 2016

It works only for git repository. Configuration map for bitbucket/stash is empty.

TAGS
AUG Leaders

Atlassian Community Events