Skip to content

Conversation

@alexlarsson
Copy link
Member

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.

@alexlarsson
Copy link
Member Author

Unclear why the CI failed here:

prohibit_empty_lines_at_EOF
tests/base.tar.gz
tests/layer.tar.gz
maint.mk: empty line(s) or no newline at EOF

Why does it look at the .tar.gz file for newlines at EOF?

@giuseppe
Copy link
Member

@alexlarsson I think it should be enough to add *.gz to VC_LIST_ALWAYS_EXCLUDE_REGEX in the cfg.mk file. You can quickly test it locally with make syntax-check

@alexlarsson
Copy link
Member Author

@giuseppe Thanks!

@giuseppe
Copy link
Member

Once this gets merged, I'll probably have to rework #491 to use the new APIs

@alexlarsson
Copy link
Member Author

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

Copy link
Member

@giuseppe giuseppe left a 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));
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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 :)

@alexlarsson
Copy link
Member Author

Pushed a new version, based on updated patch for the --tree=ref issue from #581
Hopefully this one passed the tests.

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.
@alexlarsson
Copy link
Member Author

New version based on git master without any extra commits. Please review.

GError **error)
{
g_hash_table_foreach_remove (self->subdirs, remove_all, NULL);
g_hash_table_foreach_remove (self->files, remove_all, NULL);
Copy link
Member

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()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, forgot that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fixed up)

@jlebon
Copy link
Member

jlebon commented Nov 17, 2016

Looks good to me. A bit bikeshed, though I wonder if the new APIs and CLI switches should use oci_layer/oci-layer since "layer" is a bit generic.

@cgwalters
Copy link
Member

I'd vote for oci-layer too.

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?

@alexlarsson
Copy link
Member Author

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.

@cgwalters
Copy link
Member

@openshift-ci-robot
Copy link
Collaborator

@alexlarsson: PR needs rebase.

Details

Instructions 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.

@openshift-ci
Copy link

openshift-ci bot commented Jun 29, 2023

@alexlarsson: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/sanity ca02e0e link true /test sanity
ci/prow/images ca02e0e link true /test images
ci/prow/fcos-e2e ca02e0e link true /test fcos-e2e

Full PR test history. Your PR dashboard.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants