hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.02k stars 3.32k forks source link

digitialocean builder crashes for Packer 1.3.0+ #6715

Closed andreaso closed 5 years ago

andreaso commented 5 years ago

Since Packer 1.3.0 the digitalocean builder crashes when I try to run it. I have a simple temple which works for Packer 1.2.5 but crashes on Packer 1.3.0 as well as Packer 1.3.1.

Running Packer on a 64-bit Ubuntu 18.04 system.

This is the (simplified) template I'm running.

{
    "variables": {
        "DO_API_TOKEN": "{{env `DOAPITOKEN`}}"
    },
    "builders": [
        {
            "type": "digitalocean",
            "api_token": "{{user `DO_API_TOKEN`}}",
            "image": "ubuntu-18-04-x64",
            "region": "fra1",
            "size": "s-1vcpu-1gb",
            "ssh_username": "root"
        }
    ]
}

Results in the following crash.

$ PACKER_LOG=1 packer build dobuild.json
...
2018/09/15 05:14:29 packer: panic: interface conversion: interface {} is digitalocean.Config, not *digitalocean.Config
2018/09/15 05:14:29 packer: 
2018/09/15 05:14:29 packer: goroutine 36 [running]:
2018/09/15 05:14:29 packer: github.com/hashicorp/packer/builder/digitalocean.(*stepCreateSSHKey).Run(0xc00000a380, 0x281cb80, 0xc0001a4140, 0x281a980, 0xc00019e390, 0x0)
2018/09/15 05:14:29 packer:     /Users/azr/go/src/github.com/hashicorp/packer/builder/digitalocean/step_create_ssh_key.go:31 +0xac7
2018/09/15 05:14:29 packer: github.com/hashicorp/packer/helper/multistep.(*BasicRunner).Run(0xc0001a4100, 0x281a980, 0xc00019e390)
2018/09/15 05:14:29 packer:     /Users/azr/go/src/github.com/hashicorp/packer/helper/multistep/basic_runner.go:72 +0x222
2018/09/15 05:14:29 packer: github.com/hashicorp/packer/builder/digitalocean.(*Builder).Run(0xc0002b9400, 0x2822400, 0xc00000a340, 0x280ff40, 0xc00032a1a0, 0x281cf40, 0xc0001a8020, 0x4bca9c, 0x1e1d9e0, 0x1e1d9e0, ...)
2018/09/15 05:14:29 packer:     /Users/azr/go/src/github.com/hashicorp/packer/builder/digitalocean/builder.go:103 +0x6b7
2018/09/15 05:14:29 packer: github.com/hashicorp/packer/packer/rpc.(*BuilderServer).Run(0xc0004d8040, 0x1, 0xc0004a2070, 0x0, 0x0)
2018/09/15 05:14:29 packer:     /Users/azr/go/src/github.com/hashicorp/packer/packer/rpc/builder.go:94 +0x1cd
2018/09/15 05:14:29 packer: reflect.Value.call(0xc0001adda0, 0xc0001b2310, 0x13, 0x25467a6, 0x4, 0xc0004f9f18, 0x3, 0x3, 0xc000080040, 0xc000001a08, ...)
2018/09/15 05:14:29 packer:     /usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:447 +0x449
2018/09/15 05:14:29 packer: reflect.Value.Call(0xc0001adda0, 0xc0001b2310, 0x13, 0xc000127718, 0x3, 0x3, 0x1, 0x72c03e, 0xc0001d6201)
2018/09/15 05:14:29 packer:     /usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:308 +0xa4
2018/09/15 05:14:29 packer: net/rpc.(*service).call(0xc0004be0c0, 0xc0004c4050, 0xc0003a2710, 0xc0003a2720, 0xc0001bce80, 0xc0004d81a0, 0x1e8d940, 0xc0004a206c, 0x18a, 0x1e1d9e0, ...)
2018/09/15 05:14:29 packer:     /usr/local/Cellar/go/1.11/libexec/src/net/rpc/server.go:384 +0x14e
2018/09/15 05:14:29 packer: created by net/rpc.(*Server).ServeCodec
2018/09/15 05:14:29 packer:     /usr/local/Cellar/go/1.11/libexec/src/net/rpc/server.go:481 +0x47e
2018/09/15 05:14:29 /opt/packer/1.3.1/packer: plugin process exited
2018/09/15 05:14:29 [INFO] (telemetry) ending digitalocean
2018/09/15 05:14:29 ui error: Build 'digitalocean' errored: unexpected EOF
2018/09/15 05:14:29 Builds completed. Waiting on interrupt barrier...
2018/09/15 05:14:29 machine readable: error-count []string{"1"}
2018/09/15 05:14:29 ui error: 
==> Some builds didn't complete successfully and had errors:
2018/09/15 05:14:29 machine readable: digitalocean,error []string{"unexpected EOF"}
2018/09/15 05:14:29 ui error: --> digitalocean: unexpected EOF
==> Builds finished but no artifacts were created.
2018/09/15 05:14:29 [INFO] (telemetry) Finalizing.
2018/09/15 05:14:30 waiting for all plugin processes to complete..
$

