【问题标题】:circleci filter branch is not workingcircleci 过滤器分支不工作
【发布时间】:2018-12-19 18:10:46
【问题描述】:

我是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 解决方法,但它不太优雅。

有什么建议吗?

【问题讨论】:

    标签: circleci-2.0 circleci-workflows


    【解决方案1】:

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

    所以现在我有以下配置:

    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
    

    【讨论】:

      猜你喜欢
      • 2023-01-05
      • 2012-08-01
      • 2023-03-21
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多