Re: Get SCM Commit ID from SCMTriggerCause

11 views
Skip to first unread message

Jesse Glick

unread,
Feb 13, 2019, 2:31:20 PM2/13/19
to Jenkins Dev
On Wed, Feb 13, 2019 at 8:02 AM <felipe...@gmail.com> wrote:
> If the cause is an instance of SCMTriggerCause, I was hoping for a way to get to the COMMIT ID that caused this, but instead the short description only tells me "Started by an SCM change".

Because that is all the information that is actually available at the
time the _cause_ is created: that one or more SCM changes occurred. If
and when the build actually starts, at that point it will check out
the current head, and then you will know what commit it is building.

If you are dealing with a multibranch project, then an
`SCMRevisionAction` should be available in the `Queue.Item`, and this
would normally encode a particular commit that was determined during
indexing or a webhook and which will be specifically checked out by
the build regardless of where the head might have moved by then.
Reply all
Reply to author
Forward
0 new messages