Jenkins: delete the workspace on a subordinate

I have work with the configuration matrix to complete the assembly on 2 computers (master and slave). I have the option "Delete the workspace before assembling" in this task.

Unfortunately, the workspace is deleted only on the "master" node, that is, the node where the main task is performed (the task that runs all the task needed to cover the configuration matrix).

The workspace on the second node is not deleted.

I think this is a Jenkins error: because the job has a configuration matrix, there is a main job to start another job. Therefore, the option "Delete workspace before assembling" is used only for this main task. I think this parameter should be applied to all matrix configuration tasks.

Does anyone know if I am wrong?

+6
source share
2 answers

After the investigation, it turned out that slave workspaces are not deleted using the "Delete workspace before assembly" method, the workspace can only be deleted on the main one using the method (added https://wiki.jenkins-ci.org/display / JENKINS / Workspace + Cleanup + Plugin ).

The best option in this case is to use a script: https://gist.github.com/rb2k/8372402

A good resource for more information on removing the Jenkins workspace is: https://julienprog.wordpress.com/2016/04/14/clean-up-jenkins-workspaces/

+8
source

At least with version 0.36 of the http://wiki.jenkins-ci.org/display/JENKINS/Workspace+Cleanup+Plugin plugin, it actually destroys the workspace on the slave (and does not apply to the workspace on the workstation). master). Which version are you using?

I had to add this via the answer as I do not have a representative to add a comment to the approved answer.

0
source

Source: https://habr.com/ru/post/1266458/


All Articles