1

我是circleci的新手,我试图将我的构建限制为仅在特定分支上工作,我尝试了以下配置文件,但是当我包含过滤器部分时,我收到以下错误:

Your config file has errors and may not run correctly:
2 schema violations found
  required key [jobs] not found
  required key [version] not found

配置过滤器:

version: 2
jobs:
  provisioning_spark_installation_script:
    working_directory: ~/build_data
    docker:
      - image: circleci/python:3.6.6-stretch
    steps:
      - setup_remote_docker:
          docker_layer_caching: true
      - checkout
      - run: &install_awscli
               name: Install AWS CLI
               command: |
                 sudo pip3 install --upgrade awscli
      - run: &login_to_ecr
               name: Login to ECR
               command: aws ecr get-login --region us-east-1 | sed 's/-e none//g' | bash
workflows:
  version: 2
  deployments:
    jobs:
      - provisioning_spark_installation_script
        filters:
          branches:
            only: master

当我删除过滤器部分时,一切正常 - 但没有过滤器,我知道如何使用 shell 和 if else 但它不那么优雅。

有什么建议吗?

4

1 回答 1

4

除了过滤器的更多缩进之外,我只是在工作流名称后缺少冒号字符。

所以现在我有以下配置:

version: 2
jobs:
  provisioning_spark_installation_script:
    working_directory: ~/build_data
    docker:
      - image: circleci/python:3.6.6-stretch
    steps:
      - setup_remote_docker:
          docker_layer_caching: true
      - checkout
      - run: &install_awscli
               name: Install AWS CLI
               command: |
                 sudo pip3 install --upgrade awscli
      - run: &login_to_ecr
               name: Login to ECR
               command: aws ecr get-login --region us-east-1 | sed 's/-e none//g' | bash
workflows:
  version: 2
  deployments:
    jobs:
      - provisioning_spark_installation_script:
          filters:
            branches:
              only: master
于 2018-07-12T11:00:31.153 回答