mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-25 01:40:30 +00:00
75513575be
* store dependency's in git * since we vendor ... rm tech-depts * aad make target 'vendor' to update vendor folder (manual task)
30 lines
749 B
Go
30 lines
749 B
Go
package docker // import "docker.io/go-docker"
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"docker.io/go-docker/api/types"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
// BuildCachePrune requests the daemon to delete unused cache data
|
|
func (cli *Client) BuildCachePrune(ctx context.Context) (*types.BuildCachePruneReport, error) {
|
|
if err := cli.NewVersionError("1.31", "build prune"); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
report := types.BuildCachePruneReport{}
|
|
|
|
serverResp, err := cli.post(ctx, "/build/prune", nil, nil, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer ensureReaderClosed(serverResp)
|
|
|
|
if err := json.NewDecoder(serverResp.body).Decode(&report); err != nil {
|
|
return nil, fmt.Errorf("Error retrieving disk usage: %v", err)
|
|
}
|
|
|
|
return &report, nil
|
|
}
|