Skip to content

Instantly share code, notes, and snippets.

@TaKO8Ki
Forked from ryanpedersen42/config.yml
Created September 21, 2022 06:58
Show Gist options
  • Save TaKO8Ki/8c74bedbf0ddde9b2c0a0e7688446a4c to your computer and use it in GitHub Desktop.
Save TaKO8Ki/8c74bedbf0ddde9b2c0a0e7688446a4c to your computer and use it in GitHub Desktop.
Path filtering example
version: 2.1
setup: true
orbs:
path-filtering: circleci/path-filtering@0.0.2
workflows:
setup-workflow:
jobs:
- path-filtering/filter:
base-revision: main
config-path: .circleci/continue-config.yml
mapping: |
project1/.* project-one true
project2/.* project-two true
project3/.* project-three true
shared-things/.* run-them-all true
version: 2.1
executors:
base:
docker:
- image: cimg/base:stable
parameters:
project-one:
type: boolean
default: false
project-two:
type: boolean
default: false
project-three:
type: boolean
default: false
run-them-all:
type: boolean
default: false
jobs:
project_one:
executor: base
steps:
- run:
command: |
echo "project one"
project_two:
executor: base
steps:
- run:
command: |
echo "project two"
project_three:
executor: base
steps:
- run:
command: |
echo "project three"
all_projects:
executor: base
steps:
- run:
command: |
echo "all"
workflows:
build-1:
when:
or:
- << pipeline.parameters.project-one >>
- << pipeline.parameters.run-them-all >>
jobs:
- project_one
build-2:
when:
or:
- << pipeline.parameters.project-two >>
- << pipeline.parameters.run-them-all >>
jobs:
- project_two
build-3:
when:
or:
- << pipeline.parameters.project-three >>
- << pipeline.parameters.run-them-all >>
jobs:
- project_three
build-shared-other:
when: << pipeline.parameters.run-them-all >>
jobs:
- all_projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment