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

Drop the iso_checksum_type & iso_checksum_url fields #8437

Merged
merged 61 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
a22608f
Drop the iso_checksum_type & iso_checksum_url fields
azr Dec 2, 2019
2d3c045
Merge remote-tracking branch 'origin/master' into drop_iso_checksum_t…
azr Feb 10, 2020
1b993b8
fix after master merge
azr Feb 10, 2020
aedd549
Update builder_test.go
azr Feb 10, 2020
fc60b59
Update builder_test.go
azr Feb 10, 2020
7bc47b8
Update builder_test.go
azr Feb 10, 2020
f6d39fc
Update builder_test.go
azr Feb 10, 2020
596b315
Update builder_test.go
azr Feb 10, 2020
6617f13
remove checksum lowercasing tests
azr Feb 10, 2020
5967c76
Update builder_test.go
azr Feb 10, 2020
61f751d
Update builder_test.go
azr Feb 10, 2020
271dde1
better docs
azr Feb 10, 2020
0ba1597
Update builder_test.go
azr Feb 10, 2020
8d3978b
even better docs
azr Feb 10, 2020
c3160e6
Update config.go
azr Feb 10, 2020
d44d7e2
Update builder_test.go
azr Feb 10, 2020
afe93ac
Update step_create_vmx_test.go
azr Feb 10, 2020
b293a09
make generate
azr Feb 10, 2020
39444b3
better docs
azr Feb 10, 2020
4535dec
fix imports
azr Feb 10, 2020
9615b3b
up tests
azr Feb 10, 2020
39b50a5
Update _ISOConfig-required.html.md
azr Feb 10, 2020
421ca5d
Update builder_test.go
azr Feb 10, 2020
558c0fa
don't use sha1.Sum("none") as a caching path
azr Feb 10, 2020
799bedf
Update builder_test.go
azr Feb 10, 2020
23fd311
Merge remote-tracking branch 'origin/master' into drop_iso_checksum_t…
azr May 4, 2020
9101ae0
better docs
azr May 4, 2020
bdb8b09
Update iso_config_test.go
azr May 4, 2020
3e60725
Update step_download_test.go
azr May 4, 2020
8d1aabb
add iso_checksum_url and iso_checksum_type fixers + tests
azr May 4, 2020
24758a1
add concrete examples of checksum values
azr May 6, 2020
43ece44
add examples of checksumming from local file
azr May 6, 2020
517718c
Merge remote-tracking branch 'origin/master' into drop_iso_checksum_t…
azr May 14, 2020
0513d38
update go-getter dep
azr May 14, 2020
49c2baa
up deps
azr May 14, 2020
594edd5
use new go-getter version
azr May 14, 2020
7c183d1
up ESX5Driver.VerifyChecksum: use go-getter's checksumming
azr May 14, 2020
1daf880
ISOConfig.Prepare: get checksum there in case we need it as a string …
azr May 14, 2020
368bcc1
Update iso_config.go
azr May 14, 2020
8bb8470
get go-getter from v2 branch
azr May 19, 2020
0a4d4e5
Merge remote-tracking branch 'origin/master' into drop_iso_checksum_t…
azr May 19, 2020
dd02f07
Update driver_esx5.go
azr May 19, 2020
6f97b5b
Update driver_esx5.go
azr May 19, 2020
0264368
show better error message when the checksum is invalid
azr May 19, 2020
ae6dd4f
Update builder_test.go
azr May 19, 2020
443456b
Update builder_test.go
azr May 19, 2020
cadbcca
more test updating
azr May 19, 2020
23c96d3
fix default md5 string to be a valid md5
azr May 19, 2020
486a967
TestChecksumFileNameMixedCaseBug: use 'file:' prefix for file checksu…
azr May 19, 2020
6bf844f
Update iso_config_test.go
azr May 19, 2020
cf25108
Update iso_config_test.go
azr May 19, 2020
a802561
Update builder_test.go
azr May 19, 2020
41aadc5
Update builder_test.go
azr May 19, 2020
90e6f08
Update builder_test.go
azr May 19, 2020
94399e9
Update CHANGELOG.md
azr May 19, 2020
eef3d7d
Update CHANGELOG.md
azr May 19, 2020
98af124
Merge branch 'master' into drop_iso_checksum_type_field
azr May 26, 2020
da5f794
Update go.mod
azr May 26, 2020
fc8b708
Update go.mod
azr May 26, 2020
8e432c9
Update CHANGELOG.md
azr May 26, 2020
3910f62
Merge branch 'master' into drop_iso_checksum_type_field
azr May 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

### BACKWARDS INCOMPATIBILITIES:

