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

Fingerprint validation fails when artifacts have different filenames but same contents/hash #709

Open
gjb1002 opened this issue May 24, 2019 · 7 comments
Labels
bug help wanted Will accept pull request as top priority needs investigation

Comments

@gjb1002
Copy link

gjb1002 commented May 24, 2019

ISSUE TYPE
  • Bug Report
Jenkinsapi 0.3.9
Jenkins 2.150.2
SUMMARY

If I do "Replay" from a pipeline build it confuses the fingerprint handling code, frequently leading to errors when the fingerprints are perfectly correct. This seems to be because the new artifact has the same content and hence md5sum but a different file name (our artifact has a timestamp in its name), leading to the "original" structure having the wrong data.

EXPECTED RESULTS

Fingerprints should match correctly.

ACTUAL RESULTS

jenkinsapi.custom_exceptions.ArtifactBroken: Artifact c95cdb45923926b28833833b770770e1 seems to be broken, check <jenkins url>

In log

Filename from jenkins (<artifact name from original build>) did not match provided (<artifact name from replayed build>)

@lechat lechat added bug help wanted Will accept pull request as top priority needs investigation labels May 25, 2019
@gjb1002
Copy link
Author

gjb1002 commented May 27, 2019

A key question is what purpose the filename check that leads to this error in the "validate_for_build" method in fingerprint.py actually serves?

if self._data["fileName"] != filename:

What can actually lead to this error being emitted correctly, other than internal errors in Jenkins?

@gjb1002 gjb1002 changed the title Fingerprint validation fails when replaying pipeline jobs Fingerprint validation fails when artifacts have different filenames but same contents/hash May 27, 2019
@wulinjie122
Copy link

The same problem, and still not work for save

artifact.save(fspath(path), False)

@lechat
Copy link
Collaborator

lechat commented Jun 15, 2019

What is the use case in your code?

Fingerprints are found by MD5 and first file that has this fingerprint will be referred via "fileName" attribute and this is current check. At the same time, the list of all files with the same fingerprint is returned. This is not currently checked. Do you want check to be made that your file is in that list?

@gjb1002
Copy link
Author

gjb1002 commented Jun 18, 2019

I want it to work :) The only thing I have that is at all unusual is that several files have different names but the same MD5. This leads to the error above if I enable fingerprints and try to save artifacts via jenkinsapi.

I don't really see the point of the check, so I would be happy for it to be removed, but keeping track of all the files with a certain MD5 and checking that the file is in the list would also work I guess.

@stale
Copy link

stale bot commented Oct 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issues not active for more than 30 days label Oct 18, 2019
@lechat lechat removed the stale Issues not active for more than 30 days label Oct 21, 2019
@dtgraham9
Copy link

dtgraham9 commented Dec 5, 2019

@gjb1002 I too have experienced this issue where I have one original file and another with a timestamp appended too it. I don't see the importance of checking the file name during the verification process in fingerprint, but if it is to remain I think checking all file names that have a matching MD5 and return true on a single match instance would be a reasonable fix.

Edit software versions

python: 2.7.16
jenkinsapi: 0.3.9
Jenkins: 2.183

@plastikos
Copy link

This was reported as issue #430. I came across this failure as well. I find that verifying the filename is useless due to the way Jenkins allows multiple artifacts to be identical yet have different names. I have submitted PR-851.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted Will accept pull request as top priority needs investigation
Projects
None yet
Development

No branches or pull requests

5 participants