Ø  Either try to use the workspace cleanup plugin and/or some groovy step to do 
that and retrieve that variable?

We use git, so ymmv.  Rather than cleaning up at the end of a build, I just 
leave it all there and check the “Wipe out repository & force clone” selection 
in the “Additional Behaviours” section of “Source Code Management”.  That will 
checkout a whole new workspace every time the build starts, which I believe 
will have the same effect as what you are attempting.

From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Baptiste Mathus
Sent: February-25-15 01:04
To: jenkinsci-users@googlegroups.com
Subject: Re: Clean up after build using build flow plugin


Either try to use the workspace cleanup plugin and/or some groovy step to do 
that and retrieve that variable?
My 2 cents
Le 24 févr. 2015 15:43, "Katie Outram" 
<katie.out...@gmail.com<mailto:katie.out...@gmail.com>> a écrit :
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<mailto: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<https://groups.google.com/d/msgid/jenkinsci-users/a51f8bc3-d319-4ca6-b04e-2fea74d542b5%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS6QZyvKqxk2cGrJYJ%2B05k68P4g7Dqcqg4zyR_XAnwO02A%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS6QZyvKqxk2cGrJYJ%2B05k68P4g7Dqcqg4zyR_XAnwO02A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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/8b77b64c886a43509f910ea69eecb26a%40mbx01colo01p.esentire.local.
For more options, visit https://groups.google.com/d/optout.

Reply via email to