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