Skip to content

Conversation

@christoph-zededa
Copy link
Contributor

@christoph-zededa christoph-zededa commented Sep 12, 2025

- What I did

there is already a public method "WithBuildDocker", so it makes sense that the parameter definition is public as well so that a user of this method can actually use it

also allow dry-run with specific docker-runner

- How I did it

- How to verify it

no new feature was implemented, everything should work as before

- Description for the changelog

make dockerRunner public
untangle dockerRunner and DryRun

- A picture of a cute animal (not mandatory but encouraged)

ChatGPT Image Sep 12, 2025, 02_23_49 PM (ChatGPT was very lazy today ...)

Copy link
Collaborator

@deitch deitch left a comment

Choose a reason for hiding this comment

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

There are some comment changes (the find-and-replace got a little too aggressive), and one func that probably should be public as well, given the changes. Those are for the first commit.

For the second commit, the disentangle, I didn't quite get what the change is. Instead of a different docker runner, it calls pkglib.WithDryRun() and it calls pkglib.WithBuildDocker(pkglib.NewDockerDryRunner())? I don't get it

@christoph-zededa christoph-zededa force-pushed the with_build_docker_public branch 2 times, most recently from a090dbb to b9a9795 Compare September 15, 2025 09:48
there is already a public method "WithBuildDocker",
so it makes sense that the parameter definition is public as well
so that a user of this method can actually use it

Signed-off-by: Christoph Ostarek <[email protected]>
@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

Thanks for cleaning those up. I still don't quite get the second commit, though.

@christoph-zededa
Copy link
Contributor Author

@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

The current way is:

  • you pass WithBuildDocker() if you want a specific docker runner, else it uses default (which it does in most cases)
  • you pass WithDryRun() to indicate dry run

You are trying to merge those together, so instead of WithDryRun(), you can just do WithBuildDocker(NewDryRunner())? But don't you still need WithDryRun() anyways, because of other parts, like here and here? So what does it buy us?

BTW, the first commit is good to go, and solves your immediate problem. If you want to move the second commit to its own PR slo it can be discussed, and not hold you up on your requirements, go for it.

@christoph-zededa
Copy link
Contributor Author

If you want to move the second commit to its own PR slo it can be discussed, and not hold you up on your requirements, go for it.

I also need that commit.

@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

I also need that commit.

It was a nice idea, though 😁

@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

I also need that commit.

What for?

@christoph-zededa
Copy link
Contributor Author

I also need that commit.

What for?

I need Build to return here: https://github.com/linuxkit/linuxkit/blob/master/src/cmd/linuxkit/pkglib/build.go#L506 otherwise it does some other things and returns an error.

@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

But it does already, with WithDryRun(), which already exists. What does that have to do with the second commit?

@christoph-zededa
Copy link
Contributor Author

christoph-zededa commented Sep 15, 2025

WithDryRun()

The problem is that WithDryRun() also overwrites my WithBuildDocker (on master)

@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

also overwrites my

Is that what the second commit is trying to do? In normal usage (no dry run), it respects your WithBuildDocker() and, if none provided, uses the default. If dry run and none provided, it uses the default dry run, but if you used WithBuildDocker(), it ignores it?

@christoph-zededa
Copy link
Contributor Author

also overwrites my

Is that what the second commit is trying to do? In normal usage (no dry run), it respects your WithBuildDocker() and, if none provided, uses the default. If dry run and none provided, it uses the default dry run, but if you used WithBuildDocker(), it ignores it?

Yes, it gets overwritten here: https://github.com/linuxkit/linuxkit/blob/master/src/cmd/linuxkit/pkglib/build.go#L322

@deitch
Copy link
Collaborator

deitch commented Sep 15, 2025

OK, now I get it. I will make a small suggestion, then we will be good to go.


if dryRun {
opts = append(opts, pkglib.WithDryRun())
opts = append(opts, pkglib.WithBuildDocker(pkglib.NewDockerDryRunner()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Recommend getting rid of this, as this will override if someone both uses WithDryRun() and WithBuildDocker().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wrong line?

This is in the cobra.Command ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, now with the other comment it makes sense to me

this makes it possible for a user of this API to
build their own DryRunner

also make newDockerRunner public as well to be consistent

Signed-off-by: Christoph Ostarek <[email protected]>
@deitch deitch merged commit 43200ea into linuxkit:master Sep 15, 2025
25 checks passed
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