基本上,我想跳过构建,如果它不是拉取请求或特定分支,但是如果失败了,我似乎无法跳过作业或工作流的一部分,到目前为止,问题在于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
命令。
感谢任何帮助!