From d1520109efbec0e51283e5d30ef9464e22160f67 Mon Sep 17 00:00:00 2001 From: dzaitsev Date: Wed, 7 May 2025 19:36:40 +0300 Subject: [PATCH] pipelines zip and gdrive upload updated --- build/jenkins/GDriveUpload | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/build/jenkins/GDriveUpload b/build/jenkins/GDriveUpload index b4ea2aa..a88eca7 100644 --- a/build/jenkins/GDriveUpload +++ b/build/jenkins/GDriveUpload @@ -15,7 +15,6 @@ pipeline { stage('Declarative: Tool Install') { steps { - // Ensure required tools are available, like Git, PowerShell, etc. echo "Installing tools if necessary" } } @@ -23,7 +22,6 @@ pipeline { stage('Initialize Workspace') { steps { echo "Initializing workspace on Windows agent..." - // Initialization steps for workspace } } @@ -32,19 +30,22 @@ pipeline { script { echo "Finding latest zip file in: C:/Jenkins/workspace/Azaion/suite" dir('C:/Jenkins/workspace/Azaion/suite') { - // Debug output to confirm current directory contents - echo "Listing .zip files in the directory:" - bat(script: 'dir /b *.zip', returnStdout: true).trim() + // List all .zip files starting with "AzaionSuite" + def zipFiles = bat(script: 'dir /b AzaionSuite*.zip', returnStdout: true).trim().split("\n") - // Get the most recent .zip file based on modification date - def latestZip = bat(script: 'dir /b /od *.zip | head -n 1', returnStdout: true).trim() - - if (latestZip) { - env.LATEST_ZIP_FILENAME = latestZip - echo "✅ Latest zip file selected: ${env.LATEST_ZIP_FILENAME}" - } else { - error "No valid zip files found in the directory!" + if (zipFiles.isEmpty()) { + error "No zip files found matching the pattern 'AzaionSuite*.zip'!" } + + // Sort the files by date (timestamp) in the filename + def latestZip = zipFiles.sort { a, b -> + def dateA = a.split('-')[1] + def dateB = b.split('-')[1] + return dateB.compareTo(dateA) + }.first() + + env.LATEST_ZIP_FILENAME = latestZip + echo "✅ Latest zip file selected: ${env.LATEST_ZIP_FILENAME}" } } }