You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CircleCI路径过滤Orb报错:找不到path-filtering/filter定义

CircleCI Path-Filtering Orb配置错误修复方案

问题原因分析

  1. Cannot find a definition for command named path-filtering/filter

    • aws-cli orb版本号错误(末尾多了一个无效的v),导致orb加载失败,间接干扰了path-filtering orb的解析
    • job参数缩进不符合YAML规范,CircleCI无法正确识别这是一个job调用,误判为command
  2. ERROR IN CONFIG FILE: [#/workflows/always-run] only 1 subschema matches out of 2
    完全由workflow中job的参数缩进错误导致,YAML解析器无法识别合法的配置结构


修复后的config.yml

version: 2.1

setup: true

orbs:
  path-filtering: circleci/path-filtering@0.1.1
  terraform: circleci/terraform@3.2.1
  aws-cli: circleci/aws-cli@4.1.3 # 移除了版本号末尾多余的v

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注意事项

  • 参数名称run-lambda-staging-job和run-lambda-production-job与mapping中的定义完全匹配,无需修改
  • hold-apply是CircleCI内置的审批job,当前写法合法
  • 环境变量ENV和ENV_SUFFIX的传递逻辑正确,可被Terraform job正常读取

额外优化建议

  • 建议将path-filtering orb升级到最新稳定版(如circleci/path-filtering@0.1.6),规避旧版本的已知问题
  • 如果需要支持PR触发的路径过滤,将base-revision改为<< pipeline.git.base_revision >>,自动对比PR目标分支与当前分支的文件差异

内容的提问来源于stack exchange,提问作者Javin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 07:03:30