hasrthur
hasrthur

Reputation: 1490

Run pipeline only on changes in one dir

So I've got a project with some structure. And whenever I push changes to any file pipeline is run. But I want it to run only when there are changes in particular directory. Is it even possible?

Upvotes: 13

Views: 7338

Answers (3)

Mithun Biswas
Mithun Biswas

Reputation: 1833

Check this Documentation

https://bitbucket.org/blog/conditional-steps-and-improvements-to-logs-in-bitbucket-pipelines

- step:
      name: build-frontend-artifact
      condition:
          changesets:
              includePaths:
                # only xml files directly under resources directory
                - "src/main/resources/*.xml"
                # any changes in frontend directory
                - "src/site/**"
      script:
         - echo "Building frontend artifact"

Upvotes: -1

manasouza
manasouza

Reputation: 1225

The JIRA issue that refers to this situation was recently updated with the following solution that can be straightforward applied.

Example from bitbucket blog post:

- step:
          name: build-frontend-artifact
          condition:
              changesets:
                  includePaths:
                    # only xml files directly under resources directory
                    - "src/main/resources/*.xml"
                    # any changes in frontend directory
                    - "src/site/**"
          script:
             - echo "Building frontend artifact"

Upvotes: 23

Laures
Laures

Reputation: 5489

This may help you:

Determine If Any File Changed In Directory For Latest Git Commit

that way if there are no changes in your directory you could finish the build early.

Upvotes: 1

Related Questions