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

Commit

Permalink
Merge pull request #550 from cgwalters/deploy-no-clean
Browse files Browse the repository at this point in the history
deploy: Add a no_clean option
  • Loading branch information
jmarrero authored Oct 1, 2023
2 parents ff2171b + 8fa019b commit c242539
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit c242539

Please sign in to comment.