Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to make conditional step run when if no following changes ?

xicond October 11, 2022

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

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2022

Hi @xicond,

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:

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

xicond October 19, 2022

Hi @Theodora Boudale 

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

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 24, 2022

Hi @xicond,

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events