* For all iso baser builders, the `iso_checksum_type` and `iso_checksum_url`
azr marked this conversation as resolved.
Show resolved Hide resolved
fields have be removed in favor of simply setting the `iso_checksum` field.
Use the [packer fix](https://www.packer.io/docs/commands/fix/) command to
update a config file. See any [iso_checksum field
docs](https://www.packer.io/docs/builders/virtualbox/iso/#iso_checksum) to
read more about this[GH-8437]

### FEATURES:
* **New post-processor** Yandex Export [GH-9124]

Expand Down
13 changes: 6 additions & 7 deletions builder/hyperv/iso/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
Path: b.config.OutputDir,
},
&common.StepDownload{
Checksum: b.config.ISOChecksum,
ChecksumType: b.config.ISOChecksumType,
Description: "ISO",
ResultKey: "iso_path",
Url: b.config.ISOUrls,
Extension: b.config.TargetExtension,
TargetPath: b.config.TargetPath,
Checksum: b.config.ISOChecksum,
Description: "ISO",
ResultKey: "iso_path",
Url: b.config.ISOUrls,
Extension: b.config.TargetExtension,
TargetPath: b.config.TargetPath,
},
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Expand Down
4 changes: 0 additions & 4 deletions builder/hyperv/iso/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions builder/hyperv/iso/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (

func testConfig() map[string]interface{} {
return map[string]interface{}{
"iso_checksum": "foo",
"iso_checksum_type": "md5",
"iso_checksum": "md5:0B0F137F17AC10944716020B018F8126",
"iso_url": "http://www.packer.io",
"shutdown_command": "yes",
"ssh_username": "foo",
Expand Down Expand Up @@ -275,8 +274,18 @@ func TestBuilderPrepare_ISOChecksum(t *testing.T) {
t.Fatal("should have error")
}

// Test good
// Test invalid checksum
config["iso_checksum"] = "FOo"
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
if err == nil {
t.Fatal("should have error")
}

// Test good
config["iso_checksum"] = "md5:0B0F137F17AC10944716020B018F8126"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
Expand All @@ -292,8 +301,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
var b Builder
config := testConfig()

// Test bad
config["iso_checksum_type"] = ""
config["iso_checksum"] = "0B0F137F17AC10944716020B018F8126"
_, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
Expand All @@ -303,7 +311,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
}

// Test good
config["iso_checksum_type"] = "mD5"
config["iso_checksum"] = "mD5:0B0F137F17AC10944716020B018F8126"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
Expand All @@ -313,12 +321,8 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
t.Fatalf("should not have error: %s", err)
}

if b.config.ISOChecksumType != "md5" {
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
}

// Test unknown
config["iso_checksum_type"] = "fake"
config["iso_checksum"] = "fake:foo"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
Expand All @@ -329,7 +333,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
}

// Test none
config["iso_checksum_type"] = "none"
config["iso_checksum"] = "none"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) == 0 {
Expand All @@ -338,10 +342,6 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
if err != nil {
t.Fatalf("should not have error: %s", err)
}

if b.config.ISOChecksumType != "none" {
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
}
}

func TestBuilderPrepare_ISOUrl(t *testing.T) {
Expand Down
13 changes: 6 additions & 7 deletions builder/hyperv/vmcx/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
Path: b.config.OutputDir,
},
&common.StepDownload{
Checksum: b.config.ISOChecksum,
ChecksumType: b.config.ISOChecksumType,
Description: "ISO",
ResultKey: "iso_path",
Url: b.config.ISOUrls,
Extension: b.config.TargetExtension,
TargetPath: b.config.TargetPath,
Checksum: b.config.ISOChecksum,
Description: "ISO",
ResultKey: "iso_path",
Url: b.config.ISOUrls,
Extension: b.config.TargetExtension,
TargetPath: b.config.TargetPath,
},
&common.StepCreateFloppy{
Files: b.config.FloppyFiles,
Expand Down
4 changes: 0 additions & 4 deletions builder/hyperv/vmcx/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 5 additions & 14 deletions builder/hyperv/vmcx/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (

func testConfig() map[string]interface{} {
return map[string]interface{}{
"iso_checksum": "foo",
"iso_checksum_type": "md5",
"iso_checksum": "md5:0B0F137F17AC10944716020B018F8126",
"iso_url": "http://www.packer.io",
"shutdown_command": "yes",
"ssh_username": "foo",
Expand Down Expand Up @@ -193,7 +192,7 @@ func TestBuilderPrepare_ISOChecksum(t *testing.T) {
}

// Test good
config["iso_checksum"] = "FOo"
config["iso_checksum"] = "0B0F137F17AC10944716020B018F8126"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
Expand All @@ -217,8 +216,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
defer os.RemoveAll(td)
config["clone_from_vmcx_path"] = td

// Test bad
config["iso_checksum_type"] = ""
config["iso_checksum"] = "0B0F137F17AC10944716020B018F8126"
_, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
Expand All @@ -228,7 +226,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
}

// Test good
config["iso_checksum_type"] = "mD5"
config["iso_checksum"] = "mD5:0B0F137F17AC10944716020B018F8126"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
Expand All @@ -238,12 +236,8 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
t.Fatalf("should not have error: %s", err)
}

if b.config.ISOChecksumType != "md5" {
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
}

// Test none
config["iso_checksum_type"] = "none"
config["iso_checksum"] = "none"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) == 0 {
Expand All @@ -253,9 +247,6 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
t.Fatalf("should not have error: %s", err)
}

if b.config.ISOChecksumType != "none" {
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
}
}

