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

Fixes #430: Validate an artifact using "hash" rather than "fileName" #851

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

plastikos
Copy link

Jenkins only stores one version of an artifact by its hash and by the original filename. Subsequent stores of an artifact with an identical hash but different filename will point to the original artifact. If a duplicate artifact (identical hash) has a different filename than the original filename then that new filename will be stored as a name in the build artifacts but will not change the fileName of the original artifact. This makes it problematic to compare against the original fileName when validating a build artifact that has been saved.

Since the md5sum hash is computed for the local, saved artifact it can be compared against the Jenkins artifact ID (viz hash) for validation. This avoids the problem of identical artifacts having additional filenames. Using the hash is also a better way of validating data integrity rather than using the fileName even when the filename matches.

@plastikos plastikos marked this pull request as ready for review December 12, 2023 10:16
jenkinsapi/fingerprint.py Show resolved Hide resolved
jenkinsapi/fingerprint.py Show resolved Hide resolved
…fileName"

Jenkins only stores one version of an artifact by its hash and by the
original filename.  Subsequent stores of an artifact with an identical
hash but different filename will point to the original artifact.  If a
duplicate artifact (identical hash) has a different filename than the
original filename then that new filename will be stored as a name in
the build artifacts but will not change the fileName of the original
artifact.  This makes it problematic to compare against the original
fileName when validating a build artifact that has been saved.

Since the md5sum hash is computed for the local, saved artifact it can
be compared against the Jenkins artifact ID (viz hash) for validation.
This avoids the problem of identical artifacts having additional
filenames.  Using the hash is also a better way of validating data
integrity rather than using the fileName even when the filename
matches.
@plastikos plastikos force-pushed the issue-430-fingerprint-validate_for_build branch from 4619c20 to 5163a39 Compare December 12, 2023 10:23
plastikos and others added 2 commits December 12, 2023 03:51
This updates an invocation of log.info() to use %-format style and
quells a Codacy complaint.
@plastikos
Copy link
Author

I see lots of failures with the checks but I can't find any logs that indicate what failed. Are the checks broken?

@plastikos
Copy link
Author

What's up with the pre-commit.ci changing the P.R.?

@plastikos
Copy link
Author

This P.R. will close #709 as well as #430.

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

Successfully merging this pull request may close these issues.

1 participant