【发布时间】:2017-05-13 14:32:11
【问题描述】:
我有一个包含两个分支的存储库:master 和 Dev,我想以这样一种方式配置该管道,以便当我将代码推送到 Dev 分支和代码构建成功,Dev 合并到 master。不幸的是,我在 bitbucket piplines docs 中找不到任何有关合并的信息。
这是我的 yml 文件:
pipelines:
branches:
Dev:
- step:
script:
- ant deployCodeCheckOnly -Dsf.username=$SF_USERNAME -Dsf.password=$SF_PASSWORD
有人可以帮我处理这个案子吗?可以吗?
--编辑
我尝试按照建议更改脚本:
pipelines:
branches:
Dev:
- step:
script:
- ant deployCodeCheckOnly -Dsf.username=$SF_USERNAME -Dsf.password=$SF_PASSWORD
- git remote -v
- git fetch
- git checkout master
- git merge Dev
- git push -v --tags origin master:master
结果:
git remote -v
+ git remote -v
origin git@bitbucket.org:repository/project.git (fetch)
origin git@bitbucket.org:repository/project.git (push)
git fetch origin
+ git fetch origin
Warning: Permanently added the RSA host key for IP address ..... to the list of known hosts.
还有错误:
+ git checkout master
error: pathspec 'master' did not match any file(s) known to git.
--解决方案
Dev:
- step:
script:
- ant deployCodeCheckOnly -Dsf.username=$SF_USERNAME Dsf.password=$SF_PASSWORD
- git fetch
- git checkout -b master
- git merge Dev
- git push -v --tags origin master:master
【问题讨论】:
-
git checkout master失败并出现pathspec错误但git checkout -b master成功的原因是因为 Bitbucket Pipelines 仅将正在构建的分支拉到运行管道的构建代理。它的 repo 克隆中没有master分支,所以你必须创建它。然后表明你的推送应该去上游origin master。
标签: bitbucket bitbucket-pipelines