func TestBuilderPrepare_ISOUrl(t *testing.T) {
Expand Down
13 changes: 6 additions & 7 deletions builder/parallels/iso/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
ParallelsToolsMode: b.config.ParallelsToolsMode,
},
&common.StepDownload{
Checksum: b.config.ISOChecksum,
ChecksumType: b.config.ISOChecksumType,
Description: "ISO",
Extension: b.config.TargetExtension,
ResultKey: "iso_path",
TargetPath: b.config.TargetPath,
Url: b.config.ISOUrls,
Checksum: b.config.ISOChecksum,
Description: "ISO",
Extension: b.config.TargetExtension,
ResultKey: "iso_path",
TargetPath: b.config.TargetPath,
Url: b.config.ISOUrls,
},
&parallelscommon.StepOutputDir{
Force: b.config.PackerForce,
Expand Down
4 changes: 0 additions & 4 deletions builder/parallels/iso/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions builder/parallels/iso/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (

func testConfig() map[string]interface{} {
return map[string]interface{}{
"iso_checksum": "foo",
"iso_checksum_type": "md5",
"iso_checksum": "md5:0B0F137F17AC10944716020B018F8126",
"iso_url": "http://www.google.com/",
"shutdown_command": "yes",
"ssh_username": "foo",
Expand Down
13 changes: 6 additions & 7 deletions builder/proxmox/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
// Build the steps
steps := []multistep.Step{
&common.StepDownload{
Checksum: b.config.ISOChecksum,
ChecksumType: b.config.ISOChecksumType,
Description: "ISO",
Extension: b.config.TargetExtension,
ResultKey: downloadPathKey,
TargetPath: b.config.TargetPath,
Url: b.config.ISOUrls,
Checksum: b.config.ISOChecksum,
Description: "ISO",
Extension: b.config.TargetExtension,
ResultKey: downloadPathKey,
TargetPath: b.config.TargetPath,
Url: b.config.ISOUrls,
},
&stepUploadISO{},
&stepStartVM{},
Expand Down
4 changes: 0 additions & 4 deletions builder/proxmox/config.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions builder/qemu/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}

if b.config.ISOSkipCache {
b.config.ISOChecksumType = "none"
b.config.ISOChecksum = "none"
}
isoWarnings, isoErrs := b.config.ISOConfig.Prepare(&b.config.ctx)
warnings = append(warnings, isoWarnings...)
Expand Down Expand Up @@ -569,13 +569,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
steps := []multistep.Step{}
if !b.config.ISOSkipCache {
steps = append(steps, &common.StepDownload{
Checksum: b.config.ISOChecksum,
ChecksumType: b.config.ISOChecksumType,
Description: "ISO",
Extension: b.config.TargetExtension,
ResultKey: "iso_path",
TargetPath: b.config.TargetPath,
Url: b.config.ISOUrls,
Checksum: b.config.ISOChecksum,
Description: "ISO",
Extension: b.config.TargetExtension,
ResultKey: "iso_path",
TargetPath: b.config.TargetPath,
Url: b.config.ISOUrls,
},
)
} else {
Expand Down
4 changes: 0 additions & 4 deletions builder/qemu/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions builder/qemu/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ eHLc1nkCgYEApm/motCTPN32nINZ+Vvywbv64ZD+gtpeMNP3CLrbe1X9O+H52AXa

func testConfig() map[string]interface{} {
return map[string]interface{}{
"iso_checksum": "foo",
"iso_checksum_type": "md5",
"iso_checksum": "md5:0B0F137F17AC10944716020B018F8126",
"iso_url": "http://www.google.com/",
"ssh_username": "foo",
packer.BuildNameConfigKey: "foo",
Expand Down
Loading