feat(py_image_layer): configurable default layer compression#1220
Open
thirtyseven wants to merge 1 commit into
Open
feat(py_image_layer): configurable default layer compression#1220thirtyseven wants to merge 1 commit into
thirtyseven wants to merge 1 commit into
Conversation
Add a //py:layer_compression string_flag (gzip|zstd, default gzip) plus a :layer_compression_zstd config_setting. py_image_layer's `compress` now defaults to a select() over that flag instead of a hard-coded "gzip", so the default compression can be flipped globally with --@aspect_rules_py//py:layer_compression=zstd without setting `compress` on every target. An explicit `compress` attr still wins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
py_image_layerexposes a per-targetcompressattribute (defaultgzip), but there's no way to change the default across a build — you have to setcompress = "zstd"on every target.Change
Adds a
//py:layer_compressionstring_flag(gzip|zstd, defaultgzip) and a:layer_compression_zstdconfig_setting.py_image_layer'scompressnow defaults to aselect()over that flag instead of a hard-coded"gzip":compress = "..."on the target still wins (the macro only applies the flag-driven default whencompressis unset).Test
buildifier --lint=warnclean on both files.//py:layer_compressionand//py:layer_compression_zstdanalyze successfully.select()resolves from a downstream package and flips with the flag (default → gzip branch,--@aspect_rules_py//py:layer_compression=zstd→ zstd branch).Note: the full
//cases/oci/py_image_layere2e build couldn't be exercised in my environment due to an unrelated Apple SDK download403in the venv-tool toolchain; CI should cover it.