-
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
Allow files/subdirectories to be excluded when uploading a directory with the file provisioner #1811
Comments
👍 |
👍 |
This would be perfect. NodeJS projects with lots of dependencies cause the file upload step to hang for a long time due how large the |
May be i can do that after some time if nobody wants. |
This seems like it could be handy. to quote @cbednarski in #2872
Will be happy to look at any PRs that come in for this, but this is not something we're targeting for 1.0, so I'm going to close this. Please see the mailing list for more details on 1.0. |
I'm uploading a Rails app to the machine built by Packer. I'd like to use the file provisioner to upload my directory, but exclude certain files or subdirectories like
tmp/
,log/
, andpublic/uploads/
from the source. Ideally, the Packer template would look something like this:I haven't learned Go yet, but from browsing the source code it seems like these two lines would be good starting points:
https://github.com/mitchellh/packer/blob/b6ae00fc370ac2c48c9187c6d341eb5e5e6c8d14/provisioner/file/provisioner.go#L42
https://github.com/mitchellh/packer/blob/b6ae00fc370ac2c48c9187c6d341eb5e5e6c8d14/provisioner/file/provisioner.go#L82
For anyone else with this issue, the first workaround is to upload the entire directory to a temporary destination, then use a shell provisioner afterwards to copy the desired files/dirs to the final destination. The second workaround is to use multiple file provisioners in your Packer template to upload each of the desired files/directories one-by-one.
Both of these workarounds currently work for my use case, but an "exclude" option built into the file provisioner would be more simple, clean, and awesome. 👍
The text was updated successfully, but these errors were encountered: