It's all about the answers!

Ask a question

How can I get GitHub Enterprise commit info from the oslc_cm:tracksChangeSet link programatically?


Dave Bellagio (2612) | asked May 25 '17, 6:47 p.m.

Using RTC 6.0.1, I've setup the integration to GitHub Enterprise and see that I can create oslc_cm:tracksChangeSet links on the work item after a push to my GitHub Enterprise.  This all works great.   From RTC Web, I can hover over this link in the work item, and get the UI dialog that shows me information about the commit, the comment, the repo, etc.  This works great.  However, to be useful in an Enterprise setup, I need to create some automation that processes this link.  In my case, a simple custom Advisor is trying to grab this info and use it to control process. 

Here is an example of the oslc_cm:tracksChangeSet link from my setup  (I've x'ed out the hostname).  This work item only has one commit linked to it:

 "oslc_cm:tracksChangeSet": [
    {
      "dcterms:title": "A test comment: workitem 13",
      "rdf:resource": "https://xxxxxxxxxxxxx:9443/ccm/com.ibm.team.git.internal.resources.IGitResourceRestService/commit?value=H4sIAAAAAAAAAI2QzW7CMBCE7zyFlXOD_7HjE30Hjr74Zw0WhETEERJV372xKiP11r3t6NuZ0X7t0DZd6AzqPlGBpaAwjSPci0HP6XHNBUZEeffxy8XKMUJVT0RP1YkejOCG6201hDQKKhU93G7unKfjuuyzH_ebbwOuFVCSS8c0F5RoIVj0SSudooaBMBYYa_D9j1tTl6oOjktIEILS-iC9HARwCNFHx3hIoAdPHYvxbbXWo0sp82Istvicy2X1rZzF7xCLnyn2bp6h5Bc8LK4_ycXifwfuvn8A-067a1oBAAA."
    }
]

If I do a GET of the rdf:resource, I get a 200 back, but no content.   I was hoping to get a nice formatted JSON string of what I see in the hover dialog from the Web.  

If I paste in this link into my browser, I get redirected to the GitHub repo and can see the entire commit nicely, with a diff, etc.  But, I need just a few pieces of this info out of this commit data for my processing.  From the workitem context, I don't know the GitHub Enterprise repo or the commit's SHA1 value.  I suspect this is encoded in the stuff that is after the value= above.

Can I ask the service: com.ibm.team.git.internal.resources.IGitResourceRestService to return some simple commit data for me?  This would make my life so much easier..... 

If that is not possible, how can I get my GitHub Enterprise repo and my commit SHA1 value from the string: "H4sIAAAAAAAAAI2QzW7CMBCE7zyFlXOD_7HjE30Hjr74Zw0WhETEERJV372xKiP11r3t6NuZ0X7t0DZd6AzqPlGBpaAwjSPci0HP6XHNBUZEeffxy8XKMUJVT0RP1YkejOCG6201hDQKKhU93G7unKfjuuyzH_ebbwOuFVCSS8c0F5RoIVj0SSudooaBMBYYa_D9j1tTl6oOjktIEILS-iC9HARwCNFHx3hIoAdPHYvxbbXWo0sp82Istvicy2X1rZzF7xCLnyn2bp6h5Bc8LK4_ycXifwfuvn8A-067a1oBAAA."





2 answers



permanent link
Karthik N V S (563) | answered May 29 '17, 6:37 a.m.
JAZZ DEVELOPER

 Hi Dave,

Please raise a RFE for a new service to return the mentioned commit data.


Comments
Dave Bellagio commented May 30 '17, 8:43 p.m.

permanent link
Sreerupa Sen (1.0k4) | answered May 31 '17, 2:19 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Hi Dave,
    I've created 423784: Add a service/API that provides basic information for Git commits associated with work items to track this.
Cheers
--Rupa
Technical Lead, Rational Team Concert

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.