From f7f4eaaafb3fa2677e0eb9911f974b6ad93473d0 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sun, 31 Dec 2023 21:48:22 +0800 Subject: [PATCH] Laravel Vapor - Test run command to do housekeeping as part of deployment process --- Jenkinsfile | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 330f47ee..7353b5df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,29 +77,14 @@ pipeline { } } - stage('Check Cleanup Status') { - steps { - script { - def isCleanupRunning = sh(script: 'pgrep -f "docker image prune"', returnStatus: true) == 0 - currentBuild.description = isCleanupRunning ? 'Cleanup is already running' : 'Ready for cleanup' - - if (isCleanupRunning) { - currentBuild.result = 'ABORTED' - error('Cleanup is already running. Aborting this build.') - } - } - } - } - stage('Cleanup') { - when { - expression { - return currentBuild.result != 'ABORTED' - } - } steps { script { - sh 'docker image prune -a -f' + try { + sh 'docker image prune -a -f' + } catch (Exception e) { + echo "Error during cleanup: ${e.message}" + } } } }