mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 03:26:31 +00:00
latest fixes for Gdrive upload
This commit is contained in:
+19
-11
@@ -32,29 +32,34 @@ pipeline {
|
||||
echo "Finding latest zip file..."
|
||||
dir("C:/Jenkins/workspace/AzaionSuite/suite") {
|
||||
def output = powershell(returnStdout: true, script: '''
|
||||
$pattern = "AzaionSuite.*-*-*.zip"
|
||||
$pattern = "AzaionSuite*-*-*.zip"
|
||||
$zipFiles = Get-ChildItem -Filter $pattern | Sort-Object Name -Descending
|
||||
if ($zipFiles.Count -eq 0) {
|
||||
Write-Error "No ZIP files matching pattern '$pattern' were found."
|
||||
exit 1
|
||||
if ($zipFiles.Count -gt 0) {
|
||||
$latestZip = $zipFiles[0].Name
|
||||
Write-Output "::SET-ENV::LATEST_ZIP_FILENAME=$latestZip"
|
||||
} else {
|
||||
Write-Output "::SET-ENV::LATEST_ZIP_FILENAME="
|
||||
}
|
||||
$latestZip = $zipFiles[0].Name
|
||||
Write-Output "::SET-ENV::LATEST_ZIP_FILENAME=$latestZip"
|
||||
''').trim()
|
||||
|
||||
def match = output =~ /::SET-ENV::LATEST_ZIP_FILENAME=(.+)/
|
||||
if (!match) {
|
||||
error("Could not find the latest zip filename in the PowerShell output using marker.")
|
||||
if (!match || !match[0][1]?.trim()) {
|
||||
echo "⚠️ No ZIP files matching the pattern were found. Skipping upload and cleanup stages."
|
||||
env.LATEST_ZIP_FILENAME = ''
|
||||
} else {
|
||||
def zipFileName = match[0][1]
|
||||
echo "✅ Latest zip file selected: ${zipFileName}"
|
||||
env.LATEST_ZIP_FILENAME = zipFileName
|
||||
}
|
||||
def zipFileName = match[0][1]
|
||||
echo "Latest zip file selected: ${zipFileName}"
|
||||
env.LATEST_ZIP_FILENAME = zipFileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Upload If Not Exists & Always Remove Local') {
|
||||
when {
|
||||
expression { return env.LATEST_ZIP_FILENAME?.trim() }
|
||||
}
|
||||
steps {
|
||||
echo "Checking Google Drive for existing ZIP and uploading if needed..."
|
||||
powershell """
|
||||
@@ -87,6 +92,9 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Cleanup Older Files on Google Drive') {
|
||||
when {
|
||||
expression { return env.LATEST_ZIP_FILENAME?.trim() }
|
||||
}
|
||||
steps {
|
||||
echo "Cleaning up older files on Google Drive..."
|
||||
powershell """
|
||||
|
||||
Reference in New Issue
Block a user