See https://gist.github.com/andreaso/47da2ee94475e7a2fca937ce29cb434e for the full output.

SwampDragons commented 5 years ago

Thanks for reporting this -- we'll get it sorted for the next release.

azr commented 5 years ago

Hello, thanks for reporting. 🙂

6729 should fix it; also here's a macos binary with a fix: packer.zip

Please tell me if that fixes it for you. 🙂

rickard-von-essen commented 5 years ago

Andreas is running Linux..

azr commented 5 years ago

Oh right, here's a linux binary. packer.zip

That /usr/local/Cellar/go/ mislead me 🙂 sorry

andreaso commented 5 years ago

Getting the same behavior from the new build.

$ ~/bin/packer version
Packer v1.3.2-dev
$ PACKER_LOG=1 ~/bin/packer build dobuild.json
...
2018/09/18 17:09:41 packer: panic: interface conversion: interface {} is digitalocean.Config, not *digitalocean.Config
2018/09/18 17:09:41 packer: 
2018/09/18 17:09:41 packer: goroutine 85 [running]:
2018/09/18 17:09:41 packer: github.com/hashicorp/packer/builder/digitalocean.(*stepCreateSSHKey).Run(0xc0001b6820, 0x281cc60, 0xc0001b2f40, 0x281aa60, 0xc00036c180, 0x0)
2018/09/18 17:09:41 packer:     /Users/azr/go/src/github.com/hashicorp/packer/builder/digitalocean/step_create_ssh_key.go:31 +0xac7
2018/09/18 17:09:41 packer: github.com/hashicorp/packer/helper/multistep.(*BasicRunner).Run(0xc0001b2f00, 0x281aa60, 0xc00036c180)
2018/09/18 17:09:41 packer:     /Users/azr/go/src/github.com/hashicorp/packer/helper/multistep/basic_runner.go:72 +0x222
2018/09/18 17:09:41 packer: github.com/hashicorp/packer/builder/digitalocean.(*Builder).Run(0xc0002b9400, 0x28224e0, 0xc0001b67e0, 0x2810020, 0xc00032a3e0, 0x281d020, 0xc0001b80d8, 0x4bca9c, 0x1e1da00, 0x1e1da00, ...)
2018/09/18 17:09:41 packer:     /Users/azr/go/src/github.com/hashicorp/packer/builder/digitalocean/builder.go:103 +0x6b7
2018/09/18 17:09:41 packer: github.com/hashicorp/packer/packer/rpc.(*BuilderServer).Run(0xc00016eec0, 0x1, 0xc000327a90, 0x0, 0x0)
2018/09/18 17:09:41 packer:     /Users/azr/go/src/github.com/hashicorp/packer/packer/rpc/builder.go:94 +0x1cd
2018/09/18 17:09:41 packer: reflect.Value.call(0xc000084a80, 0xc00000c570, 0x13, 0x254680d, 0x4, 0xc0000bef18, 0x3, 0x3, 0xc000080040, 0x0, ...)
2018/09/18 17:09:41 packer:     /usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:447 +0x449
2018/09/18 17:09:41 packer: reflect.Value.Call(0xc000084a80, 0xc00000c570, 0x13, 0xc000134f18, 0x3, 0x3, 0x0, 0x0, 0x0)
2018/09/18 17:09:41 packer:     /usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:308 +0xa4
2018/09/18 17:09:41 packer: net/rpc.(*service).call(0xc000081e40, 0xc0000aa780, 0xc0003a06c0, 0xc0003a06d0, 0xc000118300, 0xc00000a300, 0x1e8d960, 0xc000327a6c, 0x18a, 0x1e1da00, ...)
2018/09/18 17:09:41 packer:     /usr/local/Cellar/go/1.11/libexec/src/net/rpc/server.go:384 +0x14e
2018/09/18 17:09:41 packer: created by net/rpc.(*Server).ServeCodec
2018/09/18 17:09:41 packer:     /usr/local/Cellar/go/1.11/libexec/src/net/rpc/server.go:481 +0x47e
2018/09/18 17:09:41 [INFO] (telemetry) ending digitalocean
2018/09/18 17:09:41 /home/andreas/bin/packer: plugin process exited
2018/09/18 17:09:41 ui error: Build 'digitalocean' errored: unexpected EOF
2018/09/18 17:09:41 Builds completed. Waiting on interrupt barrier...
2018/09/18 17:09:41 machine readable: error-count []string{"1"}
2018/09/18 17:09:41 ui error: 
==> Some builds didn't complete successfully and had errors:
2018/09/18 17:09:41 machine readable: digitalocean,error []string{"unexpected EOF"}
2018/09/18 17:09:41 ui error: --> digitalocean: unexpected EOF
==> Builds finished but no artifacts were created.
2018/09/18 17:09:41 [INFO] (telemetry) Finalizing.
2018/09/18 17:09:42 waiting for all plugin processes to complete...
$
azr commented 5 years ago

