CircleCI 引发错误:找不到步骤路径过滤/filtercci-语言服务器的声明

问题描述 投票:0回答:1

我正在尝试使用 CircleCI 的路径过滤 orb 根据 github 存储库中的文件夹在未来 PR/提交期间被修改来创建 2 个单独的工作流程。

但是 CircleCI 配置验证显示:

Error: config compilation contains errors: config compilation contains errors: Error calling workflow: 'always-run' Error calling job: 'check-updated-files' Cannot find a definition for command named path-filtering/filter

CircleCI web 在其网站上显示此错误:配置文件中的错误: [#/workflows/always-run] 2 个子模式中只有 1 个匹配

这是深入的,完全遵循路径过滤orb文档示例一步一步

这是我的 config.yml 代码:

version: 2.1

setup: true

orbs:
  path-filtering: circleci/[email protected]
  terraform: circleci/[email protected]
  aws-cli: circleci/[email protected]

workflows:
  always-run:
    when:
      or:
        - equal: [ main, << pipeline.git.branch >> ]
        - equal: [ beta, << pipeline.git.branch >> ]
    jobs:
      - path-filtering/filter:
        name: check-updated-files
        base-revision: main
        config-path: .circleci/continue_config.yml
        mapping: |
          lambda/staging/.*: run-lambda-staging-job true
          lambda/production/.*: run-lambda-production-job true

这是 continue_config.yml 代码:

version: 2.1

orbs:
  terraform: circleci/[email protected]
  aws-cli: circleci/[email protected]

parameters:
  run-lambda-staging-job:
    type: boolean
    default: false
  run-lambda-production-job:
    type: boolean
    default: false

jobs:

  project_checkout:
    machine:
      image: ubuntu-2004:202201-02
      docker_layer_caching: true
    steps:
      - checkout
      - persist_to_workspace:
          root: .
          paths:
            - .
            
  plan_infrastructure:
    executor: terraform/default
    steps:
      - attach_workspace:
          at: "./"
      - terraform/init:
          path: terraform/environments/$ENV
          backend_config: |
            access_key=$AWS_ACCESS_KEY_ID$ENV_SUFFIX,
            secret_key=$AWS_SECRET_ACCESS_KEY$ENV_SUFFIX
      - terraform/plan:
          path: terraform/environments/$ENV
          var: |
            terraform_aws_access_key=$AWS_ACCESS_KEY_ID$ENV_SUFFIX
            terraform_aws_secret_key=$AWS_SECRET_ACCESS_KEY$ENV_SUFFIX
      - persist_to_workspace:
          paths:
            - "."
          root: "~"

  apply_infrastructure:
    executor: terraform/default
    steps:
      - attach_workspace:
          at: "./"
      - terraform/apply:
          path: terraform/environments/$ENV
          backend_config: |
            access_key=$AWS_ACCESS_KEY_ID$ENV_SUFFIX,
            secret_key=$AWS_SECRET_ACCESS_KEY$ENV_SUFFIX
          var: |
            terraform_aws_access_key=$AWS_ACCESS_KEY_ID$ENV_SUFFIX
            terraform_aws_secret_key=$AWS_SECRET_ACCESS_KEY$ENV_SUFFIX
      - persist_to_workspace:
          paths:
            - "."
          root: "~"

# workflows, most of which are conditionally
# executed based upon pipeline parameter values. Each workflow calls a
# specific job defined above, in the jobs section.
workflows:

  staging:
    when: << pipeline.parameters.run-lambda-staging-job >>
    environment:
      ENV: staging
      ENV_SUFFIX: _staging
    jobs:
      - project_checkout
      - plan_infrastructure:
          name: plan_infrastructure
          requires:
            - project_checkout
      - hold-apply:
          type: approval
          requires:
            - plan_infrastructure
      - apply_infrastructure:
          name: apply_infrastructure
          requires:
            - hold-apply

  production:
    when: << pipeline.parameters.run-lambda-production-job >>
    environment:
      ENV: production
      ENV_SUFFIX: _production
    jobs:
      - project_checkout
      - plan_infrastructure:
          name: plan_infrastructure
          requires:
            - project_checkout
      - hold-apply:
          type: approval
          requires:
            - plan_infrastructure
      - apply_infrastructure:
          name: apply_infrastructure
          requires:
            - hold-apply

我尝试更改语法,在 config.yml 中声明作业与工作流程分开,甚至更改 orb 版本。

github yaml continuous-integration circleci
1个回答
0
投票

这是一个语法错误,通过 Circleci yml 检查器解析脚本来解决

© www.soinside.com 2019 - 2024. All rights reserved.