mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Change version parsing to support alternate runtimes
Signed-off-by: Carlos de Paula <me@carlosedp.com>
This commit is contained in:
parent
92cc603036
commit
4ab1e808d1
2 changed files with 11 additions and 2 deletions
|
@ -233,8 +233,9 @@ func parseInitVersion(v string) (version string, commit string, err error) {
|
|||
func parseRuncVersion(v string) (version string, commit string, err error) {
|
||||
lines := strings.Split(strings.TrimSpace(v), "\n")
|
||||
for _, line := range lines {
|
||||
if strings.HasPrefix(line, "runc version") {
|
||||
version = strings.TrimSpace(strings.TrimPrefix(line, "runc version"))
|
||||
if strings.Contains(line, "version") {
|
||||
s := strings.Split(line, "version")
|
||||
version = strings.TrimSpace(s[len(s)-1])
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(line, "commit:") {
|
||||
|
|
|
@ -80,6 +80,14 @@ spec: 1.0.0
|
|||
`,
|
||||
commit: "69663f0bd4b60df09991c08812a60108003fa340",
|
||||
},
|
||||
{
|
||||
output: `
|
||||
crun version 0.7
|
||||
spec: 1.0.0
|
||||
+SYSTEMD +SELINUX +CAP +SECCOMP +EBPF +YAJL
|
||||
`,
|
||||
version: "0.7",
|
||||
},
|
||||
{
|
||||
output: "",
|
||||
invalid: true,
|
||||
|
|
Loading…
Reference in a new issue