Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to get information from the new feature "changesets"?

I wonder if it is possible to echo what were the modified paths between two pull requests using the new feature "changesets"

 

I have something like that in mind:

 - step:
          name: step1
          condition:
              changesets:
                 - echo changesets

 

1 answer

1 accepted

0 votes
Answer accepted

Yes, the information is available by the version control system which is accessible by the git utility. As long as you have it in your build container.

The includePaths directive checks for modified paths.

You can obtain the information by listing modified files between HEAD and the appropriate ancestor which is different depending on the type of the pipeline:

In a pull-request pipeline, all commits are taken into account, and if you provide an includePath list of patterns, a step will be executed when at least one commit change matches one of the conditions.

and:

For other types of pipelines, only the last commit is considered.

To show all changed files for the last commit:

git diff --name-only

For the pull request pipeline I don't have one at hand to verify it, the "Build setup" in such a Pipeline should show whether or not the merge is already committed, if so it could be the same or you can diff to the merge base:

git diff --name-only $(git merge-base "${BITBUCKET_PR_DESTINATION_BRANCH}" HEAD)

Use the `--diff-filter` switch to fine-tune which paths are displayed, `--name-status` to show the status of each path and mind path quoting (use `-z` for null-byte separated paths).

Reference:

Awesome, thank you for the explanation!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,320 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you