Directory structure:
${WORKSPACE}/some_folders/folder_to_clean
I have tried:
cleanWs deleteDirs: true, notFailBuild: true,
patterns: [
[pattern: '*.png', type: 'INCLUDE'],
[pattern: '*.log', type: 'INCLUDE'],
[pattern: '*.lock', type: 'INCLUDE'],
[pattern: 'Result_*.tsv', type: 'INCLUDE'],
[pattern: 'report.html', type: 'INCLUDE']
]
but it does not work, no files are deleted. Then I tried to clean with specific directory in pattern:
cleanWs deleteDirs: true, notFailBuild: true,
patterns: [
[pattern: '${WORKSPACE}/some_folders/folder_to_clean/*.png', type: 'INCLUDE'],
[pattern: '${WORKSPACE}/some_folders/folder_to_clean/*.log', type: 'INCLUDE'],
[pattern: '${WORKSPACE}/some_folders/folder_to_clean/*.lock', type: 'INCLUDE'],
[pattern: '${WORKSPACE}/some_folders/folder_to_clean/Result_*.tsv', type: 'INCLUDE'],
[pattern: '${WORKSPACE}/some_folders/folder_to_clean/report.html', type: 'INCLUDE']
]
but it also doesn't work. Is there any way to do it with cleanWs()
or should I try different approach? (I know, that cleanWs()
should be used to clean the cuurent workspace and it is good practice to do so, but in this case it needs to stay on the node)
Per Workspace Cleanup plugin documentation, use ant Directory scanner patterns. Also see ant PatternSet manual page for examples.
That means you need to match the directory part as well, using "**", ie: **/*.ext
.
You could also remove an entire directory, as opposed to the contents only.