此处不允许使用 YAML 映射值 - 可能存在缩进问题?

YAML mapping values are not allowed here - possible indentation issue?

所以我正在尝试学习 CircleCI 并一直在学习入门教程:https://circleci.com/docs/2.0/getting-started/

config.yml:

version: 2
 jobs:
   one:
     docker:
       - image: circleci/ruby:2.4.1
     steps:
       - checkout
       - run: echo "A first hello"
       - run: sleep 25
   two:
     docker:
       - image: circleci/ruby:2.4.1
     steps:
       - checkout
       - run: echo "A more familiar hi"
       - run: sleep 15
 workflows:
   version: 2
   one_and_two:
     jobs:
       - one
       - two

这个returns

Error: Unable to parse YAML
mapping values are not allowed here
 in 'string', line 2, column 6:
     jobs:
         ^

我不明白这个问题。从文档来看,它似乎是正确的缩进级别。那么这个错误的根源到底是什么?

文档清楚地表明 versionjobs 必须处于同一缩进级别。如果缩进 jobs 更多,则将其作为标量 2.

的一部分

这将是有效的 YAML:

version: 2
 jobs

并且等于:

version: 2 jobs

但是,jobs 之后的 : 使其无效,因为 YAML 不允许隐式密钥是多行的(version: 将是一个适当的隐式密钥)。

要修复错误,只需缩进 jobs 不超过 version