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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.