Is there a way to make conditional step run when if no following changes ?
Asked by xicond:

In Bitbucket Pipelines there conditional steps changesets definition   

```
- step:    condition:         changesets:             includePaths:                 - "path1/*"                 - "path2/*"
```

I'm thinking to dynamically adjust steps sequence to use negate changesets  

```
- parallel:
    - step: 
        name: clear cache
            condition:
                changesets:
                    includePaths:
                        - "path1/*"
    - step:        name: Lint
        condition:
            changesets:
                includePaths:
                    - "path1/*"
- parallel:
    - step:
        name: Deploy 
    - step:
        name: Lint
        condition:
            NOchangesets:
                includePaths:
                    - "path1/*"
```

The logic is like

```
If has clear cache on selected changesets triggered
Do Lint togather
Else?// no changesets trigger Lint goes to next parallel steps
Do Lint in Deployment
```


Answers:
author: Theodora Boudale
body: Hi [@xicond](/t5/user/viewprofilepage/user-id/16360),

**changesets** only supports **includePaths** at the moment. We have a feature request to support **excludePaths** which would allow you to do what you want to do:

* <https://jira.atlassian.com/browse/BCLOUD-20700>

If you'd be interested in that feature, please make sure to add your vote (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

In the meantime, you could achieve what you want by adding in **includePaths** of the steps in the second parallel set, patterns that match the rest of the directories and files in your repo (the ones other than **path1/\***).

Kind regards,  
Theodora

comments: author: xicond
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)   

I already voted that feature request long time ago, but the **excludePaths** seems acting differently, from your explantion to use **includePaths** in different pattern  

so actually what I expected is, **if** the ++pattern++ **not exist** then trigger the step.  
so I cannot make out with different step, different pattern of **includePaths**

Not to ++exclude++ from the **includePaths** just to narrow down the **includePaths**

I can't think to inverted pattern, because it's too broad

CMIIW


author: Theodora Boudale
body: Hi [@xicond](/t5/user/viewprofilepage/user-id/16360),

Apologies for the confusion, I think I misunderstood your requirements initially.

The inverted pattern will indeed not work for your use case, and I don't think there is a way to achieve what you want with the current features of pipelines.

What you want to achieve will be possible if the feature request for *excludePaths* is implemented; this way you could use *excludePaths* with *path1/\** for the steps of the second parallel set to achieve what you want.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud