1

I went through other threads on this plugin discussions but couldn't find what I wanted. Here is my question. Before kicking off a build in Jenkins assume the latest 2 commits are commit-a and commit-b. During build time we make some changes and do a new commit and push, let's call this commit-c. Now I've configured this as post plugin and it shows me the changes between commit-a and commit-b in change log, how can I get the differences between commit-b and commit-c to show up in post build change log in present build (where commit-c was done)?

In plugin configuration I'm using ${GIT_PREVIOUS_COMMIT} and ${GIT_COMMIT} for comparision.

Thanks.

1 Answers1

0

it shows me the changes between commit-a and commit-b in change log

It shows you the changes at the moment the build was triggered: if commit-c was not pushed at that time, that diff is expected.

Then, once commit-c is pushed, the next job will show you the diff between commit-b and commit-c.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Exactly my requirement, commit-c (along with push) was done during present build runtime, so is there anyway to compare commit-c with previous commit and show those changes in the present build post action? – darknight1906 Apr 24 '18 at 05:10
  • @darknight1906 It you run that job again, would it pick up the right commits? – VonC Apr 24 '18 at 06:17
  • yes, whatever commits that were in done in present build will show up in next build's change log. – darknight1906 Apr 24 '18 at 11:08
  • @darknight1906 I would thenk GIT_COMMIT represent the commit currently checked out by the job (so commit-c if you jsut puhed commit-c) – VonC Apr 24 '18 at 11:09
  • that was my assumption too, but unfortunately not, it always compares with commit-a and commit-b and not between commit-b and c even though commit-c is pushed before this comparo. Can see commit-c in git log but won't consider for comparison. – darknight1906 Apr 24 '18 at 11:18
  • @darknight1906 What if you configure your job to checkout a branch? (as in https://stackoverflow.com/a/46425366/6309) – VonC Apr 24 '18 at 11:20
  • sorry I did not understand what you meant in your previous comment. – darknight1906 Apr 25 '18 at 03:57
  • @darknight1906 By default, a Jenkins job checkout a commit. You can make it checkout a branch as in https://stackoverflow.com/a/46425366/6309. Are you using pipelines? – VonC Apr 25 '18 at 04:06
  • OK let me try with the branch. No we don't use pipelines yet. – darknight1906 Apr 26 '18 at 05:46