Hey @andreaso, super sorry, I actually gave you a cross build of another branch I was working on then...

Here's a good one, please tell me if it works: packer.zip ( It actually works for me with your build file; versus a crash on master )

Yesterday I clearly didn't have enough sleep (none actually) and should have stayed in my bed instead of deciding to work 🙂 .

We actually want to automate binary creation in the future.

rickard-von-essen commented 5 years ago

Never let a human do a scripts job :-)

On Wed, Sep 19, 2018, 14:47 Adrien Delorme notifications@github.com wrote:

Hey @andreaso https://github.com/andreaso, super sorry, I actually gave you a cross build of another branch I was working on then...

Here's a good one, please tell me if it works: packer.zip https://github.com/hashicorp/packer/files/2397072/packer.zip ( It actually works for me with your build file; versus a crash on master )

Yesterday I clearly didn't have enough sleep (none actually) and should have stayed in my bed instead of deciding to work 🙂 .

We actually want to automate this in the future.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hashicorp/packer/issues/6715#issuecomment-422789188, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiCg1ZjpkZ_c1EMCDjyTrBRrDxaQ9Lpks5ucjzLgaJpZM4WqLMX .

andreaso commented 5 years ago

No worries.

Yepp, today's build appear to work as expected.

Thanks!

azr commented 5 years ago

Awesome, merging this one. Thanks for your patience.

SwampDragons commented 5 years ago

Never let a human do a scripts job :-)

So true! We're gonna be working with our infra team to get automated branch builds one of these days.

ghost commented 4 years ago

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.