jenkinsjenkins-pipelinejenkins-pluginsjenkins-api

Get all builds started by user in Jenkins


The following page in Jenkins is supposed to list the builds started by a user user -

https://<jenkins.domain>/user/<username>/builds

But this is always empty for all users in my Jenkins.

There are no errors in System Log or in the browser. Not sure why this page is always empty.

Environment:

Jenkins version: 2.190.2 

Auth mechanism: LDAP

I'm looking for an API to get all builds executed by a given user(or currently logged in user). Ideally if this page was working, I would have checked the Rest API being used by the page from the Rest API link in Jenkins footer.


The question is same this 5 year old question on an older version of jenkins which doesn't have any answer - Jenking not displaying build history from a single user

Edit: Still looking for a way to list pipeline jobs started by a user.


Solution

  • Jenkins users can authenticate on different Security Realms i.e., group based access (SAML) or LDAP based authentication so the queries have different ways of getting fetched.

    When I compare the number of jobs of the following URLS, the results are actually different:

    https://<jenkins.domain>/user/<username>/builds -- Returns only one https://<jenkins.domain>/user/<username>@company.com/builds --Returns many

    Identify the format in your Jenkins instance to find the correct link in which you can list all the jobs.

    Another point to note, this page lists only Freestyle jobs and not Pipeline jobs.