feat: Allow fresh rechunking of image
This commit is contained in:
parent
1157ac7d74
commit
50ed183cde
7 changed files with 33 additions and 8 deletions
1
.github/workflows/build-pr.yml
vendored
1
.github/workflows/build-pr.yml
vendored
|
|
@ -296,6 +296,7 @@ jobs:
|
||||||
COSIGN_PRIVATE_KEY: ${{ secrets.TEST_SIGNING_SECRET }}
|
COSIGN_PRIVATE_KEY: ${{ secrets.TEST_SIGNING_SECRET }}
|
||||||
run: |
|
run: |
|
||||||
export CARGO_HOME=$HOME/.cargo
|
export CARGO_HOME=$HOME/.cargo
|
||||||
|
just test-fresh-rechunk-build
|
||||||
just test-rechunk-build
|
just test-rechunk-build
|
||||||
|
|
||||||
arm64-build:
|
arm64-build:
|
||||||
|
|
|
||||||
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
|
@ -333,10 +333,9 @@ jobs:
|
||||||
GH_PR_EVENT_NUMBER: ${{ github.event.number }}
|
GH_PR_EVENT_NUMBER: ${{ github.event.number }}
|
||||||
COSIGN_PRIVATE_KEY: ${{ secrets.TEST_SIGNING_SECRET }}
|
COSIGN_PRIVATE_KEY: ${{ secrets.TEST_SIGNING_SECRET }}
|
||||||
run: |
|
run: |
|
||||||
just install-debug-all-features
|
|
||||||
cd integration-tests/test-repo
|
|
||||||
export CARGO_HOME=$HOME/.cargo
|
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:
|
arm64-build:
|
||||||
timeout-minutes: 40
|
timeout-minutes: 40
|
||||||
|
|
|
||||||
9
justfile
9
justfile
|
|
@ -155,6 +155,15 @@ test-rechunk-build: install-debug-all-features
|
||||||
--rechunk \
|
--rechunk \
|
||||||
recipes/recipe-rechunk.yml
|
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 \
|
||||||
|
--rechunk-clear-plan \
|
||||||
|
recipes/recipe-rechunk.yml
|
||||||
|
|
||||||
# Run arm integration test
|
# Run arm integration test
|
||||||
test-arm64-build: install-debug-all-features
|
test-arm64-build: install-debug-all-features
|
||||||
cd integration-tests/test-repo \
|
cd integration-tests/test-repo \
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,7 @@ pub struct RechunkOpts<'scope> {
|
||||||
#[builder(default)]
|
#[builder(default)]
|
||||||
pub compression: CompressionType,
|
pub compression: CompressionType,
|
||||||
pub tempdir: Option<&'scope Path>,
|
pub tempdir: Option<&'scope Path>,
|
||||||
|
|
||||||
|
#[builder(default)]
|
||||||
|
pub clear_plan: bool,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ pub trait RechunkDriver: RunDriver + BuildDriver + ContainerMountDriver {
|
||||||
"REPO" => "/var/ostree/repo",
|
"REPO" => "/var/ostree/repo",
|
||||||
"PREV_REF" => &*opts.image,
|
"PREV_REF" => &*opts.image,
|
||||||
"OUT_NAME" => ostree_cache_id,
|
"OUT_NAME" => ostree_cache_id,
|
||||||
// "PREV_REF_FAIL" => "true",
|
"CLEAR_PLAN" => if opts.clear_plan { "true" } else { "" },
|
||||||
"VERSION" => format!("{}", opts.version),
|
"VERSION" => format!("{}", opts.version),
|
||||||
"OUT_REF" => format!("oci:{ostree_cache_id}"),
|
"OUT_REF" => format!("oci:{ostree_cache_id}"),
|
||||||
"GIT_DIR" => "/var/git",
|
"GIT_DIR" => "/var/git",
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ use blue_build_process_management::{
|
||||||
use blue_build_recipe::Recipe;
|
use blue_build_recipe::Recipe;
|
||||||
use blue_build_utils::{
|
use blue_build_utils::{
|
||||||
constants::{
|
constants::{
|
||||||
ARCHIVE_SUFFIX, BB_REGISTRY_NAMESPACE, CONFIG_PATH, CONTAINER_FILE, RECIPE_FILE,
|
ARCHIVE_SUFFIX, BB_BUILD_RECHUNK, BB_BUILD_RECHUNK_CLEAR_PLAN, BB_REGISTRY_NAMESPACE,
|
||||||
RECIPE_PATH,
|
CONFIG_PATH, CONTAINER_FILE, RECIPE_FILE, RECIPE_PATH,
|
||||||
},
|
},
|
||||||
cowstr,
|
cowstr,
|
||||||
credentials::{Credentials, CredentialsArgs},
|
credentials::{Credentials, CredentialsArgs},
|
||||||
|
|
@ -111,15 +111,25 @@ pub struct BuildCommand {
|
||||||
squash: bool,
|
squash: bool,
|
||||||
|
|
||||||
/// Performs rechunking on the image to allow for smaller images
|
/// Performs rechunking on the image to allow for smaller images
|
||||||
/// and smaller updates. This will increase the build-time
|
/// and smaller updates.
|
||||||
|
///
|
||||||
|
/// WARN: This will increase the build-time
|
||||||
/// and take up more space during build-time.
|
/// and take up more space during build-time.
|
||||||
///
|
///
|
||||||
/// NOTE: This must be run as root!
|
/// NOTE: This must be run as root!
|
||||||
#[arg(long, group = "archive_rechunk")]
|
#[arg(long, group = "archive_rechunk", env = BB_BUILD_RECHUNK)]
|
||||||
#[builder(default)]
|
#[builder(default)]
|
||||||
#[cfg(feature = "rechunk")]
|
#[cfg(feature = "rechunk")]
|
||||||
rechunk: bool,
|
rechunk: bool,
|
||||||
|
|
||||||
|
/// Use a fresh rechunk plan, regardless of previous ref.
|
||||||
|
///
|
||||||
|
/// NOTE: Only works with `--rechunk`.
|
||||||
|
#[arg(long, env = BB_BUILD_RECHUNK_CLEAR_PLAN)]
|
||||||
|
#[builder(default)]
|
||||||
|
#[cfg(feature = "rechunk")]
|
||||||
|
rechunk_clear_plan: bool,
|
||||||
|
|
||||||
/// The location to temporarily store files
|
/// The location to temporarily store files
|
||||||
/// while building. If unset, it will use `/tmp`.
|
/// while building. If unset, it will use `/tmp`.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
|
|
@ -359,6 +369,7 @@ impl BuildCommand {
|
||||||
.description(&*recipe.description)
|
.description(&*recipe.description)
|
||||||
.base_image(format!("{}:{}", &recipe.base_image, &recipe.image_version))
|
.base_image(format!("{}:{}", &recipe.base_image, &recipe.image_version))
|
||||||
.maybe_tempdir(self.tempdir.as_deref())
|
.maybe_tempdir(self.tempdir.as_deref())
|
||||||
|
.clear_plan(self.rechunk_clear_plan)
|
||||||
.build(),
|
.build(),
|
||||||
)?
|
)?
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ pub const BB_PRIVATE_KEY: &str = "BB_PRIVATE_KEY";
|
||||||
pub const BB_REGISTRY: &str = "BB_REGISTRY";
|
pub const BB_REGISTRY: &str = "BB_REGISTRY";
|
||||||
pub const BB_REGISTRY_NAMESPACE: &str = "BB_REGISTRY_NAMESPACE";
|
pub const BB_REGISTRY_NAMESPACE: &str = "BB_REGISTRY_NAMESPACE";
|
||||||
pub const BB_USERNAME: &str = "BB_USERNAME";
|
pub const BB_USERNAME: &str = "BB_USERNAME";
|
||||||
|
pub const BB_BUILD_RECHUNK: &str = "BB_BUILD_RECHUNK";
|
||||||
|
pub const BB_BUILD_RECHUNK_CLEAR_PLAN: &str = "BB_BUILD_RECHUNK_CLEAR_PLAN";
|
||||||
|
|
||||||
// Docker vars
|
// Docker vars
|
||||||
pub const DOCKER_HOST: &str = "DOCKER_HOST";
|
pub const DOCKER_HOST: &str = "DOCKER_HOST";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue