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/a51f8bc3-d319-4ca6-b04e-2fea74d542b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to