Actually I had to make small tweak in the method name as below,

def hi = hudson.model.Hudson.instance
           hi.getItemByFullName("JobName").*doDoWipeOutWorkspace()*

On Monday, September 3, 2012 11:02:53 AM UTC+1, BK wrote:
>
> Thanks Vincent that worked!!
>
> On Friday, August 31, 2012 3:24:29 PM UTC+1, Vincent Latombe wrote:
>>
>> You should call 
>> def hi = hudson.model.Hudson.instance
>>            hi.getItemByFullName("JobName").doWipeOutWorkspace()
>> it will perform the same action as clicking on the link in the UI.
>>
>> Vincent
>>
>>
>> 2012/8/31 cjo <[email protected]>
>>
>>> If you want the SCM to remove the clearcase view
>>> you will need to have the SCM process the workspace before deletion, you 
>>> will need to get the SCM and call processWorkspaceBeforeDeletion() on 
>>> it [1]
>>>
>>> so from the project object call getScm() [2], then call that with 
>>> processWorkspaceBeforeDeletion()
>>> which should remove the view for that workspace.
>>>
>>>
>>> [1] http://javadoc.jenkins-ci.org/hudson/scm/SCM.html
>>> [2] 
>>> http://javadoc.jenkins-ci.org/hudson/model/AbstractProject.html#getScm()
>>>
>>>
>>>
>>>
>>> On Friday, August 31, 2012 10:50:18 AM UTC+1, BK wrote:
>>>>
>>>>
>>>> I have tested simple groovy script  as below,
>>>>
>>>>  def hi = hudson.model.Hudson.instance
>>>>            hi.getItemByFullName("JobName"**).getWorkspace().**
>>>> deleteRecursive()
>>>>
>>>> But their is difference in behavior of   WipeOut workspace option on 
>>>> Jenkins and above script.
>>>>
>>>> My groovy script removes all the files from workspace but not reference 
>>>> to Clearcase View. (P.S Clear case view is at different location)
>>>> whereas Jenkins Wipe out workspace removes all the references to 
>>>> workspace. It removes clearcase view present under different location.
>>>>
>>>> On Thursday, August 30, 2012 8:04:05 PM UTC+1, BK wrote:
>>>>>
>>>>> Thanks Vjuranek.
>>>>> Yes, we use Workspace cleanup plugin but I was looking for some 
>>>>> scripted way to wipe out workspace for number for jobs in one go.
>>>>> I will give a try to build.getWorkspace().**deleteRecursive() .
>>>>>
>>>>>
>>>>> On Thursday, August 30, 2012 7:42:11 PM UTC+1, vjuranek wrote:
>>>>>>
>>>>>> Hi, 
>>>>>> what about Workspace cleanup plugin [1] or Distributed workspace 
>>>>>> clean plugin [2]? 
>>>>>> If you are searching for a function how to delete workspace, it's 
>>>>>> build.getWorkspace().**deleteRecursive() 
>>>>>>
>>>>>> HTH 
>>>>>> Vojta 
>>>>>>
>>>>>> [1] https://wiki.jenkins-ci.org/**display/JENKINS/Workspace+**
>>>>>> Cleanup+Plugin<https://wiki.jenkins-ci.org/display/JENKINS/Workspace+Cleanup+Plugin>
>>>>>>  
>>>>>> [2] https://wiki.jenkins-ci.org/**display/JENKINS/Hudson+**
>>>>>> Distributed+Workspace+Clean+**plugin<https://wiki.jenkins-ci.org/display/JENKINS/Hudson+Distributed+Workspace+Clean+plugin>
>>>>>>  
>>>>>>
>>>>>> ----- Original Message ----- 
>>>>>> From: "BK" <[email protected]> 
>>>>>> To: [email protected] 
>>>>>> Sent: Thursday, August 30, 2012 5:52:46 PM 
>>>>>> Subject: CLI option /Groovy script to wipe out work space 
>>>>>>
>>>>>> Hi, 
>>>>>>
>>>>>>
>>>>>> We have single Jenkins Master hosting number of Jobs.It is very 
>>>>>> laborious to use Jenkins console to wipe out workspace from Jobs. I am 
>>>>>> looking for automated way to wipe out workspace. 
>>>>>> I have explored Jenkins CLI but it does not contain any command for 
>>>>>> deletion of workspace.I was trying to put together a groovy script to 
>>>>>> delete the workspace but could not find appropriate functions in Jenkins 
>>>>>> API . has anyone faced similar issue ? Please help !! 
>>>>>>
>>>>>>
>>>>>> Thanks in Advance 
>>>>>> BK. 
>>>>>>
>>>>>
>>

Reply via email to