Merge pull request #774 from jmorganca/mxyng/server-version

add version api and show server version in cli
This commit is contained in:
Michael Yang
2023-12-06 13:22:55 -08:00
committed by GitHub
3 changed files with 71 additions and 30 deletions

View File

@@ -324,3 +324,15 @@ func (c *Client) CreateBlob(ctx context.Context, digest string, r io.Reader) err
return nil
}
func (c *Client) Version(ctx context.Context) (string, error) {
var version struct {
Version string `json:"version"`
}
if err := c.do(ctx, http.MethodGet, "/api/version", nil, &version); err != nil {
return "", err
}
return version.Version, nil
}