Skip to content

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

Merged
merged 2 commits into from
Apr 29, 2025
Merged

Conversation

skycaptain
Copy link

Closes #5742.

When used with the configuration example shown in #5742, Artifactory will not complain about missing checksums anymore:

Screenshot 2025-04-26 at 11 51 46

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 26, 2025
@caarlos0 caarlos0 requested a review from Copilot April 28, 2025 11:56
Copy link
Contributor

@Copilot Copilot AI left a 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.

Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.93%. Comparing base (c0b5a1c) to head (1c531bf).
Report is 5 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 28, 2025
@skycaptain
Copy link
Author

I also added some docs.

@caarlos0 caarlos0 requested a review from Copilot April 29, 2025 02:34
@caarlos0 caarlos0 added the enhancement New feature or request label Apr 29, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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)                              |

@caarlos0 caarlos0 merged commit 6437d34 into goreleaser:main Apr 29, 2025
18 checks passed
@caarlos0
Copy link
Member

awesome, thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants