githubyamlcontinuous-integrationcircleci

CircleCI throwing error: Cannot find declaration for step path-filtering/filtercci-language-server


I am trying to use CircleCI's path filtering orb to create 2 separate workflows based on which folder in the github repo is modified during future PR/commit.

However CircleCI config validate is showing:
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 is showing this error on its website: ERROR IN CONFIG FILE: [#/workflows/always-run] only 1 subschema matches out of 2

This is depsite, exactly following the path-filtering orb documentation example step by step

This is my config.yml code:

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.3v

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

This is the continue_config.yml code:

version: 2.1

orbs:
  terraform: circleci/terraform@3.2.1
  aws-cli: circleci/aws-cli@4.1.3

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

I tried changing up the syntax, declaring jobs separate from workflow in config.yml and even changing the orb version.


Solution

  • This was a syntax error, solved by parsing the script through a circleci yml checker