Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

PULL_REQUEST_TO_HASH resolved to old commit #117

Closed
nwsheppard opened this issue May 12, 2016 · 13 comments
Closed

PULL_REQUEST_TO_HASH resolved to old commit #117

nwsheppard opened this issue May 12, 2016 · 13 comments
Labels

Comments

@nwsheppard
Copy link

The PULL_REQUEST_TO_HASH is pulling to old hash of the repository the commit is going. Shouldn't this pull the latest hash from the repository?

@nwsheppard nwsheppard changed the title PULL_REQUEST_TO_HAS PULL_REQUEST_TO_HASH May 12, 2016
@tomasbjerre
Copy link
Owner

What do you mean with the old hash? The original hash that was when the PR was opened? It should point to the latest hash of the target branch of the PR.

@nwsheppard
Copy link
Author

Yes, it points to the hash from when the PR was created. There could have been 3 other commits since then and it does not see them.

@tomasbjerre
Copy link
Owner

I created a PR.
Added URL as: http://localhost:80/?FROM=${PULL_REQUEST_FROM_HASH}&TO=${PULL_REQUEST_TO_HASH}
Triggered on COMMENT
Added comment
got:
/?FROM=d6edcbf924697ab811a867421dab60d954ccad99&TO=0a943a29376f2336b78312d99e65da17048951db
Cloned repo
committed to target
added comment
got:
/?FROM=d6edcbf924697ab811a867421dab60d954ccad99&TO=3f279e9c18432e315e2ff8d721e8614eaf9c8edc

What is the event you are triggering on?

@nwsheppard
Copy link
Author

nwsheppard commented May 12, 2016

I am triggering on Button_Trigger. Would it be possible for you to commit other PRs and test again?

@tomasbjerre
Copy link
Owner

I tried with RESCOPED_FROM and RESCOPED_TO and also with BUTTON_TRIGGER. All works fine for me. Are the PR within the same repo or forked?

@nwsheppard
Copy link
Author

They are within the same repo.

@nwsheppard
Copy link
Author

nwsheppard commented May 12, 2016

Is there a way to get the last Merge_Commit from the "to" branch. The issue is that sometimes Jenkins will not get the commit notification and we have to manually rebuild the merge, but without being able to use the Merge_Commit outside of the merge I can't.

I see the issue now.
Branch to be merged with commits:
screen shot 2016-05-12 at 12 57 26 pm
All Branch commits:
screen shot 2016-05-12 at 12 57 57 pm
Jenkins Git log:
screen shot 2016-05-12 at 12 58 24 pm

Thanks.

@tomasbjerre
Copy link
Owner

No there is only ${PULL_REQUEST_TO_HASH} that should be the latest commit of the target branch.
There is also ${PULL_REQUEST_MERGE_COMMIT} but it is empty for all events but merged event.

For a repo like:

*       d24afe7 2016-05-10  Using password type for keystore password field (Tomas Bjerre)
*       070e7df 2016-05-10  Merge pull request #115 from sanzinger/fix/proxyurl (Tomas Bjerre)
|\  
| *     2775070 2016-05-10  Change proxy url/port fields to text (Stefan Anzinger)
* |     934453f 2016-05-09  doc (Tomas Bjerre)

You want to find 070e7df? The ${PULL_REQUEST_TO_HASH} will give you d24afe7.

@tomasbjerre
Copy link
Owner

Is this problem new in 2.18? I made a very big rewrite in that release.

@nwsheppard
Copy link
Author

I tested under a earlier version, but it was only with a test repo that didn't get many commits. I have only started using 2.18 in production and really exercising it, so I don't really have a reference to earlier versions.

@tomasbjerre
Copy link
Owner

Perhaps, as a workaround, you can use ${PULL_REQUEST_TO_BRANCH} and resolve it to the latest commit hash in the build job.

Since I cant reproduce this, I'll wait and see if others are reporting the problem.

tomasbjerre added a commit that referenced this issue May 14, 2016
 * Adding integration test for REST API.
@tomasbjerre tomasbjerre changed the title PULL_REQUEST_TO_HASH PULL_REQUEST_TO_HASH resolved to old commit May 14, 2016
@nwsheppard
Copy link
Author

I can confirm that version 2.21 fixed the issue. Thank you for such a fast turnaround and superb communication.

@jorhett
Copy link

jorhett commented May 16, 2016

So this is a problem for certain kinds of tests. When we are doing code evaluation we want to do the see changes placed by the commit against what they were changing. Right now I'm not seeing any variable which contains the git commit they created the PR against.

Can we get that in a separate variable please? (the value which was previously in TO_HASH)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants