Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Does a programmatic method exist to create Linked Repositories?

I'm leveraging all of the goodness of Spec Plans, but it depends heavily on an existing Linked Repository.

Here is what I have so far:

Step 1 - Use the Bitbucket API to setup a code repository [scripted]

Step 2 - Log into Bitbucket, create 'Linked Repository' (LR) to new code repo [manual]

Step 3 - Execute java Spec Plan to create a Bamboo Build Plan (linked to the LR) [scripted]

You can see the significant interrupt in my attempt to create a push-button setup.

 

The closest I find is Bob Swift's CLI tool. While neat, I don't have local Bamboo Admin access.

All actions must be via API or remotely.

Thanks in advance!

2 answers

2 votes

Try Bamboo Specs for linked repositories management

BambooServer bambooServer = new BambooServer("http://localhost:6990/bamboo");
final GitRepository gitRepository = new GitRepository()
.name("Test repository")
.url("https://bitbucket.org/user/test.git")
.branch("master")
.authentication(new UserPasswordAuthentication("user")
.password("password"))
.changeDetection(new VcsChangeDetection());
bambooServer.publish(gitRepository);

Thanks Alexey, but a recent article indicates that global linked repository are preferred and that manually configured repository are to be deprecated. So I was hoping to adopt the preferred method. 

Article - https://confluence.atlassian.com/bamboo/linking-to-source-code-repositories-671089223.html

This code creates global linked repository

Hi @Alexey Chystoprudov 

Will above code create linked repository and how to enable scan for bamboo specs in this code. I want to create linked repository with scan bamboo specs in bitbucket. So can I do it in java.

@Hema , it will create repository. Then you need to enable Specs detection https://docs.atlassian.com/atlassian-bamboo/REST/6.9.0/#d2e4449

curl -u admin:admin -X PUT http://localhost:8085/rest/api/latest/repository/123/enableCi

Then you also need to grant permissions to particular projects or grant access for this repo to all your projects

Unfortunately there's no Rest API to get repo id by its name so you need to get it manually through UI. You can watch and vote for https://jira.atlassian.com/browse/BAM-20007 to address it.

Hi @Alexey Chystoprudov ,

Thanks for response.

I created plan using bitbucket spec repository but when I saw bamboo plan, it is not allowing to edit on bamboo. Showing message like edit this plan using bitbucket spec repository. So can you please help me if I want to create plan using butbucket repo as well modify changes using bamboo UI.

Also how to enable scan for bamboo spec using bamboo java spec

Once plan is managed by repository you can't edit it by UI. If you need to turn it off - publish it from local environment by command executed at bamboo-specs folder of your repo.

mvn -Ppublish-specs 

It's not possible to enable Bamboo Specs property of repository from Bamboo Specs

Like Jeyanthan I likes this

Hi @Alexey Chystoprudov 

I have created bamboo spec stored in bitbucket repository and created lonked repository in bamboo, enabled scan for spec. But when bamboo scan for spec, it is asking for ssh private and public key for plan repository stored in bitbucket RSS. If I mentioned public and private key then it publish plan repository in plan. So if any other user change in spec then will it work for him.

What exactly consists in public and private key ie is it specific to user

0 votes
Jeyanthan I Atlassian Team Apr 03, 2018

Hi Chad,

Bamboo does not provide the REST end point to create a new linked repository (yet as of Bamboo 6.4.1). I found an open feature request for this - BAM-18453

I recommend you vote for it and comment to get it prioritised.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

190 views 4 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you