From dd5521dc3bbd8902cef613bc6ea5d7ada918e7a5 Mon Sep 17 00:00:00 2001 From: dzaitsev Date: Wed, 7 May 2025 20:03:51 +0300 Subject: [PATCH] pipelines zip and gdrive upload updated --- build/jenkins/GDriveUpload | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/build/jenkins/GDriveUpload b/build/jenkins/GDriveUpload index c726cb7..d08c663 100644 --- a/build/jenkins/GDriveUpload +++ b/build/jenkins/GDriveUpload @@ -12,7 +12,7 @@ pipeline { environment { GOOGLE_DRIVE_FOLDER = 'AzaionSuiteBuilds' RCLONE_CONFIG = 'C:/Program Files/rclone/rclone.conf' - LATEST_ZIP_FILENAME = '' // Will be set in Find Latest Zip + LATEST_ZIP_FILENAME = '' // Initial value } stages { @@ -45,14 +45,17 @@ pipeline { ''').trim() echo "PowerShell output: ${output}" - def m = (output =~ /::SET-ENV::LATEST_ZIP_FILENAME=(.+)/) - if (m && m[0][1]) { - latestZip = m[0][1] + + def match = (output =~ /::SET-ENV::LATEST_ZIP_FILENAME=(.+)/) + if (match) { + latestZip = match[0][1] echo "✅ Latest zip file selected: ${latestZip}" } else { - echo "⚠️ No zip found, skipping downstream stages." + echo "⚠️ No zip found." + latestZip = 'none' // Handle case where no file is found } } + // Directly assign the value to the env variable for use in other stages env.LATEST_ZIP_FILENAME = latestZip } } @@ -61,8 +64,7 @@ pipeline { stage('Upload If Not Exists & Always Remove Local') { when { expression { - echo "LATEST_ZIP_FILENAME is: '${env.LATEST_ZIP_FILENAME}'" - return env.LATEST_ZIP_FILENAME?.trim() + return env.LATEST_ZIP_FILENAME != 'none' } } steps { @@ -95,8 +97,7 @@ pipeline { stage('Cleanup Older Files on Google Drive') { when { expression { - echo "LATEST_ZIP_FILENAME is: '${env.LATEST_ZIP_FILENAME}'" - return env.LATEST_ZIP_FILENAME?.trim() + return env.LATEST_ZIP_FILENAME != 'none' } } steps {