-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: py_image_layers #349
Conversation
9aa43f9
to
93bd381
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Please provide a description of the change rather than just a link to an issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is becoming public API, please add tests.
# match *only* external pip like repositories that contain the string "site-packages" | ||
SITE_PACKAGES_REGEX = "\\.runfiles/.*/site-packages/.*" | ||
|
||
def py_image_layers(name, binary, interpreter_regex = PY_INTERPRETER_REGEX, site_packages_regex = SITE_PACKAGES_REGEX): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass kwargs
and propagate the well known tags.
name = "say_image", | ||
base = "@ubuntu", | ||
entrypoint = ["/examples/py_binary/say_hello"], | ||
tars = py_image_layers("say_image_layers", "say_hello"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this instead produce a filegroup
, so it can be used like a regular rule, rather than unexpectedly returning a list?
|
||
register_coreutils_toolchains() | ||
|
||
register_tar_toolchains() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users will also need this toolchain? Is the expectation that they register too, or should this ruleset be doing that in the setup
mtree = "{}.{}_tar_manifest".format(name, layer), | ||
) | ||
|
||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
native.filegroup(
name = name,
srcs = results,
... tags, visibility, etc.
)
# match *only* external pip like repositories that contain the string "site-packages" | ||
SITE_PACKAGES_REGEX = "\\.runfiles/.*/site-packages/.*" | ||
|
||
def py_image_layers(name, binary, interpreter_regex = PY_INTERPRETER_REGEX, site_packages_regex = SITE_PACKAGES_REGEX): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interpreter_regex
and site_packages_regex
are unused, the constants are used in the macro below, did you mean to use them?
Replaces #349 ### Changes are visible to end-users: yes - Searched for relevant documentation and updated as needed: yes - Breaking change (forces users to change their own code or config): no - Suggested release notes appear below: yes Add `py_image_layer` macro for creating py container images. ### Test plan I will add a test in a follow-up.
Fixes #212
Changes are visible to end-users: yes
A helper function to create image layers for a
py_binary
is now included.Test plan