generated from gCubeCI/Pipeline-Docker-Template
put remove actions outside the loop
This commit is contained in:
parent
360a7cf5be
commit
350b9ccb8c
|
@ -112,6 +112,7 @@ pipeline {
|
|||
if (files == null){
|
||||
println ("Nothing to do");
|
||||
}else{
|
||||
def toRemove = [] as ArrayList
|
||||
for (def file : files){
|
||||
echo """
|
||||
Found: ${file.name} with path ${file.path}
|
||||
|
@ -127,10 +128,10 @@ pipeline {
|
|||
deploy(record.get(0), record.get(1), record.get(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
clean("${file.path}");
|
||||
}
|
||||
toRemove.add("${file.path}")
|
||||
}
|
||||
|
||||
clean(toRemove)
|
||||
|
||||
}
|
||||
|
||||
|
@ -309,14 +310,17 @@ def cleanup(def DEPLOY_FILE, def BACKUP_FILE){
|
|||
}
|
||||
|
||||
//clean and update the local deploy file
|
||||
def clean(def file){
|
||||
def clean(def files){
|
||||
sh '''
|
||||
echo "cleaning $file";
|
||||
if [ -f $file ]; then
|
||||
rm $file;
|
||||
else
|
||||
echo "file not exist"
|
||||
fi
|
||||
echo "parsing $files";
|
||||
for file in `ls $dirPath`; do
|
||||
echo "cleaning $file";
|
||||
if [ -f $file ]; then
|
||||
rm $file;
|
||||
else
|
||||
echo "file not exist"
|
||||
fi
|
||||
done
|
||||
'''
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue