Skip to content

feat: support rechunking using Chunkah#790

Open
HastD wants to merge 1 commit into
blue-build:mainfrom
HastD:chunkah
Open

feat: support rechunking using Chunkah#790
HastD wants to merge 1 commit into
blue-build:mainfrom
HastD:chunkah

Conversation

@HastD

@HastD HastD commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Add a --chunkah option to bluebuild build that rechunks the image using Chunkah, a more modern, content-agnostic rechunker that's actively maintained and should offer various improvements over build-chunked-oci and the legacy rechunker.

This is implemented using a fairly generic "post-build hook" mechanism that allows a post-processing step (such as rechunking) to be applied after building the image but before tagging and pushing.

@HastD HastD force-pushed the chunkah branch 2 times, most recently from effed06 to 0e92302 Compare June 2, 2026 02:22
Add a `--chunkah` option to `bluebuild build` that rechunks the image
using [Chunkah](https://github.com/coreos/chunkah), a more modern,
content-agnostic rechunker that's actively maintained and should offer
various improvements over build-chunked-oci and the legacy rechunker.

This is implemented using a fairly generic "post-build hook" mechanism
that allows a post-processing step (such as rechunking) to be applied
after building the image but before tagging and pushing.
@HastD HastD marked this pull request as ready for review June 8, 2026 16:48
@HastD HastD requested a review from gmpinder as a code owner June 8, 2026 16:48
Comment on lines +16 to +20
let mut initial_args = Vec::<OsString>::new();
if use_sudo {
initial_args.push("sudo".into());
if blue_build_utils::has_env_var(blue_build_utils::constants::SUDO_ASKPASS) {
initial_args.push("-A".into());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I should work on that cmd_append! macro. This feels more messy than it needs to be.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, went ahead and made it. It's called cmd_mut!. Released on version 1.5.0.

https://gitlab.com/wunker-bunker/comlexr/-/commit/1523e3e65c7d344c1ec1874b5f6567ce84f134f9

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, that will be very useful. I'll go ahead and modify the code to use it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though actually wait, this might not quite solve the messiness here, since the issue is with needing to dynamically determine the command name (not subsequent arguments).

@gmpinder gmpinder Jun 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use a block for the initial command name.

let command = cmd!(
{
  if this {
    "that"
  } else {
    "other"
  }
},
"arg1",
"arg2",
);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but it's still awkward to do something like "optionally insert sudo at the beginning of the command", since it makes the subsequent argument conditional, too. What I'd ideally want is something like

cmd!(
    if condition => "sudo",
    "foo",
    // ...
)

where it automatically handles making the first argument where the condition is met into the command name. The new cmd_mut! macro is nice, but I don't think it will actually simplify things here; the problem is that depending on a combination of conditions, any of sudo, podman, or skopeo could be the command name, and where the argument list picks up after that also depends on those conditions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the sudo_cmd! macro in the project. That does that for you

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[derive(Debug, Clone, Copy, Builder)]
#[builder(derive(Debug, Clone))]
pub struct RemoveImageOpts<'scope> {
pub image: &'scope str,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we try to keep this as &Reference? I'm noticing extra .to_string() calls being added which means more allocations. Also it helps to keep the API stricter.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I can change it back.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though also I wouldn't worry too much about allocations; I'm pretty sure the vast majority of BlueBuild's runtime is spent on I/O done by external processes. I haven't seen profiling data, but I'd be surprised if allocations account for more than 0.1% of runtime.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though also I wouldn't worry too much about allocations; I'm pretty sure the vast majority of BlueBuild's runtime is spent on I/O done by external processes. I haven't seen profiling data, but I'd be surprised if allocations account for more than 0.1% of runtime.

That's a fair point, but the extra safety in the API is still useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants