预期 CircleCI "jobRef"
CircleCI Expected "jobRef"
我是 CircleCI 的新手,正在尝试设置一个项目。初始设置和提交很好地构建了配置文件,但是我需要使用环境变量,所以我尝试设置一个上下文:https://circleci.com/docs/2.0/contexts/。我用我的环境变量创建了一个上下文并将其命名为 'test-context'
这是我的配置文件:
版本:2.1
orbs:
python: circleci/python@1.2
workflows:
sample:
jobs:
- build-and-test:
context:
- test-context
jobs:
build-and-test:
- image: cimg/python:3.6
parallelism: 4
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
...
我收到以下 Linter 错误:
ERROR IN CONFIG FILE:
[#/workflows/sample] only 1 subschema matches out of 2
1. [#/workflows/sample/jobs/0] 0 subschemas matched instead of one
| 1. [#/workflows/sample/jobs/0] expected type: String, found: Mapping
| | SCHEMA:
| | type: string
| | INPUT:
| | build-and-test: null
| | context:
| | - test-context
| 2. [#/workflows/sample/jobs/0/context] expected type: Mapping, found: Sequence
| | SCHEMA:
| | type: object
| | INPUT:
| | - test-context
和 - test-context
下划线错误:Incorrect type. Expected "jobRef"
如何使用上下文将环境变量正确地集成到我的项目中?
@figbar,您在工作流程上编写它的方式存在语法问题。
你应该更正它如下。
orbs:
python: circleci/python@1.2
workflows:
sample:
jobs:
- build-and-test:
context:
- test-context
jobs:
build-and-test:
docker:
- image: cimg/python:3.6
parallelism: 4
steps:
- checkout
- python/install-packages:
- run:
...
您可以获得有关本文档上下文的更多信息。 CircleCI Context
我是 CircleCI 的新手,正在尝试设置一个项目。初始设置和提交很好地构建了配置文件,但是我需要使用环境变量,所以我尝试设置一个上下文:https://circleci.com/docs/2.0/contexts/。我用我的环境变量创建了一个上下文并将其命名为 'test-context'
这是我的配置文件: 版本:2.1
orbs:
python: circleci/python@1.2
workflows:
sample:
jobs:
- build-and-test:
context:
- test-context
jobs:
build-and-test:
- image: cimg/python:3.6
parallelism: 4
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
...
我收到以下 Linter 错误:
ERROR IN CONFIG FILE:
[#/workflows/sample] only 1 subschema matches out of 2
1. [#/workflows/sample/jobs/0] 0 subschemas matched instead of one
| 1. [#/workflows/sample/jobs/0] expected type: String, found: Mapping
| | SCHEMA:
| | type: string
| | INPUT:
| | build-and-test: null
| | context:
| | - test-context
| 2. [#/workflows/sample/jobs/0/context] expected type: Mapping, found: Sequence
| | SCHEMA:
| | type: object
| | INPUT:
| | - test-context
和 - test-context
下划线错误:Incorrect type. Expected "jobRef"
如何使用上下文将环境变量正确地集成到我的项目中?
@figbar,您在工作流程上编写它的方式存在语法问题。 你应该更正它如下。
orbs:
python: circleci/python@1.2
workflows:
sample:
jobs:
- build-and-test:
context:
- test-context
jobs:
build-and-test:
docker:
- image: cimg/python:3.6
parallelism: 4
steps:
- checkout
- python/install-packages:
- run:
...
您可以获得有关本文档上下文的更多信息。 CircleCI Context