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 5f34ac8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ jobs:
COSIGN_PRIVATE_KEY: ${{ secrets.TEST_SIGNING_SECRET }}
run: |
export CARGO_HOME=$HOME/.cargo
just test-fresh-rechunk-build
just test-rechunk-build
arm64-build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,9 @@ jobs:
GH_PR_EVENT_NUMBER: ${{ github.event.number }}
COSIGN_PRIVATE_KEY: ${{ secrets.TEST_SIGNING_SECRET }}
run: |
just install-debug-all-features
cd integration-tests/test-repo
export CARGO_HOME=$HOME/.cargo
sudo -E $CARGO_HOME/bin/bluebuild build --push -vv --rechunk recipes/recipe-rechunk.yml
just test-fresh-rechunk-build
just test-rechunk-build
arm64-build:
timeout-minutes: 40
Expand Down
9 changes: 9 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ test-rechunk-build: install-debug-all-features
--rechunk \
recipes/recipe-rechunk.yml

test-fresh-rechunk-build: install-debug-all-features
cd integration-tests/test-repo \
&& sudo -E {{ cargo_bin }}/bluebuild build \
{{ should_push }} \
-vv \
--rechunk \
--fresh-rechunk \
recipes/recipe-rechunk.yml

# Run arm integration test
test-arm64-build: install-debug-all-features
cd integration-tests/test-repo \
Expand Down
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 clear_plan: bool,
}
2 changes: 1 addition & 1 deletion process/drivers/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ pub trait RechunkDriver: RunDriver + BuildDriver + ContainerMountDriver {
"REPO" => "/var/ostree/repo",
"PREV_REF" => &*opts.image,
"OUT_NAME" => ostree_cache_id,
// "PREV_REF_FAIL" => "true",
"CLEAR_PLAN" => if opts.clear_plan { "true" } else { "" },
"VERSION" => format!("{}", opts.version),
"OUT_REF" => format!("oci:{ostree_cache_id}"),
"GIT_DIR" => "/var/git",
Expand Down
9 changes: 9 additions & 0 deletions src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ pub struct BuildCommand {
#[cfg(feature = "rechunk")]
rechunk: bool,

/// Use a fresh rechunk plan, regardless of previous ref.
///
/// NOTE: Only works with `--rechunk`.
#[arg(long)]
#[builder(default)]
#[cfg(feature = "rechunk")]
clear_plan: bool,

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

0 comments on commit 5f34ac8

Please sign in to comment.