I want to run specific jobs based on changes to a specific directory.
I’ve used path-filtering: circleci/path-filtering@0.1.1 with config.yml and continue_config.yml.
here is a sample of my config files!
version: 2.1
setup: true
orbs:
path-filtering: circleci/path-filtering@0.1.1
workflows:
check-file-updates:
jobs:
- path-filtering/filter:
name: check-updated-files
mapping: |
Readme/. upload_to_readme "staging"
Gateway/gateway.json upload_gateway_spec "qa"
base-revision: main
config-path: .circleci/continue_config.yml
filters:
branches:
only: main
continue_config.yml
version: 2.1
# CircleCI parameters to control which workflow to run
parameters:
generate_services:
type: boolean
default: false
upload_to_readme:
type: string
default: ""
upload_gateway_spec:
type: string
default: ""
upload_aws_lambda:
type: string
default: ""
patch_generated_services:
type: boolean
default: false
jobs:
# Job for Rdme upload
upload-yaml:
docker:
- image: cimg/node:15.1
resource_class: small
steps:
- checkout
- restore_cache:
key: v1-rdme-1
...
# Rest of the job steps
...
# Job for generating spec files
generate-services:
docker:
- image: circleci/python:3.9-node
resource_class: small
steps:
- checkout
...
# Rest of the job steps
...
# Job for uploading gateway spec to s3
upload-gateway-spec:
docker:
- image: cimg/base:2022.01
resource_class: small
steps:
- checkout
...
# Rest of the job steps
...
upload-aws-lambda:
docker:
- image: circleci/python:3.9-node
resource_class: small
steps:
- checkout
...
# Rest of the job steps
...
check-week:
docker:
- image: circleci/python:3.9
resource_class: small
steps:
...
# Rest of the job steps
...
workflows:
upload-to-readme-staging:
when:
equal: [ "staging", << pipeline.parameters.upload_to_readme >> ]
jobs:
- upload-yaml:
filters:
branches:
only: main
upload-to-readme-prod:
when:
equal: ["prod", << pipeline.parameters.upload_to_readme >>]
jobs:
- upload-yaml:
filters:
branches:
only: main
generate-spec-files:
when: << pipeline.parameters.generate_services >>
jobs:
- generate-services:
filters:
branches:
only: main
patch-generated-spec-files:
when: << pipeline.parameters.patch_generated_services >>
jobs:
- generate-services:
filters:
branches:
only: main
upload-gateway-file-qa:
when:
equal: [ "qa", << pipeline.parameters.upload_gateway_spec >> ]
jobs:
- upload-gateway-spec:
filters:
branches:
only: main
upload-gateway-file-preprod:
when:
equal: ["preprod", << pipeline.parameters.upload_gateway_spec >>]
jobs:
- upload-gateway-spec:
filters:
branches:
only: main
upload-aws-lambda:
when:
or:
- equal: ['qa', <<pipeline.parameters.upload_aws_lambda>>]
- equal: ['preprod', <<pipeline.parameters.upload_aws_lambda>>]
jobs:
- upload-aws-lambda:
filters:
branches:
only: main
scheduled-generate-spec-files:
triggers:
- schedule:
cron: "0 16 * * 2" # This represents 9 AM PST every Tuesday
filters:
branches:
only: main
jobs:
- check-week:
context: ScheduledJobContext
filters:
branches:
only: main
- generate-services:
requires:
- check-week
filters:
branches:
only: main
I’m facing an issue while running jobs specific like generate_services.
when I set my generate_services to true its showing me Unexpected argument(s): generate_services