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){
|
if (files == null){
|
||||||
println ("Nothing to do");
|
println ("Nothing to do");
|
||||||
}else{
|
}else{
|
||||||
|
def toRemove = [] as ArrayList
|
||||||
for (def file : files){
|
for (def file : files){
|
||||||
echo """
|
echo """
|
||||||
Found: ${file.name} with path ${file.path}
|
Found: ${file.name} with path ${file.path}
|
||||||
|
@ -127,10 +128,10 @@ pipeline {
|
||||||
deploy(record.get(0), record.get(1), record.get(2));
|
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
|
//clean and update the local deploy file
|
||||||
def clean(def file){
|
def clean(def files){
|
||||||
sh '''
|
sh '''
|
||||||
echo "cleaning $file";
|
echo "parsing $files";
|
||||||
if [ -f $file ]; then
|
for file in `ls $dirPath`; do
|
||||||
rm $file;
|
echo "cleaning $file";
|
||||||
else
|
if [ -f $file ]; then
|
||||||
echo "file not exist"
|
rm $file;
|
||||||
fi
|
else
|
||||||
|
echo "file not exist"
|
||||||
|
fi
|
||||||
|
done
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue