From fb76a37765ab57d1b0d6d32e6cda3a20499da376 Mon Sep 17 00:00:00 2001 From: fellrock Date: Sat, 9 Mar 2024 16:36:54 -0300 Subject: [PATCH 1/2] Update JenkinsFile --- jenkins/jenkinsfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/jenkins/jenkinsfile b/jenkins/jenkinsfile index 4389a20..c94c3fc 100644 --- a/jenkins/jenkinsfile +++ b/jenkins/jenkinsfile @@ -27,14 +27,18 @@ pipeline { stage('Copy to Nginx Server') { steps { script { - def curlOutput = sh(script: 'curl -T . http://172.17.0.5:80/mnt/user/appdata/nginx/www', returnStdout: true, returnStatus: true).trim() - def curlExitCode = sh(script: 'echo $?', returnStatus: true).trim() + try { + def curlOutput = sh(script: 'curl -T . http://172.17.0.5:80/mnt/user/appdata/nginx/www', returnStdout: true, returnStatus: true).trim() + def curlExitCode = sh(script: 'echo $?', returnStatus: true).trim() - echo "curl result: ${curlExitCode}" - echo "curl output: ${curlOutput}" + echo "curl result: ${curlExitCode}" + echo "curl output: ${curlOutput}" - if (curlExitCode != '0') { - error "Failed to copy files to Nginx server. Check logs for details." + if (curlExitCode != '0') { + error "Failed to copy files to Nginx server. Check logs for details." + } + } catch (Exception e) { + error "An error occurred while running the 'curl' command. Error: ${e.message}" } } } From 77edce24e17a43e2cd58eb3f6ddca85eceb79c40 Mon Sep 17 00:00:00 2001 From: fellrock Date: Sat, 9 Mar 2024 16:39:11 -0300 Subject: [PATCH 2/2] Update JenkinsFile --- jenkins/jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jenkins/jenkinsfile b/jenkins/jenkinsfile index c94c3fc..5b00fd3 100644 --- a/jenkins/jenkinsfile +++ b/jenkins/jenkinsfile @@ -28,7 +28,10 @@ pipeline { steps { script { try { - def curlOutput = sh(script: 'curl -T . http://172.17.0.5:80/mnt/user/appdata/nginx/www', returnStdout: true, returnStatus: true).trim() + def curlCommand = 'curl -T . http://172.17.0.5:80/mnt/user/appdata/nginx/www' + echo "Running command: ${curlCommand}" + + def curlOutput = sh(script: curlCommand, returnStdout: true, returnStatus: true).trim() def curlExitCode = sh(script: 'echo $?', returnStatus: true).trim() echo "curl result: ${curlExitCode}"