-
Notifications
You must be signed in to change notification settings - Fork 667
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
Add known_hash file() option #5807
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
✅ Deploy Preview for nextflow-docs-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I think Jordi took a crack at this a few years ago: #4415 I guess now we have two approaches we can compare 😅 |
|
||
```nextflow | ||
// Verify a file with MD5 | ||
file('some/path/to/my_file.file', known_hash: 'md5:d41d8cd98f00b204e9800998ecf8427e') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file('some/path/to/my_file.file', known_hash: 'md5:d41d8cd98f00b204e9800998ecf8427e') | |
file('some/path/to/my_file.file', checksum: 'md5:d41d8cd98f00b204e9800998ecf8427e') |
checksum
may be preferable
I think I like Jordi's approach better. The problem with this PR is that it verifies the checksum when you call @edmundmiller would you be willing to test Jordi's PR and build on it instead? If you can confirm that it works then that will make it easier to merge |
Overview
This PR adds a new file hash verification feature to Nextflow's
file()
operator. This feature allows users to verify file integrity by checking file hashes against expected values. This feature is particularly useful when working with downloaded files or when ensuring data integrity is critical.Implementation Details
FileHashVerifier
class that supports multiple hash algorithms:file()
operator to accept aknown_hash
parameter in the formatalgorithm:hash
FileHashVerifierTest
working-with-files.md
Usage Example
Limitations
Hash verification is not supported when using glob patterns that match multiple files
Throws an
IllegalArgumentException
if:Inspiration
This feature was inspired by the Pooch library, which provides similar functionality for Python.