Skip to content
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

chunking: Fix working as rootful #5306

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ jobs:
-v /var/lib/containers:/var/lib/containers \
-v /var/tmp:/var/tmp \
-v $(pwd):/output \
localhost/builder rpm-ostree experimental compose build-chunked-oci --bootc --format-version=1 --max-layers 99 --from localhost/base --output oci:/output/base-chunked
sudo skopeo inspect oci:base-chunked
new_created=$(sudo skopeo inspect --raw --config oci:base-chunked | jq -r .created)
localhost/builder rpm-ostree experimental compose build-chunked-oci --bootc --format-version=1 --max-layers 99 --from localhost/base --output containers-storage:localhost/chunked
sudo skopeo inspect containers-storage:localhost/chunked
new_created=$(sudo skopeo inspect --raw --config containers-storage:localhost/chunked | jq -r .created)
# ostree only stores seconds, so canonialize the rfc3339 data to seconds
test "$(date --date="${orig_created}" --rfc-3339=seconds)" = "$(date --date="${new_created}" --rfc-3339=seconds)"

Expand Down
8 changes: 7 additions & 1 deletion rust/src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,13 @@ impl BuildChunkedOCIOpts {
FileSource::Rootfs(rootfs)
} else {
let image = self.from.as_deref().unwrap();
crate::containers_storage::reexec_if_needed()?;
// TODO: Fix running this inside unprivileged podman too. We'll likely need
// to refactor things into a two-step process where we do the mount+ostree repo commit
// in a subprocess that has the "unshare", and then the secondary main process
// just reads/operates on that.
// Note that this would all be a lot saner with a composefs-native container storage
// as we could cleanly operate on that, asking c/storage to synthesize one for us.
// crate::containers_storage::reexec_if_needed()?;
FileSource::Podman(Mount::new_for_image(image)?)
};
let rootfs = match &rootfs_source {
Expand Down
1 change: 1 addition & 0 deletions rust/src/containers_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::cmdutils::CommandRunExt;
/// Ensure that we're in a new user+mountns, so that "buildah mount"
/// will work reliably.
/// https://github.com/containers/buildah/issues/5976
#[allow(dead_code)]
pub(crate) fn reexec_if_needed() -> Result<()> {
if ostree_ext::container_utils::running_in_container() {
crate::reexec::reexec_with_guardenv(
Expand Down