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

feat: print hashes for imports in yaml format #608

Conversation

mikemccracken
Copy link
Contributor

For import types that will be checked, save the calculated hash of the downloaded file and print them together in the format of a yaml imports section for easy copy and pasting to add hashes to a file.

Because we only the parse file contents after the substitution placeholders are replaced, this isn't a direct copy and paste replacement, but it is an improvement, and it should be easy enough to tell which expanded paths come from what input.

The relevant info is already present if you build with --debug, but this consolidates it into one place, and without --debug, the hash is not printed.

Here is an example of the output without --debug:

preparing image minbase...
downloading https://host/path/to/atomix-tools-0.5.10.tgz
27.82 MiB / 27.82 MiB [----------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 183.33 MiB p/s
imported file hashes:
  - path: "https://host/path/to/atomix-tools-0.5.10.tgz"
    hash: "f6c3eb0ed978ba63b3b37741fa1ebecc764a4d907a0b18b24c48482218d1a50d"

For import types that will be checked, save the calculated hash of the
downloaded file and print them together in the format of a yaml imports
section for easy copy and pasting to add hashes to a file.

Because we only the parse file contents after the substitution
placeholders are replaced, this isn't a direct copy and paste
replacement, but it is an improvement, and it should be easy enough to
tell which expanded paths come from what input.

Signed-off-by: Michael McCracken <[email protected]>
Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 61.53846% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 57.44%. Comparing base (86ba851) to head (eaa2d19).

Files Patch % Lines
pkg/stacker/import.go 58.62% 10 Missing and 2 partials ⚠️
pkg/stacker/network.go 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #608      +/-   ##
==========================================
+ Coverage   57.40%   57.44%   +0.04%     
==========================================
  Files          65       65              
  Lines        7709     7717       +8     
==========================================
+ Hits         4425     4433       +8     
  Misses       2527     2527              
  Partials      757      757              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rchincha rchincha merged commit 005988c into project-stacker:main May 10, 2024
11 checks passed
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.

3 participants