1
0
Fork 0
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:
Carlos de Paula 2019-09-16 21:13:01 -03:00
parent 92cc603036
commit 4ab1e808d1
2 changed files with 11 additions and 2 deletions

View file

@ -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:") {

View file

@ -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,