【问题标题】:Merge branch in release manager在发布管理器中合并分支
【发布时间】:2018-05-27 18:01:40
【问题描述】:

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

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

我想做的是,在从 Development 升级到 Master 时将 Development 分支合并到 Master,因此 master 始终具有生产版本代码,但发布代理不会拉 git repo 并且无法访问 git。我发现this 表明这是不可能的(至少没有黑客攻击)。任何指针表示赞赏。

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

【问题讨论】:

    标签: git continuous-integration azure-devops azure-pipelines-release-pipeline


    【解决方案1】:

    在 VSTS 发布环境中将开发分支合并到 master 分支,可以通过添加 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 任务中应取消选择 Fail on Standard Error 选项。

    • 如果在将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
      

    【讨论】:

    • 是的,这有点明显,但这是一个 hack,我说的是正确的做法
    • 你的意思是VSTS发布管理自动将开发分支合并到主分支吗?正如您在用户声音中发现的那样,合并操作需要由用户定制(而不是由 VSTS 本身)。
    • 我最终做了这个
    猜你喜欢
    • 2011-03-09
    • 2010-11-27
    • 2012-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-24
    • 2011-12-03
    相关资源
    最近更新 更多