If you're willing to call the REST API, I think the SHA1 of each of the
jobs is available from the REST API.

For my job "git-client-plugin", I queried with:

http://localhost:8080/job/git-client-plugin/api/xml?depth=1

and saw that each build included the SHA1 for that build.

You could then use those SHA1 values for the diff calculation.

Mark Waite


On Tue, Jan 14, 2014 at 2:47 PM, Sam Lee <skyn...@gmail.com> wrote:

> Hello,
>
> I have a build set up to use git plugin.
> The build is paramatized to take any git revision (commit, branch, ..etc).
>
> During the build, I need to get a list of changed files since last build.
> I could do this if the current build is on the same branch of git by
> looking at GIT_COMMIT and GIT_PREVIOUS_COMMIT environment variables in my
> script.
>
> But, if the current build is not on the same branch, GIT_PREVIOUS_COMMIT
> isn't set.
> So, I can't do  git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT  to
> get the list of changed files  if I'm building a new branch.
>
> Is it better to use jenkins REST API to get previous build info?
>
> *tl;tr  How do I get a list of changed files since the last build (from a
> git project)?*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Thanks!
Mark Waite

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to