【发布时间】:2020-01-30 04:27:54
【问题描述】:
我在 CodeBuild 中有一个构建规范,它使用 CodeBuild 中的 Source 中引用的源从不同的存储库下载 2 个分支(develop 和 refactored_branch)。我有一个脚本,通过将开发分支中的一些文件复制到 refactored_branch 来进行一些更改。当我完成文件的复制时,我想将所有这些更改从 refactored_branch 复制到另一个已经存在的分支 (branch_to_be_pushed),该分支与 refactored_branch 位于同一个仓库中,并将 branch_to_be_pushed 推送到 github?我尝试了 git checkout branch_to_be_pushed 然后 git pull refactored branch 甚至 git merge refactored_branch 但没有运气。构建规范看起来像这样:
pre_build:
commands:
- cd $CODEBUILD_SRC_DIR
- pwd
- git checkout develop
- cd $CODEBUILD_SRC_DIR_Source2
- pwd
- git checkout refactored_branch
- git config --global user.email $User
commands:
- ./bin/deploy.py -src1=$CODEBUILD_SRC_DIR -src2=$CODEBUILD_SRC_DIR_Source2
post_build:
commands:
- cd $CODEBUILD_SRC_DIR_Source2
- pwd
- ls -la
- git status
- git branch
- git checkout branch_to_be_pushed
- git status
- git branch
- git add .
- git commit -m "push changes"
- pwd
- ls -la
- git push https://$User:$Pass@github.com/xxxxxx/xxxxx-xxxxxx-xxxx.git
【问题讨论】:
-
请提供构建日志,以便我们知道哪个命令因什么错误而失败。它与git凭据有关吗?你的建筑挂了吗?您在 BuildSpec 文件中使用的版本是什么(0.1 还是 0.2?)。
标签: git amazon-web-services aws-codebuild