-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: add checksum template function #5743
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
Conversation
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.
Pull Request Overview
This PR introduces a new template function "checksum" to compute file checksums, ensuring that Artifactory no longer complains about missing checksums.
- Adds the "checksum" function to the template function map in tmpl.go.
- Provides a test case in tmpl_test.go verifying checksum functionality using the sha256 algorithm.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
internal/tmpl/tmpl.go | Adds the new "checksum" template function and its implementation. |
internal/tmpl/tmpl_test.go | Introduces a test verifying that the new checksum function returns the correct value. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5743 +/- ##
=======================================
Coverage 82.92% 82.93%
=======================================
Files 161 161
Lines 15916 15924 +8
=======================================
+ Hits 13198 13206 +8
Misses 2144 2144
Partials 574 574 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I also added some docs. |
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.
Pull Request Overview
This PR adds checksum template functions to support generating artifact checksums and updating associated documentation and configuration.
- Added new checksum functions (blake2b, blake2s, crc32, md5, sha224, sha384, sha256, sha1, sha512, sha3_224, sha3_256, sha3_384, sha3_512) to the template function map.
- Updated documentation in both the templates and artifactory configuration files to include checksum details.
- Introduced comprehensive tests for the checksum functions.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
www/docs/customization/templates.md | Added documentation entries for various checksum functions. |
www/docs/customization/artifactory.md | Updated configuration examples to support checksum headers. |
internal/tmpl/tmpl_test.go | Added tests for validating checksum function outputs. |
internal/tmpl/tmpl.go | Mapped new checksum functions to their corresponding algorithms. |
Comments suppressed due to low confidence (1)
www/docs/customization/templates.md:169
- The documentation for sha384 references golang.org/x/crypto/sha3, which may be misleading since standard sha384 implementations are typically found in crypto/sha512. Consider verifying and updating the link for clarity.
| `sha384 .ArtifactPath` | `sha384` checksum of the artifact. See [SHA384](https://pkg.go.dev/golang.org/x/crypto/sha3) |
awesome, thank you! 🙏 |
Closes #5742.
When used with the configuration example shown in #5742, Artifactory will not complain about missing checksums anymore: