【问题标题】:Can I setup Branching Model in Atlassian Stash with REST API?我可以使用 REST API 在 Atlassian Stash 中设置分支模型吗?
【发布时间】:2016-11-09 13:49:33
【问题描述】:

我正在编写一个脚本来使用 REST API 在 git 和 Atlassian Stash(又名 Bitbucket 服务器)上设置训练环境。 我正在创建项目和存储库,填充存储库...

我还想在该脚本中为我的存储库配置“分支模型”。

我还没有找到如何通过 REST API 做到这一点。 我错过了什么?

我正在使用 Atlassian Stash v3.2.4

提前致谢。

【问题讨论】:

    标签: git git-flow bitbucket-server bitbucket-api


    【解决方案1】:

    (如果它可以帮助某人)

    我已经能够在 Stash/Bitbucket 服务器上设置分支模型(Stash v3.11.2,Bitbucket 4.8.3,我还没有测试其他版本):

      $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
    

    $CURLcurl -s -u USER:PASSWORD(以及其他一些选项,例如 -k --noproxy...)
    $SERVER:服务器的 URL
    $key:项目密钥
    $slug: 存储库的 slug(~名字)

    希望这会有所帮助...

    干杯。

    【讨论】:

    • 在 Atlassian Bitbucket v5.9.0 中也能正常工作
    • @elbeho,通过这个,我们如何在分支模型配置中启用自动合并选项?
    【解决方案2】:

    很遗憾,目前还没有 REST API。这是我们想在未来版本中添加的东西,但它还没有在短期路线图上。

    也就是说,Stash 3.2 大约 18 个月大,我强烈建议升级到 Bitbucket Server 4.x(Stash 更名为 4.0),从那时起(到目前为止)的 17 个版本中有很多改进。

    【讨论】:

    • 感谢您的信息。不幸的是,升级的决定不在我手中(尽管我正在推动它)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多