How do I add new Git repositories automatically to Crucible (fisheye)?

2.1k views Asked by At

I am using Crucible v3.3.3.

I can easily add new repositories via Web-Interface.

Can we add new repositories via REST, command line? Is there any other way rather than web-interface?

2

There are 2 answers

0
user3984032 On BEST ANSWER

You should review the Crucible API documentation. I believe you can query for a list of repositories, I am not sure if you can add a repository, but the API docs should answer the question.

0
Mac On

Managing repositories REST API was extended in Crucible 3.4 and 3.5.

Have a look at this endpoint: https://docs.atlassian.com/fisheye-crucible/latest/wadl/fecru.html#rest-service-fecru:admin:repositories (added to Crucible 3.4).

To create a repository send a POST to rest-service-fecru/admin/repositories with the following payload (git repository example):

{
  "type" : "git",
  "name" : "myGitRepo",
  "description" : "My GIT repo",
  "storeDiff" : true,
  "enabled" : true,
  "git" : {
    "location" : "[email protected]:atlassian/fecru-rest-examples.git",
    "auth" : {
      "authType" : "key-generate"
    },
    "commandTimeout" : "1 hour"
  }
}

You can do updates / partial updates by sending a PUT to rest-service-fecru/admin/repositories/[name] with the following payload (change description and disable repository example):

{
  "description" : "My old GIT repo",
  "enabled" : false
}

You can list all (paged) repositories by sending a GET to rest-service-fecru/admin/repositories or get specific repository settings by sending a GET to rest-service-fecru/admin/repositories/[name]

Have a look at the documentation for all other repository REST admin options.