Skip to content

Commit

Permalink
feat: Allow fresh rechunking of image
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpinder committed Dec 14, 2024
1 parent 4103184 commit c149bea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions process/drivers/opts/rechunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ pub struct RechunkOpts<'scope> {
#[builder(default)]
pub compression: CompressionType,
pub tempdir: Option<&'scope Path>,

#[builder(default)]
pub fresh: bool,
}
4 changes: 2 additions & 2 deletions process/drivers/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ pub trait RechunkDriver: RunDriver + BuildDriver + ContainerMountDriver {
})
.env_vars(crate::run_envs! {
"REPO" => "/var/ostree/repo",
"PREV_REF" => &*opts.image,
"PREV_REF" => if opts.fresh { "" } else { &*opts.image },
"OUT_NAME" => ostree_cache_id,
// "PREV_REF_FAIL" => "true",
"PREV_REF_FAIL" => if opts.fresh { "" } else { "true" },
"VERSION" => format!("{}", opts.version),
"OUT_REF" => format!("oci:{ostree_cache_id}"),
"GIT_DIR" => "/var/git",
Expand Down
8 changes: 8 additions & 0 deletions src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ pub struct BuildCommand {
#[cfg(feature = "rechunk")]
rechunk: bool,

/// Performs frech rechunking without using previous
/// ostree chunks.
#[arg(long)]
#[builder(default)]
#[cfg(feature = "rechunk")]
fresh_rechunk: bool,

/// The location to temporarily store files
/// while building. If unset, it will use `/tmp`.
#[arg(long)]
Expand Down Expand Up @@ -359,6 +366,7 @@ impl BuildCommand {
.description(&*recipe.description)
.base_image(format!("{}:{}", &recipe.base_image, &recipe.image_version))
.maybe_tempdir(self.tempdir.as_deref())
.fresh(self.fresh_rechunk)
.build(),
)?
} else {
Expand Down

0 comments on commit c149bea

Please sign in to comment.