-
Notifications
You must be signed in to change notification settings - Fork 691
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
Add container_run_and_commit_layer rule #1586
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
/assign @alex1545 |
/assign @smukherj1 |
I've got the rule running, this rule is well and good.
container_image(name = "to_run" ...)
container_run_and_commit_layer(name = "install", image = ":to_run.tar", ...)
container_image(name = "final", layers = [":install"], ...)
[
{
"Config": "redacted1.json",
"RepoTags": [
"bazel/stuff:to_run"
],
...
},
{
"Config": "redacted2.json",
"RepoTags": [
"bazel/staff:final"
],
...
}
]
container_image(name = "to_run" ...)
container_image(name = "final", tars = [":to_run-layer.tar"], ...)
Edit: everything is well and good. The problem is that I've saved the Docker image with |
Hey @alex1545, @smukherj1, is there a chance of getting this reviewed sometime soon? :) |
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.
Thank you very much for your contribution and sorry for the delayed reply on this.
Can you also please add a simple test to exercise this new rule? Maybe a test that runs a command to add a new file and then confirming that the expected layer tar is generated containing the new file.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Hey @alex1545, I've addressed the PR review comments and added a test to verify that the rule works correctly. Is this good the be merged? Sorry about the CLA mess, I made a git mistake when merging the upstream master into my branch, which I force reverted. |
Thank you for addressing the comments.
|
Thanks, sorry about that. I've fixed the test and added the two new test targets to the CI. |
Can you now please look at why this fails on Darwin with this error:
|
Oh I ran into this too when running the test locally, for me it was because of this line: https://github.com/bazelbuild/rules_docker/blob/master/WORKSPACE#L24 and my docker was at |
Ah I see, we also don't run the analogous test for |
/gcbrun |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alex1545, jamiees2 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I upgraded to docker-desktop 2.4.2.0-edge and this rule broke with the error
I have to fix it by adding
|
Is there a way to log what's happening while running? |
The
container_run_and_commit
rule outputs an image, but sometimes all you want is the layer of changes to the root image.We had a use-case that wasn't properly covered by
container_commit_and_extract
where we would like to obtain all the changes to the image file system, but don't have a fixed set of files that are modified. We'd like to be able to reuse the layer, which motivated the creation of this new rule.We're also planning on replacing all our usages of
container_run_and_commit
with this rule. Internally, we mostly use it for creating custom base images, but using this rule we can get smaller outputs for that target, allowing us to better utilize our build cache.