-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[WIP] file: use excludes list to excl files when uploading a directory #12280
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,11 @@ type Config struct { | |
| // the Packer run, but realize that there are situations where this may be | ||
| // unavoidable. | ||
| Generated bool `mapstructure:"generated" required:"false"` | ||
| // A list of files or directories to exclude from the upload. This is | ||
| // useful if you have a directory with many files and you only want to | ||
| // upload a few of them. This only works if you are uploading a directory | ||
| // and not a single file. | ||
| Excludes []string `mapstructure:"excludes" required:"false"` | ||
|
|
||
| ctx interpolate.Context | ||
| } | ||
|
|
@@ -227,7 +232,7 @@ func (p *Provisioner) ProvisionUpload(ui packersdk.Ui, comm packersdk.Communicat | |
|
|
||
| // If we're uploading a directory, short circuit and do that | ||
| if info.IsDir() { | ||
| if err = comm.UploadDir(dst, src, nil); err != nil { | ||
| if err = comm.UploadDir(dst, src, p.config.Excludes); err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is needed in order to path in the list of files to exclude. But the actually implementation for supporting the excludes would need to be made in the Packer SDK communicator, which this line is calling out to. At this present time the exclude argument is ignored. For the excludes we will need to provide guidance on the allowed paths and/or globs that can be passed into exclude, which I think the file provisioner could take on the work of expanding.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for noticing this. I already started a PR on packer-sdk to address this. I also left a comment there about how the pattern matching should be. Could you also take a look? |
||
| ui.Error(fmt.Sprintf("Upload failed: %s", err)) | ||
| return err | ||
| } | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.