mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 10:21:00 +00:00
75513575be
* store dependency's in git * since we vendor ... rm tech-depts * aad make target 'vendor' to update vendor folder (manual task)
32 lines
855 B
Go
32 lines
855 B
Go
package docker // import "docker.io/go-docker"
|
|
|
|
import (
|
|
"path"
|
|
|
|
"docker.io/go-docker/api/types"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
// Ping pings the server and returns the value of the "Docker-Experimental", "OS-Type" & "API-Version" headers
|
|
func (cli *Client) Ping(ctx context.Context) (types.Ping, error) {
|
|
var ping types.Ping
|
|
req, err := cli.buildRequest("GET", path.Join(cli.basePath, "/_ping"), nil, nil)
|
|
if err != nil {
|
|
return ping, err
|
|
}
|
|
serverResp, err := cli.doRequest(ctx, req)
|
|
if err != nil {
|
|
return ping, err
|
|
}
|
|
defer ensureReaderClosed(serverResp)
|
|
|
|
if serverResp.header != nil {
|
|
ping.APIVersion = serverResp.header.Get("API-Version")
|
|
|
|
if serverResp.header.Get("Docker-Experimental") == "true" {
|
|
ping.Experimental = true
|
|
}
|
|
ping.OSType = serverResp.header.Get("OSType")
|
|
}
|
|
return ping, cli.checkResponseErr(serverResp)
|
|
}
|