How to run Bamboo job only if certain files were changed?

923 Views Asked by At

I have a Bamboo pipeline that I want to improve build times on by making certain jobs run only if certain files were changed. I have seen similar functionality in Gitlab specs in the form of rules but uncertain if Bamboo has this feature. I have reviewed the specs here: https://docs.atlassian.com/bamboo-specs-docs/7.2.3/specs.html?yaml#yaml for Bamboo and here: https://docs.gitlab.com/ee/ci/yaml/#rules for Gitlab and have seen the same question addressed specifically for gitlab: How to run CI job only if two files have been changed? [not one or another] but still unclear if it is possible to do this on Bamboo pipelines.

1

There are 1 best solutions below

0
On

in the same yaml spec define multiple plans, each with their specific jobs. For each plan update following spec as needed (and specifically the file-filter-pattern):

repositories:
- myrepository:
    type: git
    url: https://bitbucket.org/myorg/myrepository.git
    branch: main
    shared-credentials: xyz
    command-timeout-minutes: '180'
    lfs: 'false'
    verbose-logs: 'false'
    use-shallow-clones: 'true'
    cache-on-agents: 'false'
    submodules: 'false'
    ssh-key-applies-to-submodules: 'false'
    fetch-all: 'false'
    change-detection:
      quiet-period:
        quiet-period-seconds: '60'
        max-retries: '5'
      file-filter-type: include_only
      file-filter-pattern: whatever/.*