-
Notifications
You must be signed in to change notification settings - Fork 336
commit: Support merging docker-style layers #578
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?
Conversation
|
Unclear why the CI failed here: Why does it look at the .tar.gz file for newlines at EOF? |
|
@alexlarsson I think it should be enough to add *.gz to |
|
@giuseppe Thanks! |
|
Once this gets merged, I'll probably have to rework #491 to use the new APIs |
|
Seems to fail the test-commit.sh test in the installed variant. I think this really is an issue with the commit that i stole from #401 |
giuseppe
left a comment
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.
useful API. It can be used by atomic for system containers as well.
| if (!ostree_mutable_tree_remove_child (self, whiteout_file_name, &local_error) && | ||
| !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) | ||
| { | ||
| g_propagate_error (error, g_steal_pointer (&local_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.
What do you think if we don't error out here? I have tried with a manually crafted Docker image that has a whiteout for a file that doesn't exist in a lower layer. The image could be imported and run without errors. It'll probably turn to be useful for testing layers that are not built as part of the same image.
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.
What do you mean? It especially ignores the "not found" error and only reports if you have some other error. So, removing something from the base layers thats not there should work. Did it not?
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.
ok sorry, I misread the condition, it is doing exactly what I meant :)
9833f70 to
c2c5a30
Compare
|
Pushed a new version, based on updated patch for the --tree=ref issue from #581 |
This adds support to OstreeMutableTree for merging one mtree into another, using the mechanism for whiteouts that docker/OCI uses (i.e. .wh. whiteout files). Since the spec doesn't guarantee the order of the whiteouts (i.e. a file from this layer can appear before a whiteout that affects it) we can't really apply layer in a streaming fashion. Thus we read the layer into an mtree end then we apply it. This adds two operations to commit: --tree=layer-tar=TARFILE and --tree=layer-ref=COMMIT which are different ways to apply layers when commiting.
c2c5a30 to
6f6b55d
Compare
|
New version based on git master without any extra commits. Please review. |
src/libostree/ostree-mutable-tree.c
Outdated
| GError **error) | ||
| { | ||
| g_hash_table_foreach_remove (self->subdirs, remove_all, NULL); | ||
| g_hash_table_foreach_remove (self->files, remove_all, NULL); |
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.
Can't we just use g_hash_table_remove_all()?
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.
Yeah, forgot that.
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.
(fixed up)
|
Looks good to me. A bit bikeshed, though I wonder if the new APIs and CLI switches should use |
|
I'd vote for Hum...so can you briefly describe the big picture here? Would tools store both "layer refs" like the atomic/ostree integration is doing today, as well as generate "squashed commits" using this? And the benefit here is...making it faster to check out? |
|
This is more of a tool that can be used multiple ways. Either you can store layers as refs or you can combine refs and/or tarballs into a resolved branch. In the case of flatpak, we never really use layers. Things are always fully resolved. However we run into layers as we start importing apps from oci images which may have multiple layers that need to be combined. |
|
@alexlarsson: PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@alexlarsson: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This adds support to OstreeMutableTree for merging one mtree into another, using the mechanism for whiteouts that docker/OCI uses (i.e. .wh. whiteout files).
Since the spec doesn't guarantee the order of the whiteouts (i.e. a file from this layer can appear before a whiteout that affects it) we can't really apply layer in a streaming fashion. Thus we read the layer into an mtree end then we apply it.
This adds two operations to commit:
--tree=layer-tar=TARFILE
and
--tree=layer-ref=COMMIT
which are different ways to apply layers when commiting.
This PR contains two extra commits (from #401 and #577) that make the testsuite work. They should probably be merged first and then dropped from this PR before merging it.