-
Notifications
You must be signed in to change notification settings - Fork 373
shimv2: Add a "--version" cli option #2887
shimv2: Add a "--version" cli option #2887
Conversation
Folded the overly long clean rule across multiple lines. Signed-off-by: James O. D. Hunt <[email protected]>
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.
thanks @jodh-intel - one nit
func shimConfig(config *shim.Config) { | ||
config.NoReaper = true | ||
config.NoSubreaper = true | ||
} | ||
|
||
func main() { | ||
shim.Run("io.containerd.kata.v2", containerdshim.New, shimConfig) | ||
if len(os.Args) == 2 && os.Args[1] == "--version" { |
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 wonder if this should be part of parseFlags()
in shim.go
, since --version
is not displayed in the usage message
./containerd-shim-kata-v2 --help
Usage of ./containerd-shim-kata-v2:
-address string
grpc address back to main containerd
-bundle string
path to the bundle if not workdir
-debug
enable debug output in logs
-id string
id of the task
-namespace string
namespace that owns the shim
-publish-binary string
path to publish binary (used for publishing events) (default "containerd")
-socket string
abstract socket path to serve
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.
Hi @devimc - that's a good question. However, you can't call flag.Parse()
twice: the first call wins meaning only --verbose
would be recognised and the shim wouldn't work. Also, this is a backport from 2.0 so I'd like to keep it as similar as possible.
All components should support a `--version` option to allow clear identification of the version of the component being used. Note that the build changes are required to allow the shim binary to access the golang code generated by the build (such as the `version` variable). Fixes: kata-containers#2886. Signed-off-by: James O. D. Hunt <[email protected]>
1e74fd3
to
9bb8e36
Compare
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.
thanks @jodh-intel
/test-ubuntu |
Codecov Report
@@ Coverage Diff @@
## master #2887 +/- ##
==========================================
- Coverage 51.41% 51.40% -0.01%
==========================================
Files 118 118
Lines 17434 17441 +7
==========================================
+ Hits 8963 8965 +2
- Misses 7388 7393 +5
Partials 1083 1083 |
All components should support a
--version
option to allow clear identification of the version of the component being used.Note that the build changes are required to allow the shim binary to access the golang code generated by the build (such as the
version
variable).This is a backport of kata-containers/kata-containers#308.
Fixes: #2886.
Signed-off-by: James O. D. Hunt [email protected]