Well, I had the advantage of having used that API in my own plugin before :)

But yeah, Git is just plugin like any other, so there's no magical way
of knowing how to access data from its internals.

Though if you know that "Actions" exist, and are a mechanism for plugins
to associate data with a build, you might be able to get somewhere in
general by using the Script Console as Brian mentioned, coupled with a
bit of digging on GitHub.

If you have specific questions, the mailing list or IRC are also good
bets :)

Regards,
Chris


On 10/12/15 15:18, Guy Matz wrote:
> Nicely done!!  How the heck was I supposed to know that!?  :-(  The API
> is less than intuitive and does not seem to be well documented.  Any
> advice on how to best use it?
> 
> Thanks again!!
> 
> On Wed, Dec 9, 2015 at 7:28 PM, Christopher Orr <ch...@orr.me.uk
> <mailto:ch...@orr.me.uk>> wrote:
> 
>     Hi there,
> 
>     On 09/12/15 23:40, Guy Matz wrote:
>     > Hi!  Anyone know how I can retrieve the git revision from a job?
>     >
>     > I can get to the build:
>     >
>     > j = Jenkins.instance.getJob('render-master')
>     > b475 = j.getBuildByNumber(475)
>     >
>     > but I can't find a way to to get the git revision associated with that
>     > build.  Any thoughts would be appreciated!
> 
>     Git metadata is stored in a `BuildData` action, so something like this
>     (untested) should work:
> 
>     
> b475.getAction(hudson.plugins.git.util.BuildData.class).lastBuiltRevision.sha1String
> 
>     Regards,
>     Chris
> 
>     --
>     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
>     <mailto:jenkinsci-users%2bunsubscr...@googlegroups.com>.
>     To view this discussion on the web visit
>     
> https://groups.google.com/d/msgid/jenkinsci-users/5668C714.30504%40orr.me.uk.
>     For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 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
> <mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtWXk1o10d537DPv37zJe-uFwtnvo9rjZ8E%2BzLkb%3D%2BOitw%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtWXk1o10d537DPv37zJe-uFwtnvo9rjZ8E%2BzLkb%3D%2BOitw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/566A03EA.20902%40orr.me.uk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to