-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Clean-up tmp files on Windows agent after CI run
* add build job that cleans up temp directory and local app data Contributed on behalf of STMicroelectronics Signed-off-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
- Loading branch information
1 parent
45be324
commit 073a632
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import groovy.json.JsonSlurper | ||
|
||
pipeline { | ||
agent none | ||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
disableConcurrentBuilds() | ||
} | ||
stages { | ||
stage('Cleanup') { | ||
parallel { | ||
stage('Cleanup Windows temp directory') { | ||
agent { | ||
label 'windows' | ||
} | ||
steps { | ||
script { | ||
cleanDirs('tmp/yarn', '\"%temp%\"', '(yarn--*)') | ||
cleanDirs('tmp/plugin-download', '\"%temp%\"', '(theia-plugin-download*)') | ||
cleanDirs('tmp/lighthouse', '\"%temp%\"', '(lighthouse.*)') | ||
cleanDir('appdata/local/electron', '\"%LocalAppData%\"\\electron\\Cache') | ||
cleanYarnCache('appdata/local/yarn', '\"%LocalAppData%\"\\Yarn\\Cache') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def cleanDirs(String label, String parent, String pattern) { | ||
bat "echo \"Before ${label} Cleanup:\"" | ||
|
||
bat "FOR /D /R ${parent} %%i in ${pattern} do echo \"%%i\"" | ||
bat "FOR /D /R ${parent} %%i in ${pattern} do @rmdir /s /q \"%%i\"" | ||
|
||
bat "echo \"After ${label} Cleanup:\"" | ||
|
||
bat "FOR /D /R ${parent} %%i in ${pattern} do echo \"%%i\"" | ||
} | ||
|
||
def cleanDir(String label, String parent) { | ||
bat "echo \"Before ${label} Cleanup:\"" | ||
|
||
bat "FOR /D /R ${parent} %%i in (*) do echo \"%%i\"" | ||
bat "if exist ${parent} @rmdir /s /q ${parent}" | ||
|
||
bat "echo \"After ${label} Cleanup:\"" | ||
|
||
bat "FOR /D /R ${parent} %%i in (*) do echo \"%%i\"" | ||
} | ||
|
||
def cleanYarnCache(String label, String parent) { | ||
bat "echo \"Before ${label} Cleanup:\"" | ||
|
||
bat "FOR /D /R ${parent} %%i in (*) do echo \"%%i\"" | ||
sh "yarn cache clean --all" | ||
|
||
bat "echo \"After ${label} Cleanup:\"" | ||
|
||
bat "FOR /D /R ${parent} %%i in (*) do echo \"%%i\"" | ||
} | ||
|