Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-10481

Expose fingerprint information from builds in REST API

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Major Major
    • core
    • None

      There should be a means to retrieve fingerprint information of artifacts from the REST API of the build pages, probably through artifact information.

      This assists programs interfacing with Jenkins.

          [JENKINS-10481] Expose fingerprint information from builds in REST API

          Ramon van Alteren added a comment - - edited

          I would very much like to have this functionality as well, right now I have to do a whole set of calls to verify that the downloaded artifacts actually match ones on the jenkins server.
          Being able to pull all fingerprints for all artifacts from a build would reduce that to one.

          Please see: https://github.com/ramonvanalteren/pyjenkinsci for an example of what I'm currently doing

          Ramon van Alteren added a comment - - edited I would very much like to have this functionality as well, right now I have to do a whole set of calls to verify that the downloaded artifacts actually match ones on the jenkins server. Being able to pull all fingerprints for all artifacts from a build would reduce that to one. Please see: https://github.com/ramonvanalteren/pyjenkinsci for an example of what I'm currently doing

          drautureau added a comment -

          I'm having the same need: this will help me to get the upstream builds involved in a release (which are locked by me) to get any related data that Jenkins can expose (could be useful to know what this release contains).
          @Ramon, seems that https://github.com/ramonvanalteren/pyjenkinsci is now https://github.com/ramonvanalteren/jenkinsapi ?

          drautureau added a comment - I'm having the same need: this will help me to get the upstream builds involved in a release (which are locked by me) to get any related data that Jenkins can expose (could be useful to know what this release contains). @Ramon, seems that https://github.com/ramonvanalteren/pyjenkinsci is now https://github.com/ramonvanalteren/jenkinsapi ?

          Daniel Beck added a comment -

          Reproduced on Jenkins 1.564. It should be part of the API based on the sources.

          Daniel Beck added a comment - Reproduced on Jenkins 1.564. It should be part of the API based on the sources.

          Alexander Ost added a comment -

          I had the same problem; as Daniel pointed out, this is part of the API already. However, fingerprints are not exposed by default in the REST API.

          You need to explicitly set the depth parameter to receive the fingerprints, e.g.

          http://myjenkins.local/job/testjob/42/api/xml?depth=2
          

          If you need to retrieve fingerprints only, you can yuse a tree query to avoid ambiguities:

          http://myjenkins.local/job/testjob/42/api/xml?depth=2&tree=fingerprint[fileName,hash]{0,}
          

          Alexander Ost added a comment - I had the same problem; as Daniel pointed out, this is part of the API already. However, fingerprints are not exposed by default in the REST API. You need to explicitly set the depth parameter to receive the fingerprints, e.g. http://myjenkins.local/job/testjob/42/api/xml?depth=2 If you need to retrieve fingerprints only, you can yuse a tree query to avoid ambiguities: http://myjenkins.local/job/testjob/42/api/xml?depth=2&tree=fingerprint[fileName,hash]{0,}

          Pedro Witzel added a comment - - edited

          I've tried this on a Pipeline Job using Jenkins 2.99, and I get the following xml:

          <workflowRun _class="org.jenkinsci.plugins.workflow.job.WorkflowRun"/>

          No corrections on this were done between the 2.99 and 2.117 (latest today).
          There's another way to get the fingerprints using the REST API nowadays ?

          Pedro Witzel added a comment - - edited I've tried this on a Pipeline Job using Jenkins 2.99, and I get the following xml: <workflowRun _class= "org.jenkinsci.plugins.workflow.job.WorkflowRun" /> No corrections on this were done between the 2.99 and 2.117 (latest today). There's another way to get the fingerprints using the REST API nowadays ?

          I've done some debbuging and think that this is currently not supported by pipeline plugin which is caused by the way to achive this "hidden by default" filter.

          Pipeline plugin would have to enable this, I've created https://issues.jenkins-ci.org/browse/JENKINS-51667 for this.

          Matthias Schmalz added a comment - I've done some debbuging and think that this is currently not supported by pipeline plugin which is caused by the way to achive this "hidden by default" filter. Pipeline plugin would have to enable this, I've created https://issues.jenkins-ci.org/browse/JENKINS-51667  for this.

          Hari Dara added a comment -

          The linked Jenkins issue (JENKINS-51667) is now fixed, but I am seeing the same output as reported by pedro_witzel. Any idea what the issue could be?

          Hari Dara added a comment - The linked Jenkins issue ( JENKINS-51667 ) is now fixed, but I am seeing the same output as reported by pedro_witzel . Any idea what the issue could be?

            arost Alexander Ost
            noahhoffman Noah Hoffman
            Votes:
            11 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: