Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

deploy: Add a no_clean option #550

Merged
merged 1 commit into from
Oct 1, 2023
Merged
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
13 changes: 11 additions & 2 deletions lib/src/container/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub struct DeployOpts<'a> {
/// to a different container image, the fetch process will reuse shared layers, but
/// it will not be necessary to remove the previous image.
pub no_imgref: bool,

/// Do not cleanup deployments
pub no_clean: bool,
}

/// Write a container image to an OSTree deployment.
Expand Down Expand Up @@ -106,15 +109,21 @@ pub async fn deploy(
Some(&opts),
cancellable,
)?;
let flags = ostree::SysrootSimpleWriteDeploymentFlags::NONE;
let flags = if options.no_clean {
ostree::SysrootSimpleWriteDeploymentFlags::NO_CLEAN
} else {
ostree::SysrootSimpleWriteDeploymentFlags::NONE
};
sysroot.simple_write_deployment(
Some(stateroot),
deployment,
merge_deployment.as_ref(),
flags,
cancellable,
)?;
sysroot.cleanup(cancellable)?;
if !options.no_clean {
sysroot.cleanup(cancellable)?;
}
}

Ok(state)
Expand Down
Loading