-
Bug
-
Resolution: Fixed
-
Major
-
None
When I create a prebuild cleanup using
preBuildCleanup {
deleteCommand('sudo rm -rf %s')
}
I get the following XML block
<hudson.plugins.ws__cleanup.PreBuildCleanup>
<patterns></patterns>
<deleteDirs>false</deleteDirs>
<cleanupParameter></cleanupParameter>
<deleteCommand>sudo rm -rf %s</deleteCommand>
</hudson.plugins.ws__cleanup.PreBuildCleanup>
However, the deleteCommand tag is wrong. It should be externalDelete. This is what I get when I configure the job directly:
<hudson.plugins.ws__cleanup.PreBuildCleanup>
<deleteDirs>false</deleteDirs>
<cleanupParameter></cleanupParameter>
<externalDelete>sudo rm -rf %s</externalDelete>
</hudson.plugins.ws__cleanup.PreBuildCleanup>
This causes the plugin to not use the command specified. The postbuild cleanup gets the delete command tag right, but has several other differences:
<hudson.plugins.ws__cleanup.WsCleanup>
<patterns/>
<deleteDirs>false</deleteDirs>
<cleanWhenSuccess>true</cleanWhenSuccess>
<cleanWhenUnstable>true</cleanWhenUnstable>
<cleanWhenFailure>true</cleanWhenFailure>
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
<cleanWhenAborted>true</cleanWhenAborted>
<notFailBuild>false</notFailBuild>
<externalDelete>sudo rm -rf %s</externalDelete>
</hudson.plugins.ws__cleanup.WsCleanup>
from the DSL, versus this block when generated directly:
<hudson.plugins.ws__cleanup.WsCleanup>
<deleteDirs>false</deleteDirs>
<skipWhenFailed>false</skipWhenFailed>
<cleanWhenSuccess>true</cleanWhenSuccess>
<cleanWhenUnstable>true</cleanWhenUnstable>
<cleanWhenFailure>true</cleanWhenFailure>
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
<cleanWhenAborted>true</cleanWhenAborted>
<notFailBuild>false</notFailBuild>
<cleanupMatrixParent>false</cleanupMatrixParent>
<externalDelete>sudo rm -rf %s</externalDelete>
</hudson.plugins.ws__cleanup.WsCleanup>
Additionally, the documentation for "Workspace Cleanup Publisher" specifies that the Groovy command to use is "externalDeleteCommand(String)", but it is actually just "deleteCommand(String)".