-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alias build to buildx, so it won't fail #11134
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Partially fixes #11130 |
FROM $IMAGE | ||
RUN echo $rand_content > /$rand_filename | ||
EOF | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a run_podman buildx ...
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little heavy on the cut and pasting.
lgtm |
My only concern, and I say this as someone who has no clue what |
We don't plan on adding buildx, only some of the options. But understand your point that their could be an option for |
cmd/podman/images/build.go
Outdated
@@ -44,6 +44,7 @@ var ( | |||
// Command: podman _diff_ Object_ID | |||
buildDescription = "Builds an OCI or Docker image using instructions from one or more Containerfiles and a specified build context directory." | |||
buildCmd = &cobra.Command{ | |||
Aliases: []string{"buildx"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the alias should be buildx build
(buildx has other subcommands) so when building an image with docker
, one would call docker buildx build ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it has to be podman buildx build
, other buildx subcommands should raise an error, see https://docs.docker.com/buildx/working-with-buildx/.
@@ -43,6 +43,8 @@ containers can be left in container storage. Use the `podman ps --all --storage` | |||
command to see these containers. External containers can be removed with the | |||
`podman rm --storage` command. | |||
|
|||
`podman buildx` command is an alias of `podman build`. Not all `buildx` features are available in Podman. The `buildx` option is provided for scripting compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`podman buildx` command is an alias of `podman build`. Not all `buildx` features are available in Podman. The `buildx` option is provided for scripting compatibility. | |
The `podman buildx` command is an alias of `podman build`. Not all `buildx` features are available in Podman. The `buildx` option is provided strictly for scripting compatibility. |
@Luap99 could you take a look at the failures, seems to be some command completion problem? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is broken, this diff should make it work:
diff --git a/cmd/podman/shell_completion_test.go b/cmd/podman/shell_completion_test.go
index 9bd821d8d..792beeb19 100644
--- a/cmd/podman/shell_completion_test.go
+++ b/cmd/podman/shell_completion_test.go
@@ -33,7 +33,9 @@ func TestShellCompletionFunctions(t *testing.T) {
func checkCommand(t *testing.T, cmd *cobra.Command) {
if cmd.HasSubCommands() {
for _, childCmd := range cmd.Commands() {
- checkCommand(t, childCmd)
+ if !childCmd.Hidden {
+ checkCommand(t, childCmd)
+ }
}
// if not check if completion for that command is provided
cmd/podman/images/buildx.go
Outdated
var ( | ||
// Command: podman _buildx_ | ||
// This is a hidden command, which was added to make converting | ||
// from Docekr to Podman easier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo Docker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Luap99 aotocompletion tests are still not happy.
Thanks @Luap99 |
@rhatdan test still aren't hip with this one. |
@edsantiago "buildx" means to build using BuildKit, normally implemented as a CLI plugin It has a lot of subcommands, the usual one being |
@@ -90,12 +90,20 @@ func init() { | |||
Command: imageBuildCmd, | |||
Parent: imageCmd, | |||
}) | |||
registry.Commands = append(registry.Commands, registry.CliCommand{ | |||
Command: imageBuildCmd, | |||
Parent: buildxCmd, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to create a separate command struct for buildx build. Do not reuse the imageBuildStruct. Cobra is not really designed to use the same command on several subcommands. Right now the use line in podman image build --help
will show podman buildx build [options] [CONTEXT]
instead of podman image build [options] [CONTEXT]
. I think this is causing the other completion test to fail.
Seeing as this seems to interfere quite a bit with cobra and how the help text is shown, I wonder if we should consider moving the "compatibility" layer to the Any thoughts on that @rhatdan? I'm very green behind my podman ears so that might be total bogus as well 😂 |
This comment has been minimized.
This comment has been minimized.
Hopefully this one will work, I attempted the failing tests locally and it passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add hidden --load and --progress flag as well. Signed-off-by: Daniel J Walsh <[email protected]>
LGTM |
/lgtm |
Signed-off-by: Daniel J Walsh [email protected]