Open eHildy opened 4 years ago
Thanks for reaching out. This is good to know. When you run the build multiple times does it error on different directories?
The ssh communicator has an sftp
option that might be helpful here. You can use sftp
instead of scp
to copy the directories by adding the following configuration option to the builder settings.
"ssh_file_transfer_method": "sftp"
If that doesn't work a possible workaround could be to zip up the node_modules prior to the build and upload a single file, then use another provisioner to unzip on the guest machine. Or, if possible, run an npm install on the guest machine.
@nywilken I had hope this was going to work, because it went for longer; but it failed as well.
Building node modules in the guest might be one way; but one of the uses for this beyond local development is building a machine for export to a network that would have to no access to anything npm would pull down. So the idea was to package the machine and export it.
I'll have to experiment later to see if it's only the Vagrant builder that's doing this.
As for "ssh_file_transfer_method": "sftp"
, I didn't see that in the docs under the Vagrant builder or the File provisioner. Is it listed elsewhere? Could be useful sometime.
It's documented here: https://packer.io/docs/communicators/ssh.html#ssh_file_transfer_method
Packer version
1.5.1
Operating system and Environment details
Windows 10
Overview of the Issue
When using the file provisioner (at least with the Vagrant builder), uploading of large directories fails.
Specifics.
I have a base box that I have built in Packer and successfully used to build a few other boxes on top of. However, when I tried to build the latest one, the file provisioner steps failed. I was able to determine that it is associated with the size of the directory I am trying to upload. In my case, this is a rather large code base that has multiple nested directories. I could perhaps ignore some of them and rebuild them when I finally spin up the VM in Vagrant from the box I'm trying to build, but there's no way to do so in the file provisioner. I could perhaps also create a multitude of file provisioners, explicitly uploading just what I wouldn't be building in the vm, but I'd need a huge amount.
NOTE: I can create a Vagrant box using the same base box I'm trying to build on top off, mount the directory in question and spin up no problem, so the disk is large enough.
Reproduction Steps
I suppose you could create a package.json with a ton of deps in it and npm-install; but in the end what you need is just a large directory with lots of nest dirs and files.
NOTE: the file it shows in the log I can confirm to exist and it finds the other files that live with it. It just gets to a certain point and can upload no more.
Packer Buildfile
Packer Log
The log is HUGE, so here's the end of it: