基本上,如果它不是拉取请求或某个分支,我会尝试跳过构建,但是如果失败,我似乎无法跳过工作或工作流程的一部分,到目前为止,问题是circleci step halt
确实如此我的管道中没有任何内容,此处的示例配置:
version: 2.1
orbs:
hello: circleci/hello-build@0.0.5
jobs:
build:
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker
- run:
command: |
if [[ $(echo "$CIRCLE_PULL_REQUEST $CIRCLE_PULL_REQUESTS" | grep -c "pull") -gt 0 ]]; then
echo "Do stuff if it's a PR"
else
echo "Not a PR, Skipping."
circleci step halt # does nothing
circleci-agent step halt # does nothing
exit 0
fi
workflows:
"Hello Workflow":
jobs:
- hello/hello-build:
requires:
- build
filters:
branches:
only:
- testing
- /^(?!pull\/).*$/
tags:
only:
- /^pull\/.*$/
- build:
filters:
branches:
only:
- testing
- /^(?!pull\/).*$/
tags:
only:
- /^pull\/.*$/
这不会失败,它适用于拉取请求,但hello/hello-build
无论如何都会执行circleci step halt
命令。
任何帮助将不胜感激,谢谢!