Open gnikolov5 opened 5 months ago
Just did some more testing, it looks like the issue is related to the mapping itself. I tried with the following mapping:
cloud-dev/.* trigger-cloud-dev-dir-01-route53 true
And it worked, however I want to trigger the workflow only when there are changes within cloud-dev/01_route53/.*
Any ideas?
I think I found a solution
config.yml
version: 2.1
setup: true
orbs:
path-filtering: circleci/path-filtering@1.0.0
workflows:
setup-workflow:
jobs:
- path-filtering/filter:
base-revision: pipe-test
mapping: |
cloud-dev/01_route53/.* trigger-cloud-dev-dir-01-route53 true .circleci/continue_config_cloud_dev.yml
dev/01_route53/.* trigger-dev-dir-01-route53 true .circleci/continue_config_dev.yml
continue_config_cloud_dev.yml:
version: 2.1
deploy_branch: &deploy_branch
filters:
branches:
only: feature/KI-10
orbs:
terraform: circleci/terraform@3.2.1
executors:
base:
docker:
- image: ptccorp/tf-aws:latest
#-----------
# PARAMETERS
#-----------
###########################################
###Trigger Workflow Parameters Cloud-Dev###
###########################################
parameters:
trigger-cloud-dev-dir-01-route53:
type: boolean
default: false
#########################################
###Directory Path Parameters Cloud-Dev###
#########################################
cloud-dev-dir-path-01-route53:
type: string
default: /root/project/cloud-dev/01_route53
#-----------
# WORKFLOWS
#-----------
#########################
###Cloud-Dev Workflows###
#########################
workflows:
cloud-dev-deploy-01-route53:
when:
or:
- << pipeline.parameters.trigger-cloud-dev-dir-01-route53 >>
jobs:
- terraform/init:
<<: *deploy_branch
checkout: true
path: << pipeline.parameters.cloud-dev-dir-path-01-route53 >>
- terraform/plan:
<<: *deploy_branch
checkout: true
path: << pipeline.parameters.cloud-dev-dir-path-01-route53 >>
persist-workspace: true
out: tf_plan_01_route53
requires:
- terraform/init
- deploy-approval:
<<: *deploy_branch
name: 'Approval Gate AWS'
type: approval
requires:
- terraform/plan
# - terraform/apply:
# <<: *deploy_branch
# checkout: true
# path: << pipeline.parameters.cloud-dev-dir-path-01-route53 >>
# attach-workspace: true
# plan: 'tf_plan_01_route53'
# requires:
# - Approval Gate AWS
It turns out also the default directory of the instance was changed from /home/circleci to /root I have no idea why as I was using the same image.
Orb version:
pathfiltering orb version 1.0.0
What happened:
Hello,
I am experiencing issue with the path-filtering orb.
The default parameters for triggering a workflow are set to false in the continue_config, and in the config they are set to true, however the changes within the directories are not detected and the parameter doesn’t change its value to true.
I’ve tried correcting the mapping paths based on the exact directory that the code is located in the circleci istance that is being used during deploy but without success.
Weird part is I have another repo with 99% similar configuration that is working as expected.
I have created a separate branch from the one that I am working on so from feature/KI-10 to feature/KI-10-pipe-test just to make sure that it will do the base-revision based on the changes between the KI-10 and KI-10-pipe-test branch.
I also testeed the base-revision to branch withiut the "/" symbol as suggested here: https://discuss.circleci.com/t/path-filtering-orb-not-triggering-workflows/50517
I've tried with a lot of different configurations, however the simpliest one is this:
config.yml:
continue_config.yml:
Example from one of the many tries: https://app.circleci.com/pipelines/bitbucket/kadanza/kadanza-saas-infra/2706/workflows/04a0e9a8-14aa-4096-a319-51f7292f4bdf/jobs/2430
Expected behavior:
The goal is to trigger the workflows if changes are detected within the specified directories.
Additional Information:
Any advices are highly welcome, as I am struggling to find a solution for a couple of days now, thank you!