circleci中的邮递员-调用工作流程时出错:'workflow'

问题描述 投票:0回答:2

尝试运行简单的邮递员API调用但获得

Error calling workflow: 'workflow'

我的.circleci/config.yml

$ cat .circleci/config.yml 
version: 2.1
orbs:
  newman: postman/[email protected]
jobs:
  newman-collection-run:
    executor: newman/postman-newman-docker
    steps:
      - checkout
      - newman/newman-run:
          collection: ./collection.json

collection.json是项目的根,是邮递员的导出。

我正在使用来自的示例

https://circleci.com/orbs/registry/orb/postman/newman

显示:

enter image description here

““工作流”引用来自我在此分支上开始构建时,circleci站点上的原始示例(不适用于newman),并且我替换了分支中的配置文件内容并推送了它,因此不确定为什么此引用是快来了吗?

这是原始屏幕:

enter image description here

我改为:

enter image description here

enter image description here

api postman circleci newman
2个回答
0
投票

我相信原始的config.yml文件缺少build:步骤,该步骤位于executor:行之前。

version: 2.1
orbs:
  newman: postman/[email protected]
jobs:
  build:
    executor: newman/postman-newman-docker
    steps:
      - checkout
      - newman/newman-run:
          collection: ./collection.json

0
投票

如果您读到遗漏的错误所在的行(请参阅the build,您会看到为什么调用工作流程时出错:

# Error calling workflow: 'workflow'
# Cannot find a definition for job named build

此要求已记录在案in the config file reference(重点为我:)

如果不使用工作流程,则jobs映射必须包含工作命名为build。此build作业是运行的默认入口点这是由向您的VCS提供者推送请求触发的。有可能然后指定其他作业并使用CircleCI API运行它们。

但是为什么要在名为工作流的工作流中寻找名为build的工作?因为如果您没有明确提供工作流程,CircleCI将使用以下默认值:

workflows:
  version: 2
  workflow:
    jobs:
    - build

您可以通过使用CircleCI's Local CLIcircleci config process .circleci/config.yml中的固定版本上运行Danny's answer来看到。

这表明该问题的另一种解决方案;而不是重命名工作,提供工作流程

version: 2.1
orbs:
  newman: postman/[email protected]
jobs:
  newman-collection-run:
    executor: newman/postman-newman-docker
    steps:
      - checkout
      - newman/newman-run:
          collection: ./collection.json
workflows:
  version: 2
  workflow:
    jobs:
    - newman-collection-run

作为旁注,当我想知道我是否能弄清楚在最初的构建失败时看到了什么消息时,这就是我遇到的问题:

* 37737f0 - (HEAD -> master, origin/master, origin/HEAD) config (22 hours ago) <Michael Durrant>
* e04efa0 - config (22 hours ago) <Michael Durrant>
*   e640e4e - merge into master (26 hours ago) <Michael Durrant>
|\
| * cc16160 - config (27 hours ago) <Michael Durrant>
| * 13e0ad5 - config (28 hours ago) <Michael Durrant>
| * e4df02c - config (28 hours ago) <Michael Durrant>
| * b287102 - config (28 hours ago) <Michael Durrant>
| * 14bd61c - config (28 hours ago) <Michael Durrant>
| * 0f81d84 - config (28 hours ago) <Michael Durrant>
| * ccd06b6 - config (28 hours ago) <Michael Durrant>
| * 2b909f3 - config (28 hours ago) <Michael Durrant>
| * 4b15bca - config (28 hours ago) <Michael Durrant>
| * 240c591 - config (28 hours ago) <Michael Durrant>
| * 50096a9 - config (28 hours ago) <Michael Durrant>
| * ad9fe60 - config (28 hours ago) <Michael Durrant>
| * 7c19205 - config (28 hours ago) <Michael Durrant>
| * 3c0a3b9 - config (28 hours ago) <Michael Durrant>
| * 2d1954e - config (29 hours ago) <Michael Durrant>
| * 4e1f087 - config (29 hours ago) <Michael Durrant>
| * 9413b68 - config (29 hours ago) <Michael Durrant>
| * 942d493 - config (29 hours ago) <Michael Durrant>
| * e8412b8 - config (29 hours ago) <Michael Durrant>
| * c136702 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * 2203710 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * 94a084e - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * ec40356 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * 6964057 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
* | 4e5c9d1 - coinfig (30 hours ago) <Michael Durrant>
* | cbf49fd - workflow name (30 hours ago) <Michael Durrant>
* | 6245ae1 - workflow name (30 hours ago) <Michael Durrant>
* | fdf52b5 - workflow name (30 hours ago) <Michael Durrant>
* | 0c4c455 - workflow name (30 hours ago) <Michael Durrant>
|/
* 7c31fb6 - update circleci config (30 hours ago) <Michael Durrant>

这不是使用git的健康方法;如果您不打算给自己的未来提供足够的背景信息来了解正在发生的变化,那么我建议您将所有更改提交到主机中时,将所有多余的提交压缩掉。

注意,通过运行circleci config validate,您可以使用CLI在本地获取有关基本配置文件故障的错误消息,这样可以避免推送所有无法执行的提交的循环。

© www.soinside.com 2019 - 2024. All rights reserved.