Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

How do I get the list of changed files in my pipe? Edited

I'd like to get the list of changed files and only scan them.  Ideally it would be all files in the PR but it could be compared to a specific branch (e.g. master).

I really want to isolate the case of an incremental build over a full build because the difference is an order of magnitude in seconds, and this isn't a big repository.

Note, this is in a pipe, not a pipeline. (Well, of course the pipe is called from a pipeline, but you know what I mean).

 

if I do a git diff HEAD..master (or origin/master) it doesn't work.

If I look in .git/refs/heads, I don't have any other reference than the current branch.

if I do a git fetch:

+ git fetch
fatal: unable to access 'http://bitbucket.org/mvcode/mv-devops/': Failed to connect to localhost port 29418: Connection refused

If I set the ssh or http origin then I get errors. (have to re-run these to get the errors.)

ssh:

+ git remote set-url origin git@bitbucket.org:mvcode/mv-devops.git
+ git ls-remote
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

http:

+ git remote set-url origin http://bitbucket.org/mvcode/mv-devops
+ git ls-remote
fatal: unable to access 'http://bitbucket.org/mvcode/mv-devops/': Failed to connect to localhost port 29418: Connection refused

(that host mapping to localhost is cute, it would be nice if it did the right thing in pipes and used the host.docker.internal instead).

If I set it to the pipe host.docker.internal:29418 value I get errors.

+ git remote set-url origin http://host.docker.internal:29418
+ git ls-remote
fatal: unable to access 'http://host.docker.internal:29418/': The requested URL returned error: 502

If I try to use the API to do a diffstat, as I've seen elsewhere, I get you must be admin or have write access, which A) doesn't make sense, I'm reading, B) I _do_ have that access (the pipe may not).

++ curl -s --proxy http://host.docker.internal:29418 --request GET http://api.bitbucket.org/2.0/repositories/mvcode/mv-devops/diffstat/f7f6a6bca8181653f3e4208fbd3ac6874942d36d
Access denied. You must have write or admin access.

So it looks like I can probably auth my way in, but I feel that the files that changed should be intrinsic knowledge to a PR.  It should be easily available and there shouldn't be a need for auth as it's a read only operation on state that you have an even more complete access to.  Ideally this would be available without an API or git operation, like in a well-known location.

2 answers

1 accepted

0 votes
Answer accepted
# save just in case
BACKUP_PROXY=$(git config "http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy")
# replace
git
config "http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy" http://host.docker.internal:29418
# fetch
git
fetch origin "${DEFAULT_BRANCH}"
mapfile -t RAW_FILE_ARRAY < <(git -C "${GITHUB_WORKSPACE}" diff --name-only "FETCH_HEAD..${GITHUB_SHA}" --diff-filter=d 2>&1)
# restore just in case
git config "http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy" "$BACKUP_PROXY"

 This feels like a bug.

Suggest an answer

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

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

514 views 6 4
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