What is wrong with my orb-based config? I get schema errors for aws-cli/ commands?

#1

I’m going crazy here. I’ve copied and pasted and even moved the “version: 2.1” row to different places in my config but always get schema errors like

# ERROR IN CONFIG FILE:
# [#/jobs/build-docker] 0 subschemas matched instead of one
# 1. [#/jobs/build-docker] only 1 subschema matches out of 2
# |   1. [#/jobs/build-docker/steps/2] 0 subschemas matched instead of one
# |   |   1. [#/jobs/build-docker/steps/2] expected type: String, found: Mapping
# |   |   |   Shorthand commands, like `checkout`
# |   |   |   SCHEMA:
# |   |   |     type: string
# |   |   |   INPUT:
# |   |   |     configure: null
# |   |   |     aws-access-key-id: AWS_ECR_USER_KEY
# |   |   |     aws-secret-access-key: AWS_ECR_USER_SECRET
# |   |   |     aws-region: AWS_DEFAULT_REGION
# |   |   2. [#/jobs/build-docker/steps/2] maximum size: [1], found: [3]
# |   |   |   long form commands like `run:`
# |   |   |   SCHEMA:
# |   |   |     maxProperties: 1
# |   |   |   INPUT:
# |   |   |     configure: null
# |   |   |     aws-access-key-id: AWS_ECR_USER_KEY
# |   |   |     aws-secret-access-key: AWS_ECR_USER_SECRET
# |   |   |     aws-region: AWS_DEFAULT_REGION
# 2. [#/jobs/build-docker] expected type: String, found: Mapping
# |   Job may be a string reference to another job

I’m sure it’s something trivial, please help - here are some relevant parts of the config.yml file:

restore-npm: &restore-npm
  restore_cache:
    name : Restore NPM Cache
    keys:
      - npm-cache-{{ checksum "package.json" }}-{{ .Branch }}
      - npm-cache-{{ checksum "package.json" }}
      - npm-cache-

restore-yarn: &restore-yarn
  restore_cache:
    name : Restore Yarn Cache
    keys:
      - yarn-cache-{{ checksum "yarn.lock" }}
      - yarn-cache-

restore-meteor-packages: &restore-meteor-packages
  restore_cache:
    name: Restore Meteor Package Cache
    keys:
      - packages-cache-{{ checksum ".meteor/versions" }}
      - packages-cache-

restore-typescript: &restore-typescript
  restore_cache:
    name: Restore Typescript Cache
    keys:
      - typescript-cache-{{ .Branch }}
      - typescript-cache-

orbs:
  aws-cli: circleci/aws-cli@0.1.13

jobs:
...
  build-docker:
    machine: true
    steps:
      - checkout
      - aws-cli/install
      - aws-cli/configure:
        aws-access-key-id: AWS_ECR_USER_KEY
        aws-secret-access-key: AWS_ECR_USER_SECRET
        aws-region: AWS_DEFAULT_REGION
      - attach_workspace:
          at: bundle # must be in working directory
...
workflows:
  build:
    jobs:
      - test
      - build-bundle
      - build-docker:
          context: "AWS ECR"
          requires:
            - test
            - build-bundle

version: 2.1
#2

It’s hard to saw what’s wrong without seeing the complete config. What I can say is that if you are using 2.1 config, you probably don’t need YAML anchors. There’s built-in ways to handle that kind of stuff with CircleCI v2.1.