nickgl
September 19, 2022, 10:48am
1
This situation additionally described in following topics:
# config.yml
version: 2.1
setup: true
orbs:
path-filtering: circleci/path-filtering@0.1.2
workflows:
generate-config:
jobs:
- path-filtering/filter:
mapping: |
api/.* deploy-api true
# continue_config.yml
version: 2.1
parameters:
deploy-api:
default: false
type: boolean
workflows:
deploy-api:
when: << pipeline.parameters.deploy-api >>
jobs:
- deploy-api-job:
filters:
branches:
ignore: /.*/
…
+1
In my case I’m restricted to using workflow conditionals due to the requirements for path-filtering . Filters on jobs do not work in this case as path-filtering requires only a single workflow to be triggered.
Sadly I am also struggling to get the matches or equal logical operator working against the pipeline.git.tag despite following examples & testing:
# staging
cicd-staging:
when:
matches: { pattern: '^v1.0.0-.+$', value: << pipeline.git.tag >> }
jobs:
- path-filter…
They are solved but these solutions doesn’t help me, so here is my story:
I want to run deployment workflow when i have a push to develop
branch or i have a new tag pushed
starting config:
version: 2.1
setup: true
orbs:
path-filtering: circleci/path-filtering@0.1.3
workflows:
setup-workflow:
jobs:
- path-filtering/filter:
base-revision: develop
config-path: .circleci/base_config.yml
mapping: |
portal-api/.* portalApi true
app-api/.* appApi true
filters:
tags:
only: /.*/
base_config.yml:
version: 2.1
parameters:
portalApi:
type: boolean
default: false
appApi:
type: boolean
default: false
commons:
type: boolean
default: false
jobs:
test-job:
docker:
- image: someimage:latest
working_directory: /root/project
steps:
- attach_workspace:
at: /root
- run:
name: "test job to test tagging"
command: echo "job for a tag << pipeline.git.tag >>"
workflows:
deploy-test:
when:
or:
- << pipeline.git.tag >>
jobs:
- test-job:
filters:
tags:
only: /.*/
here is my result:
According to other topics, I enabled filters with tags.
Hello
When defining filters for tags you also need to define a filter for branches as well.
Please see the following code snippet which will resolve your issue
workflows:
build_and_push_unstable:
jobs:
- path-filtering/filter:
config-path: .circleci/base_config.yml
filters:
tags:
only: /.*/
branches:
ignore: /.*/
Kind Regards
Owen Oliver
1 Like
bjd2385
September 26, 2022, 4:26am
3
Yes, tags are ignored by default, only branches are acted upon by CircleCI. So you have to include them explicitly.
nickgl
October 5, 2022, 7:46am
4
Hello, Thank you very much for the answer. I tried your solution.
The only thing happened is that now all workflows for branches have been filtered out,
but the workflow for tags(deploy-test) hasn’t even started. You can check screenshot in original post, filtering workflow is successfully finished, but then i expect deploy-test
workflow to start