Files
Packer-Cn/website/content/docs/post-processors/compress.mdx
T
Zachary ShiltonandWilken Rivera cae7bd9e5b feat(website): add official and HCP Packer Ready labels (#11449)
* refactor(website): use prop and CSS for plugin label spacing

* fix: add official tier label to built-in plugin docs

* feat(website): add BadgesHeader component

* refactor(website): use BadgesHeader in all content

* feat(website): add HCP ready demo, tweak badge look

* refactor: integrate work from add-plugin-version branch

* fix(website): correct bad import

* fix: use updated MDX custom component

* chore: remove plugin version label work from this branch

* chore: remove unused var

* fix: use new BadgesHeader interface for dual tags

* chore: remove unused var, refine comment

* fix: remove unused broken import

* fix: shorten property for HCP packer readiness

* Apply suggestions from code review

Remove a few demo labels before merging

Co-authored-by: Wilken Rivera <[email protected]>
2021-12-17 10:22:16 -05:00

88 lines
2.5 KiB
Plaintext

---
description: |
The Packer compress post-processor takes an artifact with files (such as from
VMware or VirtualBox) and compresses the artifact into a single archive.
page_title: Compress - Post-Processors
---
<BadgesHeader>
<PluginBadge type="official" />
</BadgesHeader>
# Compress Post-Processor
Type: `compress`
Artifact BuilderId: `packer.post-processor.compress`
The Packer compress post-processor takes an artifact with files (such as from
VMware or VirtualBox) and compresses the artifact into a single archive.
## Configuration
### Optional:
By default, packer will build archives in `.tar.gz` format with the following
filename: `packer_{{.BuildName}}_{{.BuilderType}}`. If you want to change this
you will need to specify the `output` option.
- `output` (string) - The path to save the compressed archive. The archive
format is inferred from the filename. E.g. `.tar.gz` will be a gzipped
tarball. `.zip` will be a zip file. If the extension can't be detected
packer defaults to `.tar.gz` behavior but will not change the filename.
This is treated as a
[template engine](/docs/templates/legacy_json_templates/engine). Therefore, you
may use user variables and template functions in this field.
The following special variables are also available to use in the output
template:
- `{{.BuildName}}`
- `{{.BuilderType}}`
If you are executing multiple builders in parallel you should make sure
`output` is unique for each one. For example `packer_{{.BuildName}}.zip`.
- `format` (string) - Disable archive format autodetection and use provided
string.
- `compression_level` (number) - Specify the compression level, for
algorithms that support it, from 1 through 9 inclusive. Typically higher
compression levels take longer but produce smaller files. Defaults to `6`
- `keep_input_artifact` (boolean) - if `true`, keep both the source files and
the compressed file; if `false`, discard the source files. Defaults to
`false`
### Supported Formats
Supported file extensions include `.zip`, `.tar`, `.gz`, `.tar.gz`, `.lz4` and
`.tar.lz4`. Note that `.gz` and `.lz4` will fail if you have multiple files to
compress.
## Examples
Some minimal examples are shown below, showing only the post-processor
configuration:
```json
{
"type": "compress",
"output": "archive.tar.lz4"
}
```
```json
{
"type": "compress",
"output": "{{.BuildName}}_bundle.zip"
}
```
```json
{
"type": "compress",
"output": "log_{{.BuildName}}.gz",
"compression_level": 9
}
```