pipelines zip and gdrive upload

updated
This commit is contained in:
dzaitsev
2025-05-07 20:03:51 +03:00
parent bfeb888c55
commit dd5521dc3b
+10 -9
View File
@@ -12,7 +12,7 @@ pipeline {
environment { environment {
GOOGLE_DRIVE_FOLDER = 'AzaionSuiteBuilds' GOOGLE_DRIVE_FOLDER = 'AzaionSuiteBuilds'
RCLONE_CONFIG = 'C:/Program Files/rclone/rclone.conf' RCLONE_CONFIG = 'C:/Program Files/rclone/rclone.conf'
LATEST_ZIP_FILENAME = '' // Will be set in Find Latest Zip LATEST_ZIP_FILENAME = '' // Initial value
} }
stages { stages {
@@ -45,14 +45,17 @@ pipeline {
''').trim() ''').trim()
echo "PowerShell output: ${output}" echo "PowerShell output: ${output}"
def m = (output =~ /::SET-ENV::LATEST_ZIP_FILENAME=(.+)/)
if (m && m[0][1]) { def match = (output =~ /::SET-ENV::LATEST_ZIP_FILENAME=(.+)/)
latestZip = m[0][1] if (match) {
latestZip = match[0][1]
echo "✅ Latest zip file selected: ${latestZip}" echo "✅ Latest zip file selected: ${latestZip}"
} else { } 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 env.LATEST_ZIP_FILENAME = latestZip
} }
} }
@@ -61,8 +64,7 @@ pipeline {
stage('Upload If Not Exists & Always Remove Local') { stage('Upload If Not Exists & Always Remove Local') {
when { when {
expression { expression {
echo "LATEST_ZIP_FILENAME is: '${env.LATEST_ZIP_FILENAME}'" return env.LATEST_ZIP_FILENAME != 'none'
return env.LATEST_ZIP_FILENAME?.trim()
} }
} }
steps { steps {
@@ -95,8 +97,7 @@ pipeline {
stage('Cleanup Older Files on Google Drive') { stage('Cleanup Older Files on Google Drive') {
when { when {
expression { expression {
echo "LATEST_ZIP_FILENAME is: '${env.LATEST_ZIP_FILENAME}'" return env.LATEST_ZIP_FILENAME != 'none'
return env.LATEST_ZIP_FILENAME?.trim()
} }
} }
steps { steps {