-
Notifications
You must be signed in to change notification settings - Fork 573
Support for passing through raw buildkit policies #1628
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
Conversation
Notes from @tonistiigi from slack: https://dockercommunity.slack.com/archives/C7S7A40MP/p1679946536583609?thread_ts=1679946076.766389&cid=C7S7A40MP Recording them here in case the Slack history disappears:
last point is similar to #1675 |
@AkihiroSuda Afaics, the points from the last comment have not been updated yet. |
@cpuguy83 are you still interested in looking at this? We're coming up to a buildx release soon, I imagine you'd probably want this in? If you're busy, I can try and carry this with @tonistiigi's suggested points 🎉 |
I think I've mostly got it. Sent you a message in slack but I'll post here as well:
|
3469444
to
ebbb602
Compare
Updated this with the requested changes. Note that while policies will apply to bakes it does not currently print that information with |
If we decide to remove the experimental or expose this more visibly, then it should show up in |
I think we still need a couple changes - we need to avoid calling I'm also not convinced on the env name - I'd personally prefer to use a combination of our already existing |
This adds an env var which can be used to pass in a path to a file to read a buildkit source poliy from. This is applied to any build is executed with the env set. It is also applied to bakes (which are calling build behind the scenes). Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Updated with the changes from your fixup commit. |
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.
cc @dvdksn we might want some docs changes to note this somewhere?
p := os.Getenv("EXPERIMENTAL_BUILDKIT_SOURCE_POLICY") | ||
if p == "" { | ||
return nil, nil | ||
} | ||
|
||
data, err := os.ReadFile(p) |
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.
If I wanted to update this to also allow passing the policy itself via environment variable,
-
would such a change be considered?
-
should that be implemented with this same variable (some kind of fallback either after reading the file or after trying to parse the JSON string?) or via a different variable?
😇
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.
would such a change be considered?
I think this could be a bit messy to pass a big json/proto value with env. Any other option that would avoid creating temp file if that is the 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.
I guess something like EXPERIMENTAL_BUILDKIT_SOURCE_POLICY=<(... generate policy here ...) docker buildx build ...
would probably work, given we read the entire file all at once and don't make any assumptions about it being an actual file (like trying to seek or something).
While we consider coming up with a nice DX for policies, allow passing through the raw buildkit format.