Hi Darrel,
thank you for your answer. I already feared that I have to do it this way 
:-) This means that I need to do multiple API calls until I found all the 
builds for my specific branch/tag. I hoped there is a method with doing 
only one API call and then search for the desired build.


Cheers
Nick

On Tuesday, July 8, 2014 9:26:05 PM UTC+2, DarrelVun wrote:
>
> Nick:
>
> If you're using Git and Gerrit, then you can find the branch and sha1 
> under "actions" and "parameters" as name/value pairs, with name of 
> "GERRIT_BRANCH" and "GERRIT_PATCHSET_REVISION".  I don't know of a way to 
> find the specific build except to walk a project's builds until you find it.
>
> So, to be clear:
> - Start at http://*jenkins_url*/job/*project_name*/api/json?pretty=true
> - Find the array of "builds", each element of which contains a key/value 
> pair of "url" and the URL you need to visit
> - E.g. a build URL will look like http://*jenkins_url*/job/*project_name*/
> *build_number*/api/json?pretty=true
> - Look for "actions" -> "parameters" -> "name" == "GERRIT_BRANCH"
>
> I don't know of an easier way.  
>
>
> Regards,
> Darrel V in NC 
>
>
>
> On Tuesday, July 8, 2014 8:02:08 AM UTC-4, sebastian.nickel wrote:
>>
>> Heya,
>> we are using jenkins in combination with capistrano to deploy the 
>> artifacts build by jenkins directly to our servers. To get the URL for an 
>> artifact we are trying to get the build number for a specific git 
>> branch/tag we build in jenkins (doing this with json API calls). We noticed 
>> that the API shows only one entry for a specific branch/tag (always the 
>> last one). Sometimes it is the case that the latest build failed, so we 
>> would like to deploy the last successful build of a specific branch/tag 
>> from git. Currently I would like to find the build number via the build 
>> history of jenkins, but it seems jenkins doesn't provide API access to the 
>> build history. Does anyone have an idea how to get the last successful 
>> build for a specific git branch/tag via the API?
>>
>> Cheers
>> Nick
>>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to