Commit 068cdaa5 authored by Thomas Riccardi's avatar Thomas Riccardi

Recognize newer docker versions without -ce/-ee suffix

Since docker 18.09, the ServerVersion field format changed: the `-ce` or `-ee` suffix disappeared: - docker 18.06: `18.06.1-ce` - docker 18.09: `18.09.0` This was not expected by the docker_validator version regexp, which assumed newer docker versions ended with `-[a-z]{2}`. This made the validator return an error, whereas we expect it to return only a warning (by recognizing it as a newer but not yet supported docker version). This commit relax the version regexp to also recognize `18.09.0`. The docker validator now returns a warning, as tested.
parent 9199025b
......@@ -73,7 +73,7 @@ func (d *DockerValidator) validateDockerInfo(spec *DockerSpec, info types.Info)
if !matched {
// If it's of the new Docker version scheme but didn't match above, it
// must be a newer version than the most recently validated one.
ver := `\d{2}\.\d+\.\d+-[a-z]{2}`
ver := `\d{2}\.\d+\.\d+(?:-[a-z]{2})?`
r := regexp.MustCompile(ver)
if r.MatchString(info.ServerVersion) {
d.Reporter.Report(dockerConfigPrefix+"VERSION", info.ServerVersion, good)
......
......@@ -81,6 +81,11 @@ func TestValidateDockerInfo(t *testing.T) {
err: false,
warn: false,
},
{
info: types.Info{Driver: "driver_2", ServerVersion: "18.09.0"},
err: false,
warn: true,
},
} {
warn, err := v.validateDockerInfo(spec, test.info)
if !test.err {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment