Thienvv - xóa file nén cũ trước khi nén file mới
This commit is contained in:
@@ -310,6 +310,13 @@ void publishProject(String buildPath, String publishFolderPath) {
|
|||||||
void compressItems(String compressedFilePath, String parentFolderPath) {
|
void compressItems(String compressedFilePath, String parentFolderPath) {
|
||||||
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
||||||
try {
|
try {
|
||||||
|
if (fileExists(compressedFilePath)) {
|
||||||
|
echo "Old ZIP file exists. Deleting: ${compressedFilePath}"
|
||||||
|
sh "rm -f ${compressedFilePath}"
|
||||||
|
} else {
|
||||||
|
echo 'No old ZIP file found.'
|
||||||
|
}
|
||||||
|
|
||||||
if (!fileExists(parentFolderPath)) {
|
if (!fileExists(parentFolderPath)) {
|
||||||
error "parentFolderPath is not exist : ${parentFolderPath}"
|
error "parentFolderPath is not exist : ${parentFolderPath}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
script {
|
script {
|
||||||
try {
|
try {
|
||||||
build job: "${TRIGGER_JOB_NAME}", parameters:[
|
build job: "${TRIGGER_JOB_NAME}", parameters:[
|
||||||
string(name: 'ENV', value: 'uat'),
|
string(name: 'ENV', value: 'uat'),
|
||||||
string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER)
|
string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER)
|
||||||
], propagate: false
|
], propagate: false
|
||||||
@@ -310,6 +310,13 @@ void publishProject(String buildPath, String publishFolderPath) {
|
|||||||
void compressItems(String compressedFilePath, String parentFolderPath) {
|
void compressItems(String compressedFilePath, String parentFolderPath) {
|
||||||
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
||||||
try {
|
try {
|
||||||
|
if (fileExists(compressedFilePath)) {
|
||||||
|
echo "Old ZIP file exists. Deleting: ${compressedFilePath}"
|
||||||
|
sh "rm -f ${compressedFilePath}"
|
||||||
|
} else {
|
||||||
|
echo 'No old ZIP file found.'
|
||||||
|
}
|
||||||
|
|
||||||
if (!fileExists(parentFolderPath)) {
|
if (!fileExists(parentFolderPath)) {
|
||||||
error "parentFolderPath is not exist : ${parentFolderPath}"
|
error "parentFolderPath is not exist : ${parentFolderPath}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,6 +196,13 @@ void buildProject(String buildFolderPath, String command) {
|
|||||||
void compressItems(String compressedFilePath, String parentFolderPath) {
|
void compressItems(String compressedFilePath, String parentFolderPath) {
|
||||||
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
||||||
try {
|
try {
|
||||||
|
if (fileExists(compressedFilePath)) {
|
||||||
|
echo "Old ZIP file exists. Deleting: ${compressedFilePath}"
|
||||||
|
sh "rm -f ${compressedFilePath}"
|
||||||
|
} else {
|
||||||
|
echo 'No old ZIP file found.'
|
||||||
|
}
|
||||||
|
|
||||||
if (!fileExists(parentFolderPath)) {
|
if (!fileExists(parentFolderPath)) {
|
||||||
error "parentFolderPath is not exist : ${parentFolderPath}"
|
error "parentFolderPath is not exist : ${parentFolderPath}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,6 +199,13 @@ void buildProject(String buildFolderPath, String command) {
|
|||||||
void compressItems(String compressedFilePath, String parentFolderPath) {
|
void compressItems(String compressedFilePath, String parentFolderPath) {
|
||||||
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
echo "Starting compression of the entire folder into a zip file : ${compressedFilePath}"
|
||||||
try {
|
try {
|
||||||
|
if (fileExists(compressedFilePath)) {
|
||||||
|
echo "Old ZIP file exists. Deleting: ${compressedFilePath}"
|
||||||
|
sh "rm -f ${compressedFilePath}"
|
||||||
|
} else {
|
||||||
|
echo 'No old ZIP file found.'
|
||||||
|
}
|
||||||
|
|
||||||
if (!fileExists(parentFolderPath)) {
|
if (!fileExists(parentFolderPath)) {
|
||||||
error "parentFolderPath is not exist : ${parentFolderPath}"
|
error "parentFolderPath is not exist : ${parentFolderPath}"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user