So what I have done so far is  
 
cleanup=bParent.build.properties.environment('GIT_TREE')
  println "find ${cleanup} -maxdepth 1 -not -name images -type f -exec rm 
-f {} +".execute().text
 
However, the 
  println "find ${cleanup} -maxdepth 1 -not -name images -type f -exec rm 
-f {} +".execute().text 
does not execute within the build flow plugin that we are using.
 
I have done just a 
  println "find ${cleanup} -maxdepth 1 -not -name images -type f -exec rm 
-f {} +"  - and this line is correct, and I can run this manually and it 
works
 
 
Does anyone have suggestions on how to make this work using the build flow 
plugin?
 

On Tuesday, February 24, 2015 at 9:43:34 AM UTC-5, Katie Outram wrote:

> After the build completes, I need to clean up the workspace that was 
> created during execution of the build.   The workspace is defined in our 
> scripts that get executed during the build.
>  
> what this comes down to is I want to remove the contents of the directory (
> bParent.build.properties.environment('GIT_TREE')) except a specific child 
> folder in that directory.
>  
> From bash I can do this by executing
>  
>   
>
> find <bParent.build.properties.environment('GIT_TREE')> -mindepth 1 -type 
> d ! -iname images -exec rm -rf {} \;
>
> where <bParent.build.properties.environment('GIT_TREE')> is translated to 
> my working path.
>
> However when I have tried to even print my command at the end of my build 
> execution I end up with an error.
>
> What I have tried (along with some variations) at this point is:
>
> shell(find ${bParent.build.properties.environment['GIT_TREE']} -mindepth 1 
> -type d ! -iname images )  - this fails with 
>
> Script1.groovy: 44: unexpected token: $ @ line 44, column 15.
>      shell( find ${bParent.build.properties.environment['GIT_TREE']} 
> -mindepth 1 -type d ! -iname images
>
>  
>  println (find bParent.build.properties.environment['GIT_TREE'] -mindepth 
> 1 -type d ! -iname images).execute - this fails with 
>
> Script1.groovy: 42: unexpected token: bParent @ line 42, column 15.
>    println (find bParent.build.properties.environment['GIT_TREE'] 
> -mindepth 1 -type d ! -iname images)
>
>  
> a basic 
>   println bParent.build.properties.environment['GIT_TREE']  gives me the 
> directory I want to clean up
>  
>  
> I don't want to put this in a separate shell script and build job to keep 
> our build graph clean and to not confuse our developers.    I want this to 
> execute at the end of the current process.  Does anyone have any 
> suggestions on how to handle this situation?  
>   
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1a82fe1a-cf60-448a-b676-12767d50cda5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to