Skip to content
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

Use cobra #373

Merged
merged 1 commit into from
Oct 14, 2021
Merged

Use cobra #373

merged 1 commit into from
Oct 14, 2021

Conversation

robberphex
Copy link
Contributor

@robberphex robberphex commented Sep 18, 2021

  • switch to spf13/cobra
    • support nerdctl build . -t a:b
    • support completion for fish/powershell/zsh
  • run/exec support --
  • add test for exec command
  • add test for envvar CONTAINERD_NAMESPACE support.
    • testutil.go support overrice envvar
  • for image without repository/tag, show <none>, keep compatible with docker.(images command)
  • support logout completion

cmd/nerdctl/build.go Outdated Show resolved Hide resolved
cmd/nerdctl/build.go Outdated Show resolved Hide resolved
cmd/nerdctl/build.go Outdated Show resolved Hide resolved
cmd/nerdctl/commit.go Outdated Show resolved Hide resolved
cmd/nerdctl/compose.go Outdated Show resolved Hide resolved
cmd/nerdctl/events.go Outdated Show resolved Hide resolved
cmd/nerdctl/logout.go Outdated Show resolved Hide resolved
cmd/nerdctl/rm.go Outdated Show resolved Hide resolved
cmd/nerdctl/run.go Outdated Show resolved Hide resolved
cmd/nerdctl/run.go Outdated Show resolved Hide resolved
pkg/imgutil/imgutil.go Outdated Show resolved Hide resolved
cmd/nerdctl/main.go Outdated Show resolved Hide resolved
cmd/nerdctl/main.go Outdated Show resolved Hide resolved
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks, but please make sure env vars such as CONTAINERD_NAMESPACE are still supported.
And please clean up debug codes.

cmd/nerdctl/images.go Outdated Show resolved Hide resolved
@ktock
Copy link
Member

ktock commented Oct 13, 2021

As mentioned in #373 (comment), nerdctl image rm doesn't work (and fails silently)

# nerdctl images
REPOSITORY                           TAG           IMAGE ID        CREATED           SIZE
ghcr.io/stargz-containers/busybox    1.32.0-org    bde48e175117    14 seconds ago    1.3 MiB
# nerdctl image rm bde48e175117
# echo $?
0
# nerdctl images
REPOSITORY                           TAG           IMAGE ID        CREATED           SIZE
ghcr.io/stargz-containers/busybox    1.32.0-org    bde48e175117    24 seconds ago    1.3 MiB

@robberphex robberphex force-pushed the release/use-cobra branch 3 times, most recently from eb9bf57 to 67868e7 Compare October 13, 2021 08:07
@robberphex
Copy link
Contributor Author

@ktock I reverted related change for nerdctl image rm doesn't work.

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Oct 13, 2021

nerdctl completion bash does not seem to work when the daemon is not running

$ nerdctl completion bash
FATA[0000] rootless containerd not running? (hint: use `containerd-rootless-setuptool.sh install` to start rootless containerd): stat /run/user/1001/containerd-rootless: no such file or directory 

appNeedsRootlessParentMain() in main_linux.go seems receiving empty args []string.

@robberphex
Copy link
Contributor Author

@AkihiroSuda
"nerdctl completion bash does not seem to work when the daemon is not running" is fixed now.

@AkihiroSuda
Copy link
Member

@robberphex robberphex force-pushed the release/use-cobra branch 2 times, most recently from 1774582 to 81c3122 Compare October 14, 2021 11:00
cmd/nerdctl/login.go Outdated Show resolved Hide resolved
repalce spf13/cobra and spf13/pfla

Signed-off-by: luyanbo <robert.lyb@alibaba-inc.com>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks, this was huge! ❤️

@ktock @fahedouch @fuweid
I'm merging this, but if you find regressions, please open issues (or PRs)

@AkihiroSuda AkihiroSuda merged commit 29629b0 into containerd:master Oct 14, 2021
@AkihiroSuda AkihiroSuda mentioned this pull request Oct 14, 2021
@AkihiroSuda
Copy link
Member

follow-up PR #431

@AkihiroSuda AkihiroSuda mentioned this pull request Oct 14, 2021
@robberphex robberphex deleted the release/use-cobra branch October 17, 2021 05:49
@ningmingxiao
Copy link
Contributor

why use cobra instead of cli?

@robberphex
Copy link
Contributor Author

@ningmingxiao
With cobra, nerdctl can:

  • support nerdctl build . -t a:b. cli can only support nerdctl build -t a:b .
  • support completion for fish/powershell/zsh without any extra config.

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

Successfully merging this pull request may close these issues.

None yet

5 participants