首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CircleCI:获取错误我的配置文件-“预期类型:字符串,找到:映射”

CircleCI:获取错误我的配置文件-“预期类型:字符串,找到:映射”
EN

Stack Overflow用户
提问于 2021-05-31 21:20:31
回答 1查看 2.6K关注 0票数 1

我正在尝试创建一个CircleCI管道,但始终得到以下错误:

代码语言:javascript
复制
#!/bin/sh -eo pipefail
# ERROR IN CONFIG FILE:
# [#/jobs/build] 0 subschemas matched instead of one
# 1. [#/jobs/build] only 1 subschema matches out of 2
# |   1. [#/jobs/build] no subschema matched out of the total 2 subschemas
# |   |   1. [#/jobs/build] 0 subschemas matched instead of one
# |   |   |   1. [#/jobs/build] required key [docker] not found
# |   |   |   2. [#/jobs/build] required key [machine] not found
# |   |   |   3. [#/jobs/build] required key [macos] not found
# |   |   2. [#/jobs/build] required key [executor] not found
# |   |   |   A job must have one of `docker`, `machine`, `macos` or `executor` (which can provide docker/machine/macos information).
# 2. [#/jobs/build] expected type: String, found: Mapping
# |   Job may be a string reference to another job
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

我的config.yaml

代码语言:javascript
复制
version: 2.1
workflows:
  version: 2
  testing-workflow:
    jobs:
      - build:
          context: testing
          filters:
            branches:
              only: 
                - develop
jobs:
  build:
    steps:
      - aws-ecr/build-and-push-image:
          account-url: AWS_ECR_ACCOUNT_URL
          create-repo: false
          dockerfile: Dockerfile
          region: AWS_DEFAULT_REGION
          repo: $AWS_ECR_REPO_NAME
          tag: "latest,$(git rev-parse HEAD)"
orbs:
  slack: circleci/slack@3.4.2
  kubernetes: circleci/kubernetes@0.11.0
  aws-eks: circleci/aws-eks@0.2.7
  helm: circleci/helm@0.2.3
  aws-ecr: circleci/aws-ecr@6.8.2

不知道为什么我会得到这个错误,但我希望它不应该是一些缩进错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-31 21:42:35

据我所知,在定义作业时,您需要定义它是否在特定的坞映像、macos机器、windows机器或普通ci机器中运行。

https://circleci.com/docs/2.0/configuration-reference/?section=reference#docker-machine-macos-windows-executor

看起来你想做常规机器,所以你需要做

代码语言:javascript
复制
version: 2.1
workflows:
  version: 2
  testing-workflow:
    jobs:
      - build:
          context: testing
          filters:
            branches:
              only: 
                - develop
jobs:
  build:
    machine: true
    steps:
      - aws-ecr/build-and-push-image:
          account-url: AWS_ECR_ACCOUNT_URL
          create-repo: false
          dockerfile: Dockerfile
          region: AWS_DEFAULT_REGION
          repo: $AWS_ECR_REPO_NAME
          tag: "latest,$(git rev-parse HEAD)"
orbs:
  slack: circleci/slack@3.4.2
  kubernetes: circleci/kubernetes@0.11.0
  aws-eks: circleci/aws-eks@0.2.7
  helm: circleci/helm@0.2.3
  aws-ecr: circleci/aws-ecr@6.8.2
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67780330

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档