Packer: shell provisioner can't upload script with Docker builder in CircleCI

Created on 25 Apr 2018  ยท  11Comments  ยท  Source: hashicorp/packer

Simplified version of the packer template:

{
  "builders": [{
    "name": "ubuntu-docker",
    "type": "docker",
    "image": "ubuntu:16.04",
    "commit": true
  }],
  "provisioners": [{
    "type": "file",
    "source": "{{template_dir}}/foo.rb",
    "destination": "/tmp/foo.rb"
  },{
    "type": "shell",
    "script": "{{template_dir}}/configure.sh"
  }]
}

If I run packer build locally on my Mac, it works fine. If I run packer build in CircleCI (machine executor, so it should be a fairly normal Linux VM), it hangs at the configure.sh script. After a long time, I get the error:

 Failed to pipe upload: archive/tar: write too long

configure.sh exists, permissions on it are normal, it's only a few lines long, and it's not doing anything interesting (apt-get install mainly).

Packer version is 1.2.2.

bug buildedocker

All 11 comments

Interesting. Can you provide the full logs with PACKER_LOG=1?

Same issue here. If I downgrade to 1.1.3 all is well again. Looks like go 1.10 made some changes to the tar library. I wonder if this is related.

I'm seeing this error, but only on the 2nd file I try to upload. I've tried shufflung their order, changing size & content, doesn't matter. The first upload (300 bytes) passes almost immediately, and 2nd hangs indefinitely.

@SwampDragons - I'm including log output as well.

```
2018/09/18 00:47:19 packer: 2018/09/18 00:47:19 [INFO] RPC endpoint: Communicator ended with: 0
2018/09/18 00:47:19 [INFO] RPC client: Communicator ended with: 0
2018/09/18 00:47:19 [INFO] RPC endpoint: Communicator ended with: 0
2018/09/18 00:47:19 packer: 2018/09/18 00:47:19 [INFO] RPC client: Communicator ended with: 0
2018/09/18 00:47:19 packer: 2018/09/18 00:47:19 [DEBUG] Opening new ssh session
2018/09/18 00:47:19 packer: 2018/09/18 00:47:19 [DEBUG] starting remote command: rm -f
2018/09/18 00:47:19 packer: 2018/09/18 00:47:19 [INFO] RPC endpoint: Communicator ended with: 0
2018/09/18 00:47:19 [INFO] RPC client: Communicator ended with: 0
2018/09/18 00:47:19 [INFO] RPC endpoint: Communicator ended with: 0
2018/09/18 00:47:19 packer: 2018/09/18 00:47:19 [INFO] RPC client: Communicator ended with: 0
2018/09/18 00:47:19 [INFO] (telemetry) ending shell
2018/09/18 00:47:19 [INFO] (telemetry) Starting provisioner file
==> amazon-ebs: Uploading ./files/prune-docker => /tmp/prune-docker
````
^^ Hangs there for 10 minutes

Actually sorry, I'm seeing this on the ebs-builder, so it could be entirely unrelated, but symptom is similar.

@eddiewebb what version of Packer are you on? This sounds a bit like a regression we saw with v. 1.3.0 that should be resolved in v 1.3.1

@pmorton is this still a problem with v 1.3.1? We're on golang 1.11 and I wonder if that's changed things.

@eddiewebb what version of Packer are you on? This sounds a bit like a regression we saw with v. 1.3.0 that should be resolved in v 1.3.1

Yes! Thank you @SwampDragons, running fine on 1.3.1

@brikis98 is this still a problem with a more recent Packer?

@SwampDragons I haven't had a chance to run this build in some time, so I'm not sure! IIRC, I worked around this by using the file provisioner to upload the script first and then using the shell provisioner to execute it. FWIW, I saw the error with 1.2.2, so it's unlikely to be the regression you mentioned in 1.3.0... If I come back to this same issue in the future, I'd be happy to share the logs and version number findings.

I messed around and created a circle ci docker build which calls a shell script, and wasn't able to reproduce. I'm going to consider this fixed and close. If someone comes across a similar issue, let's open a new ticket with new steps to reproduce. Thanks!

https://circleci.com/gh/hashicorp/packer/5073

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shashanksinha89 picture shashanksinha89  ยท  3Comments

Tensho picture Tensho  ยท  3Comments

russmac picture russmac  ยท  3Comments

mvermaes picture mvermaes  ยท  3Comments

wduncanfraser picture wduncanfraser  ยท  3Comments