-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Drop the iso_checksum_type & iso_checksum_url fields #8437
Conversation
In favor of simply using iso_checksum that will know what to do.
basing this on the hash length is not correct because there are several hash functions that can have the same output length, e.g., SHA-2 256 vs SHA-3 256. |
Hey @rgl, thanks for your concern; I nerd sniped myself a little to check some of what you said. So basically what I found out is that sha-256 is currently at sha-4 and previous versions of sha ( sha-1, 2, 3 ) have been 'deprecated' and by default go implements "sha-04 - 256" from FIPS "180-04" : https://golang.org/src/crypto/sha256/sha256.go?s=3821:3841#L6 FIPS-04. So that's one thing; but this doesn't prevent hashing algorithms from having the same length; but it is still possible to tell the go-getter which algorithm you want from the hashing string, for example: By using something like |
Don't known what is this "sha-04 - 256" you are talking about. The hashing algorithm is called SHA-2 and the other one is SHA-3; both have variants with the same output length (e.g. 256-bit).
Ah, so I can use, e.g., |
Okay I had to update the tests but this looks good to review ; basically |
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.
Looks really good to me :D
// "md5:{$checksum}", "sha1:{$checksum}", "sha256:{$checksum}", | ||
// "sha512:{$checksum}" or "file:{$path}". Here is a list of valid checksum | ||
// values: | ||
// * md5:090992ba9fd140077b0661cb75f7ce13 |
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.
Nice!!
} | ||
|
||
return true | ||
req := &getter.Request{ |
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.
Nice!!!
} else if c.ISOChecksum != "" { | ||
q := u.Query() | ||
q := u.Query() | ||
if c.ISOChecksum != "" { |
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.
at this point this is always true, so I guess you can remove it.
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.
There is also a possibility that the checksum is set from the iso url.
@@ -28,13 +24,11 @@ require ( | |||
github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607 // indirect | |||
github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43 | |||
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect | |||
github.com/aws/aws-sdk-go v1.25.41 | |||
github.com/aws/aws-sdk-go v1.30.8 |
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.
Reading their changelong it appeared that they had some changes to the ec2 API which we use but it doesn't say anything about backward incompatibilities and it wasn't too many changes. For me is ok updating the version, unless you have another concern.
85c9657
to
8e432c9
Compare
Just noticed -- this needs a fixer. |
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.
We need a fixer for this! If there's a checksum_type, we need to delete it from the config and prepend it to the iso_checksum field.
Okay I think I can merge this one 🙂 |
Ah bummer I wanted to change the commit message |
This is probably the most major backwards incompatibility we've introduced in my time working on Packer. It will affect basically every template. And while I'm wondering if there's a way we can automatically run fixers as part of a build if Prepare() fails, to recover the build. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
In favor of simply using iso_checksum that will know what to do.