Kaydet (Commit) c6c45d9c authored tarafından Joffrey F's avatar Joffrey F

Merge branch 'The-Loeki-build_prune'

......@@ -264,6 +264,23 @@ class BuildApiMixin(object):
return self._stream_helper(response, decode=decode)
@utils.minimum_version('1.31')
def prune_builds(self):
"""
Delete the builder cache
Returns:
(dict): A dictionary containing information about the operation's
result. The ``SpaceReclaimed`` key indicates the amount of
bytes of disk space reclaimed.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
url = self._url("/build/prune")
return self._result(self._post(url), True)
def _set_auth_headers(self, headers):
log.debug('Looking for auth config')
......
......@@ -503,3 +503,9 @@ class BuildTest(BaseAPIIntegrationTest):
assert sorted(
[b'.', b'..', b'file.txt', b'custom.dockerfile']
) == sorted(lsdata)
@requires_api_version('1.31')
def test_prune_builds(self):
prune_result = self.client.prune_builds()
assert 'SpaceReclaimed' in prune_result
assert isinstance(prune_result['SpaceReclaimed'], int)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment