当代码被推送到master时,circleci运行,但是circleci在名为Version Package Bump
的运行脚本中推送到master本身。所以在第一次构建之后,第二次运行。但它失败了
在Branch Master上,您的分支是最新的“origin/master”。
没有提交,工作目录干净退出代码1
如何确保Circleci不会再次从自身引起的推送启动?
jobs:
build:
docker:
- image: circleci/node:8.10.0
branches:
only:
- master
steps:
- add_ssh_keys
- checkout
- run:
name: Keyscan DreamHost (HACK)
command: ssh-keyscan -H HOST >> ~/.ssh/known_hosts
- run:
name: Install Dependencies
command: npm install
- run:
name: Build App
command: npm run build
- run:
name: Verion Package Bump
command: |
git config user.name "circleci"
git config user.email "EMAIL"
git add .
git commit -m "[ci] Generated Build"
npm version patch -m "[ci] Bumped version number to %s"
git push origin master
git push --tags
- deploy:
name: Publish to DreamHost
command: scp -r build/* HOST:./DIRECTORY/
即使我将它包装在一个条件中,我仍然会看到相同的错误和生成发生两次:
if ! git diff-index --quiet HEAD --; then
git config user.name "circleci"
git config user.email "EMAIL"
git add .
git commit -m "[ci] Generated Build"
npm version patch -m "[ci] Bumped version number to %s"
git push origin master
git push --tags
fi
最佳答案
在提交消息的任何位置添加[ci skip]
或[skip ci]
标记。
见https://circleci.com/docs/2.0/skip-build/
替换您的
git commit -m "[ci] Generated Build"
具有
git commit -m "[ci skip] Generated Build"
或
git commit -m "Generated Build [skip ci]"
关于git - 如何确保CircleCi忽略由CircleCi本身引起的对母版的推送?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54546137/