diff --git a/README.rst b/README.rst index 99cc404..5a7ceb2 100644 --- a/README.rst +++ b/README.rst @@ -24,6 +24,7 @@ the things you can use it for: * Put server in shutdown mode (quiet down) * List running builds * Delete builds +* Wipeout job workspace * Create/delete/update folders [#f1]_ * Set the next build number [#f2]_ * Install plugins diff --git a/jenkins/__init__.py b/jenkins/__init__.py index 5be7ba4..baa209a 100755 --- a/jenkins/__init__.py +++ b/jenkins/__init__.py @@ -116,6 +116,7 @@ BUILD_WITH_PARAMS_JOB = '%(folder_url)sjob/%(short_name)s/buildWithParameters' BUILD_INFO = '%(folder_url)sjob/%(short_name)s/%(number)d/api/json?depth=%(depth)s' BUILD_CONSOLE_OUTPUT = '%(folder_url)sjob/%(short_name)s/%(number)d/consoleText' DELETE_BUILD = '%(folder_url)sjob/%(short_name)s/%(number)s/doDelete' +WIPEOUT_JOB_WORKSPACE = '%(folder_url)sjob/%(short_name)s/doWipeOutWorkspace' NODE_LIST = 'computer/api/json' CREATE_NODE = 'computer/doCreateItem' DELETE_NODE = 'computer/%(name)s/doDelete' @@ -1239,6 +1240,16 @@ class Jenkins(object): self.jenkins_open(requests.Request('POST', self._build_url(DELETE_BUILD, locals()), b'')) + def wipeout_job_workspace(self, name): + """Wipe out workspace for given Jenkins job. + + :param name: Name of Jenkins job, ``str`` + """ + folder_url, short_name = self._get_job_folder(name) + self.jenkins_open(requests.Request('POST', + self._build_url(WIPEOUT_JOB_WORKSPACE, + locals()), b'')) + def get_running_builds(self): '''Return list of running builds.