-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
hasher: hash security.capability attributes #1994
hasher: hash security.capability attributes #1994
Conversation
In Dockerfile, if there is something like: ``` RUN setcap cap_net_raw=+ep /path/to/binary ``` kaniko won't detect that there is a change on file `/path/to/binary` and thus discards this layer. This patch allows the hasher function to actually look at `security.capability` extended attributes.
@imjasonh: Could you help take a look when you get a chance? Thanks~ |
@@ -172,3 +177,28 @@ func Retry(operation retryFunc, retryCount int, initialDelayMilliseconds int) er | |||
|
|||
return err | |||
} | |||
|
|||
func Lgetxattr(path string, attr string) ([]byte, error) { |
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.
It doesn't look like this function needs to be exported, can we rename to lgetxattr
and add a comment?
I'd also love to have a test covering this behavior, since it's pretty inscrutable to me personally.
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.
Sure, I can add a comment there.
Regarding tests, I can take a look at how to write a test(either a unit test or e2e test). But if you have any pointers or suggestions, that'd be great.
This is a followup of GoogleContainerTools#1994. This test runs a Dockerfile where setcap is executed. Without the fix in GoogleContainerTools#1994, the last command won't generate any diff and thus is discarded by kaniko and thus should fail this test.
This is a followup of GoogleContainerTools#1994. This test runs a Dockerfile where setcap is executed. Without the fix in GoogleContainerTools#1994, the last command won't generate any diff and thus is discarded by kaniko and thus should fail this test.
This is a followup of GoogleContainerTools#1994. This test runs a Dockerfile where setcap is executed. Without the fix in GoogleContainerTools#1994, the last command won't generate any diff and thus is discarded by kaniko and thus should fail this test.
This is a followup of GoogleContainerTools#1994. This test runs a Dockerfile where setcap is executed. Without the fix in GoogleContainerTools#1994, the last command won't generate any diff and thus is discarded by kaniko and thus should fail this test.
This is a followup of GoogleContainerTools#1994. This test runs a Dockerfile where setcap is executed. Without the fix in GoogleContainerTools#1994, the last command won't generate any diff and thus is discarded by kaniko and thus should fail this test.
Fixes #1851
Description
In Dockerfile, if there is something like:
kaniko won't detect that there is a change on file
/path/to/binary
andthus discards this layer. This patch allows the hasher function to
actually look at
security.capability
extended attributes.The function
Lgetxattr
uses https://github.com/moby/moby/blob/c72c1ca62cd20e74582a01b8a54a58ae7f646d4c/pkg/system/xattrs_linux.go#L8Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Reviewer Notes
Release Notes