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

Add containerd, runc, and docker-init versions to /version #37974

Merged
merged 1 commit into from Jan 15, 2019

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Oct 5, 2018

This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.

With this patch applied, running:

curl --unix-socket /var/run/docker.sock http://localhost/version | jq .

Will produce this response:

{
  "Platform": {
    "Name": ""
  },
  "Components": [
    {
      "Name": "Engine",
      "Version": "dev",
      "Details": {
        "ApiVersion": "1.40",
        "Arch": "amd64",
        "BuildTime": "2018-11-08T10:23:42.000000000+00:00",
        "Experimental": "false",
        "GitCommit": "7d02782d2f",
        "GoVersion": "go1.11.2",
        "KernelVersion": "4.9.93-linuxkit-aufs",
        "MinAPIVersion": "1.12",
        "Os": "linux"
      }
    },
    {
      "Name": "containerd",
      "Version": "v1.1.4",
      "Details": {
        "GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
      }
    },
    {
      "Name": "runc",
      "Version": "1.0.0-rc5+dev",
      "Details": {
        "GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
      }
    },
    {
      "Name": "docker-init",
      "Version": "0.18.0",
      "Details": {
        "GitCommit": "fec3683"
      }
    }
  ],
  "Version": "dev",
  "ApiVersion": "1.40",
  "MinAPIVersion": "1.12",
  "GitCommit": "7d02782d2f",
  "GoVersion": "go1.11.2",
  "Os": "linux",
  "Arch": "amd64",
  "KernelVersion": "4.9.93-linuxkit-aufs",
  "BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}

When using a recent version of the CLI, that information is included in the
output of docker version:

Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:59 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          dev
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.11.4
  Git commit:       56f9283133
  Built:            Mon Jan 14 22:12:18 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.2
  GitCommit:        9754871865f7fe2f4e74d43e2fc7ccd237edcbce
 runc:
  Version:          1.0.0-rc6+dev
  GitCommit:        96ec2177ae841256168fcf76954f7177af9446eb
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

- How to verify it

make TESTDIRS='github.com/docker/docker/daemon' TESTFLAGS='-test.run ^TestParse' test-unit

- Description for the changelog

* Add containerd, runc, and docker-init versions to `/version` [moby/moby#37974](https://github.com/moby/moby/pull/37974)

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
Copy link
Member Author

Follow-up to #37968, but I'm still tweaking some things, and need to update the API changelog; just pushing as a WIP, so that we can discuss already

/cc @vdemeester @tiborvass

daemon/info_unix.go Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

ping^^ @thaJeztah

@thaJeztah thaJeztah force-pushed the add_more_component_versions branch 2 times, most recently from 556785b to c88553e Compare November 7, 2018 01:05
@thaJeztah thaJeztah changed the title [WIP] Add containerd, runc, and docker-init versions to /version Add containerd, runc, and docker-init versions to /version Nov 7, 2018
@thaJeztah
Copy link
Member Author

@AkihiroSuda updated

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

@thaJeztah
Copy link
Member Author

thaJeztah commented Nov 8, 2018

Ah, boo; linting error;

09:07:13 daemon/info_unix.go:218:49:warning: unnecessary conversion (unconvert)

@vdemeester @AkihiroSuda wondering; should I truncate the git-commit to a shorter value, or leave it as-is, and leave it to the packaging of containerd/runc to decide if they show a short or long commit-sha? (not sure what length is "safe" to truncate to);

Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:59 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          dev
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.11.4
  Git commit:       56f9283133
  Built:            Mon Jan 14 22:12:18 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.2
  GitCommit:        9754871865f7fe2f4e74d43e2fc7ccd237edcbce
 runc:
  Version:          1.0.0-rc6+dev
  GitCommit:        96ec2177ae841256168fcf76954f7177af9446eb
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683


defaultInitBinary := daemon.configStore.GetInitPath()
if rv, err := exec.Command(defaultInitBinary, "--version").Output(); err == nil {
if ver, err := parseInitVersion(string(rv)); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, let me update the parseInitVersion() (or write a different function for this), so that we can show the version as well, not just the commit;

./docker-init --version
tini version 0.18.0 - git.fec3683

@AkihiroSuda
Copy link
Member

I think it is safe to keep full comnit

@thaJeztah
Copy link
Member Author

OK, I'll leave the commits as-is, but working on the tini/docker-init version to show both version and commit (as it's a bit more user friendly to show that)

@codecov
Copy link

codecov bot commented Nov 8, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@beef00c). Click here to learn what that means.
The diff coverage is 27.53%.

@@            Coverage Diff            @@
##             master   #37974   +/-   ##
=========================================
  Coverage          ?    36.6%           
=========================================
  Files             ?      608           
  Lines             ?    45221           
  Branches          ?        0           
=========================================
  Hits              ?    16552           
  Misses            ?    26382           
  Partials          ?     2287

@thaJeztah
Copy link
Member Author

thaJeztah commented Nov 8, 2018

Updated; output now shows version and git commit for docker-init;

Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:59 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          dev
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.11.4
  Git commit:       56f9283133
  Built:            Mon Jan 14 22:12:18 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.2
  GitCommit:        9754871865f7fe2f4e74d43e2fc7ccd237edcbce
 runc:
  Version:          1.0.0-rc6+dev
  GitCommit:        96ec2177ae841256168fcf76954f7177af9446eb
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

}
}
if version.ID == "" && strings.HasPrefix(parts[0], "tini version ") {
version.ID = "v" + strings.TrimPrefix(parts[0], "tini version ")
Copy link
Member Author

Choose a reason for hiding this comment

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

I dropped the v prefix. Looking at this again, I don't think we should modify versions that are returned by an external binary, and just return it as-is

@kolyshkin
Copy link
Contributor

SGTM

@thaJeztah
Copy link
Member Author

rebased to get a fresh CI run

daemon/info_unix.go Outdated Show resolved Hide resolved
daemon/info_unix.go Outdated Show resolved Hide resolved
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.

With this patch applied, running:

```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```

Will produce this response:

```json
{
  "Platform": {
    "Name": ""
  },
  "Components": [
    {
      "Name": "Engine",
      "Version": "dev",
      "Details": {
        "ApiVersion": "1.40",
        "Arch": "amd64",
        "BuildTime": "2018-11-08T10:23:42.000000000+00:00",
        "Experimental": "false",
        "GitCommit": "7d02782d2f",
        "GoVersion": "go1.11.2",
        "KernelVersion": "4.9.93-linuxkit-aufs",
        "MinAPIVersion": "1.12",
        "Os": "linux"
      }
    },
    {
      "Name": "containerd",
      "Version": "v1.1.4",
      "Details": {
        "GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
      }
    },
    {
      "Name": "runc",
      "Version": "1.0.0-rc5+dev",
      "Details": {
        "GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
      }
    },
    {
      "Name": "docker-init",
      "Version": "0.18.0",
      "Details": {
        "GitCommit": "fec3683"
      }
    }
  ],
  "Version": "dev",
  "ApiVersion": "1.40",
  "MinAPIVersion": "1.12",
  "GitCommit": "7d02782d2f",
  "GoVersion": "go1.11.2",
  "Os": "linux",
  "Arch": "amd64",
  "KernelVersion": "4.9.93-linuxkit-aufs",
  "BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```

When using a recent version of the CLI, that information is included in the
output of `docker version`:

```
Client: Docker Engine - Community
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:46:51 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          dev
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.11.2
  Git commit:       7d02782d2f
  Built:            Thu Nov  8 10:23:42 2018
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.1.4
  GitCommit:        9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
 runc:
  Version:          1.0.0-rc5+dev
  GitCommit:        a00bf0190895aa465a5fbed0268888e2c8ddfe85
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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

8 participants