I'm writing a script to setup a training environment on git and Atlassian Stash (aka Bitbucket Server) using the REST API. I'm creating projects and repositories, populating the repositories...
I'd like to configure the 'Branching Model' for my repositories in that script as well.
I haven't found how to do it via the REST API. What did I miss?
I'm using Atlassian Stash v3.2.4
Thanks in advance.
(If it can help someone)
I've been able to setupo the branching model on Stash/Bitbucket servers (Stash v3.11.2, Bitbucket 4.8.3, I haven't tested other versions) :
$CURL -X PUT -H 'Content-Type: application/json' \
-d '{"development":{"refId":"refs/heads/develop", "useDefault":false}, \
"production":{"refId":"refs/heads/master","useDefault":false}, \
"types":[ \
{"id":"BUGFIX","displayName":"Bugfix","enabled":true,"prefix":"bugfix/"}, \
{"id":"FEATURE","displayName":"Feature","enabled":true,"prefix":"feature/"}, \
{"id":"HOTFIX","displayName":"Hotfix","enabled":true,"prefix":"hotfixme/"}, \
{"id":"RELEASE","displayName":"Release","enabled":true,"prefix":"release/"} \
]}' \
${SERVER}/rest/branch-utils/1.0/projects/$key/repos/$slug/branchmodel/configuration
with
$CURL
: curl -s -u USER:PASSWORD
(and some others options like -k
--noproxy
...)
$SERVER
: the URL to the server
$key
: the project key
$slug
: the slug (~ the name) of the repository
Hope this helps...
Cheers.