在发布管理器中合并分支

Merge branch in release manager

我有一个发布管理发布管道,其设置如下:

Artifacts >> Development (trigger on build success) >> Production (manual trigger after Development)

我想做的是,在从开发分支升级到主分支时将开发分支合并到主分支中,因此主分支始终具有生产版本代码,但发布代理不会拉取 git 回购并且无权访问git。我发现 this 这表明这是不可能的(至少没有黑客)。任何指点表示赞赏。

我正在使用 github.com,而不是 vsts 存储库。

要在 VSTS 发布环境中将开发分支合并到主分支,可以通过添加 PowerShell 任务 来实现。详情如下:

使用脚本添加 PowerShell 任务:

git clone https://username:password@github.com/username/repo repo
cd repo
git checkout development
git checkout master
git merge development 
git push origin master

注:

  • 应在 PowerShell 任务中取消选择标准错误失败选项。

  • 如果在将 development 分支合并到 master 分支期间发生合并冲突,PowerShell 任务将失败。所以你最好为 git merge 命令添加 -X 选项:

    git merge development -X theirs  #Resolve the merge conflict files by keeping the version on development branch
    git merge development -X ours    #Resolve the merge conflict files by keeping the version on master branch