-
-
Notifications
You must be signed in to change notification settings - Fork 42
Add strip_prefix
parameter to py_image_layer
#515
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,18 @@ assert_tar_listing( | |
actual = [":my_app_layers"], | ||
expected = ":my_app_layers.listing", | ||
) | ||
|
||
# Case 2: With `strip_prefix` and `root` | ||
py_image_layer( | ||
name = "my_app_layers_strip_prefix", | ||
binary = ":my_app_bin", | ||
platform = ":linux_amd64", | ||
strip_prefix = "py\\/tests\\/py_image_layer\\/my_app_bin", | ||
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. it should be possible to pass this string to awk 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. basically pass this information to awk using its |
||
root = "/app", | ||
) | ||
|
||
assert_tar_listing( | ||
name = "my_app_layers_strip_prefix_test", | ||
actual = [":my_app_layers_strip_prefix"], | ||
expected = ":my_app_layers_strip_prefix.listing", | ||
) |
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.
Note: this line is the primary change. Here we append
strip_prefix
to the beginning matcher, so that it is taken out of the path.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.
strip_prefix needs more than this i believe, see an example logic.
https://github.com/bazel-contrib/bazel-lib/blob/c6707f1de817296befc9c238ddb0c27ed43a7c46/lib/private/modify_mtree.awk#L3-L31