代码之家  ›  专栏  ›  技术社区  ›  Ehud Lev

Circleci筛选器分支不工作

  •  0
  • Ehud Lev  · 技术社区  · 8 年前

    我是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解决问题,如果没有,但它就不那么优雅了。

    有什么建议吗?

    1 回复  |  直到 8 年前
        1
  •  1
  •   Ehud Lev    8 年前

    我只是在工作流名称后面缺少冒号字符,另外还有更多的过滤器缩进。

    现在我有了以下配置:

    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
    
    推荐文章