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
commit c3ff36088b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
}