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

log the data used to calculate an image tag #506

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions rickshaw-run
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,14 @@ sub calc_image_md5 {
my $item;

# First is the Initial hash calc on workshop reqs
$item = $item_header . "Workshop Config Output:\n" . join("", @config_analysis_output) . "\n";
$md5->add($item);
print $tag_fh $item;
print $tag_fh $item_header . "Workshop Config Output:\n" . join("", @config_analysis_output) . "\n";
$md5->add(join("", @config_analysis_output));
k-rister marked this conversation as resolved.
Show resolved Hide resolved

# Second is the hashing contents of files
for my $file (sort @files) {
debug_log(sprintf "calc_image_md5(): adding '%s' to hash\n", $file);

$item = $item_header . "File: " . $file . "\nFile Contents:\n";
$md5->add($item);
print $tag_fh $item;
print $tag_fh $item_header . "File: " . $file . "\nFile Contents:\n";

open(my $fh, $file);
while(<$fh>) {
Expand All @@ -526,14 +523,13 @@ sub calc_image_md5 {

binmode($fh);
$md5->addfile($fh);
$md5->add("\n");

close($fh);
}
my $base_hash = $md5->hexdigest;
print $tag_fh $item_header . "Hash: " . $base_hash . "\n";
close($tag_fh);
my $full_hash = $base_hash . "_" . $arch_suffix;
print $tag_fh $item_header . "Hash: " . $full_hash . "\n";
close($tag_fh);
debug_log(sprintf "calc_image_md5(): returning '%s'\n", $full_hash);

return $full_hash;
Expand Down
Loading