getporter / porter

Porter enables you to package your application artifact, client tools, configuration and deployment logic together as an installer that you can distribute, and install with a single command.
https://porter.sh
Apache License 2.0
1.22k stars 204 forks source link

Support configuring the compression level when archiving bundles #3101

Closed jarnfast closed 4 months ago

jarnfast commented 4 months ago

What does this change

This adds an extra command line flag for the archive command that allows configuring the level of compression to use when creating the gzipped tar archive.

$ porter archive whalegap.tgz --reference ghcr.io/getporter/examples/whalegap:v0.2.0 --compression NoCompression

If the flag is omitted the gzipped tar archive will be compressed with DefaultCompression - this is equivalent to the pre-configurable-compression behavior of Porter.

Possible values for the --compression flag is listed in the help text.

$ porter archive -h
[snipped]
Flags:
  -c, --compression string   Compression level to use when creating the gzipped tar archive. Allowed values are: BestCompression, BestSpeed, DefaultCompression, HuffmanOnly, NoCompression (default "DefaultCompression")

publish appears to not care about the compression level of the gzipped tar archive.

What issue does it fix

Closes #3083

Notes for the reviewer

I opted to expose all compression levels for the gzip/flate go module - keeping the case intact. We can elect to exclude some and/or adjust the casing.

Checklist