Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifact save failing due to incorrect fingerprint #458

Closed
devashish2203 opened this issue Jun 23, 2016 · 10 comments · Fixed by #511
Closed

Artifact save failing due to incorrect fingerprint #458

devashish2203 opened this issue Jun 23, 2016 · 10 comments · Fixed by #511

Comments

@devashish2203
Copy link

I am trying to trigger a Jenkins build and then download the artifact generated to my system.
In my case the artifact gets downloaded but probably the verification gets failed and the following gets printed on the console.

ERROR:root:Failed request at http://jenkins:8080/fingerprint/95d55fcb03623e130e099edadca1fa93/api/python with params: None

On my Jenkins UI the fingerprint of the file is shown as
MD5: 1bccb64e60524d933fa2d3f3334ce738

I then tried the following:

curl http://jenkins:8080/fingerprint/1bccb64e60524d933fa2d3f3334ce738/api/python --user username:password

which gives me the required JSON response

while trying the below returns

curl http://jenkins:8080/fingerprint/95d55fcb03623e130e099edadca1fa93/api/python --user username:password

HTTP ERROR 404

Problem accessing /fingerprint/95d55fcb03623e130e099edadca1fa93/api/python. Reason:

    Not Found


Powered by Jetty://

It looks like the md5 computed by Jenkins and the md5 computed by jenkinsapi don't match.

My system information:
Mac OSX El Capitan 10.11.5
Python version 2.7
jenkinsapi (0.2.30)
Jenkins v1.639

@devashish2203
Copy link
Author

devashish2203 commented Jun 23, 2016

The python code snippet I used to download the artifact

#Get Artifact and save to disk
artifacts = build.get_artifact_dict()

for name, artifact in artifacts.iteritems():
    print "Saving: "+name+" to "+os.getcwd()+"/"+name
    artifact.save_to_dir(os.getcwd())

@lechat
Copy link
Collaborator

lechat commented Aug 21, 2016

I found possible culprit and fixed it in PR #480.

@lechat lechat closed this as completed Aug 22, 2016
@troyer777
Copy link

Using SHA 1bfb4d2, I still get the following errors:
ERROR:root:Failed request at http://[redacted].com/fingerprint/09fb376ac383d01db332831492799853/api/python with params: None
WARNING:root:MD5 cannot be checked if fingerprints are not enabled

Note: fingerprints are enabled. The MD5 in that URL is incorrect for the artifact I'm attempting to download.

Also, getting this error:

WARNING:jenkinsapi.artifact:Jenkins artifact could not be identified.
Traceback (most recent call last):
File "./fetch_builds.py", line 103, in
artifact.save_to_dir(savepath)
File "/home/troyer/git/jenkinsapi/jenkinsapi/artifact.py", line 132, in save_to_dir
return self.save(outputfilepath, strict_validation)
File "/home/troyer/git/jenkinsapi/jenkinsapi/artifact.py", line 62, in save
self._verify_download(filepath, strict_validation)
File "/home/troyer/git/jenkinsapi/jenkinsapi/artifact.py", line 103, in _verify_download
% (local_md5, baseurl)
jenkinsapi.custom_exceptions.ArtifactBroken: Artifact ef4fcafc0cb30cc5ada310c363e24a99 seems to be broken, check http://[redacted].com

In this case, the fingerprint is correct. When I download the file manually from Jenkins, and run md5sum on it, I get the same checksum value.

@lechat
Copy link
Collaborator

lechat commented Aug 22, 2016

@troyer777 which version of jenkinsapi you are using? Could you try this with current HEAD if this repo?

@lechat lechat reopened this Aug 22, 2016
@troyer777
Copy link

I am using the HEAD revision (SHA 1bfb4d2)

@troyer777
Copy link

Picking a way at this a bit...

This failure:
ERROR:root:Failed request at http://[redacted].com/fingerprint/09fb376ac383d01db332831492799853/api/python with params: None
WARNING:root:MD5 cannot be checked if fingerprints are not enabled

This is happening when an older version of the artifact already exists in the path specified to save_to_dir(). This is a common use-case for me - my script gets the last good build of a particular matrix job, and downloads a subset of the build variants. After a day or two, I'll re-run the script to grab the latest artifacts. Our builds age out quickly, and I get the error above when I have an older artifact in my save-dir, but the build no longer exists on Jenkins. The simple work around for this is to delete any old artifacts in the save directory first. I guess one feature request would be to add a new parameter to save_to_dir() that makes it ignore any pre-existing file.

@troyer777
Copy link

So if I ensure there are no artifacts already downloaded, I get the next error condition:
WARNING:jenkinsapi.artifact:Jenkins artifact could not be identified.
Traceback (most recent call last):
File "./fetch_builds.py", line 103, in
artifact.save_to_dir(savepath)
File "/home/troyer/git/jenkinsapi/jenkinsapi/artifact.py", line 132, in save_to_dir
return self.save(outputfilepath, strict_validation)
File "/home/troyer/git/jenkinsapi/jenkinsapi/artifact.py", line 62, in save
self._verify_download(filepath, strict_validation)
File "/home/troyer/git/jenkinsapi/jenkinsapi/artifact.py", line 103, in _verify_download
% (local_md5, baseurl)
jenkinsapi.custom_exceptions.ArtifactBroken: Artifact ef4fcafc0cb30cc5ada310c363e24a99 seems to be broken, check http://[redacted].com

This seems to be something that happens with matrix builds. In _verify_download, job.name is the name of our overall matrix job ("[redacted]_Nightly_Build_FW_Matrix"). At this point, the desired artifact is downloaded, and the md5 checksum of the downloaded file matches the fingerprint. validate_for_build is called, and does an HTTP GET on /fingerprint/ef4fcafc0cb30cc5ada310c363e24a99/api/python. This returns a chunk of JSON.

In this JSON, the fileName and hash are as expected. The "name" field in "original" is the particular sub-build of our matrix build. In my case, it looks something like "[redacted]_Nightly_Build_FW_Matrix/APP=myapp=1,BUILD=chip=12345 board=ASIC_SVB scan_plan=1,RTOS=rtos=1 red_zone=0,VERSION=Release,label=mylabel". There's also a "usage" array with 1 item. This item's "name" is also the particular sub-build name. I believe we are failing validation because these sub-build names do not match job.name (the overall build matrix job).

@daveFNbuck
Copy link

I think I'm having a similar issue. When I run a job that runs a build for multiple artifacts, I get the broken artifact error trying to fetch the ones that weren't updated.

@jmoldow
Copy link

jmoldow commented Jan 13, 2017

This issue should be re-opened, since the PR was reverted in #518.

@SrinivPal
Copy link

SrinivPal commented Mar 15, 2024

I am getting below error

jenkinsapi.custom_exceptions.ArtifactBroken: Artifact **** seems to be broken

Could some help here, I have already raised a issue #856

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants