pipelines zip and gdrive upload

updated
This commit is contained in:
dzaitsev
2025-05-07 19:36:40 +03:00
parent 81620888f2
commit d1520109ef
+12 -11
View File
@@ -15,7 +15,6 @@ pipeline {
stage('Declarative: Tool Install') { stage('Declarative: Tool Install') {
steps { steps {
// Ensure required tools are available, like Git, PowerShell, etc.
echo "Installing tools if necessary" echo "Installing tools if necessary"
} }
} }
@@ -23,7 +22,6 @@ pipeline {
stage('Initialize Workspace') { stage('Initialize Workspace') {
steps { steps {
echo "Initializing workspace on Windows agent..." echo "Initializing workspace on Windows agent..."
// Initialization steps for workspace
} }
} }
@@ -32,19 +30,22 @@ pipeline {
script { script {
echo "Finding latest zip file in: C:/Jenkins/workspace/Azaion/suite" echo "Finding latest zip file in: C:/Jenkins/workspace/Azaion/suite"
dir('C:/Jenkins/workspace/Azaion/suite') { dir('C:/Jenkins/workspace/Azaion/suite') {
// Debug output to confirm current directory contents // List all .zip files starting with "AzaionSuite"
echo "Listing .zip files in the directory:" def zipFiles = bat(script: 'dir /b AzaionSuite*.zip', returnStdout: true).trim().split("\n")
bat(script: 'dir /b *.zip', returnStdout: true).trim()
// Get the most recent .zip file based on modification date if (zipFiles.isEmpty()) {
def latestZip = bat(script: 'dir /b /od *.zip | head -n 1', returnStdout: true).trim() 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()
if (latestZip) {
env.LATEST_ZIP_FILENAME = latestZip env.LATEST_ZIP_FILENAME = latestZip
echo "✅ Latest zip file selected: ${env.LATEST_ZIP_FILENAME}" echo "✅ Latest zip file selected: ${env.LATEST_ZIP_FILENAME}"
} else {
error "No valid zip files found in the directory!"
}
} }
} }
} }