mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:06:30 +00:00
pipelines zip and gdrive upload
updated
This commit is contained in:
@@ -32,7 +32,8 @@ 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') {
|
||||||
def latestZip = sh(script: 'ls -t *.zip | head -n 1', returnStdout: true).trim()
|
// Find the latest zip file using shell command
|
||||||
|
def latestZip = bat(script: 'dir /b /od *.zip | findstr /r /c:"AzaionSuite.Iterative.*.zip"', returnStdout: true).trim()
|
||||||
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}"
|
||||||
}
|
}
|
||||||
@@ -46,15 +47,15 @@ pipeline {
|
|||||||
powershell """
|
powershell """
|
||||||
# Check if file exists on Google Drive
|
# Check if file exists on Google Drive
|
||||||
\$existingFiles = rclone lsf --files-only AzaionGoogleDrive:${GOOGLE_DRIVE_FOLDER}
|
\$existingFiles = rclone lsf --files-only AzaionGoogleDrive:${GOOGLE_DRIVE_FOLDER}
|
||||||
if (\$existingFiles -contains "${LATEST_ZIP_FILENAME}") {
|
if (\$existingFiles -contains "${env.LATEST_ZIP_FILENAME}") {
|
||||||
Write-Output "File ${LATEST_ZIP_FILENAME} already exists on Google Drive, skipping upload."
|
Write-Output "File ${env.LATEST_ZIP_FILENAME} already exists on Google Drive, skipping upload."
|
||||||
} else {
|
} else {
|
||||||
Write-Output "Uploading ${LATEST_ZIP_FILENAME} to Google Drive..."
|
Write-Output "Uploading ${env.LATEST_ZIP_FILENAME} to Google Drive..."
|
||||||
rclone copy C:/Jenkins/workspace/Azaion/suite/${LATEST_ZIP_FILENAME} AzaionGoogleDrive:${GOOGLE_DRIVE_FOLDER}
|
rclone copy C:/Jenkins/workspace/Azaion/suite/${env.LATEST_ZIP_FILENAME} AzaionGoogleDrive:${GOOGLE_DRIVE_FOLDER}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Always remove the local file after uploading
|
# Always remove the local file after uploading
|
||||||
Remove-Item "C:/Jenkins/workspace/Azaion/suite/${LATEST_ZIP_FILENAME}"
|
Remove-Item "C:/Jenkins/workspace/Azaion/suite/${env.LATEST_ZIP_FILENAME}"
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ pipeline {
|
|||||||
|
|
||||||
# Split files by line and exclude the latest zip file
|
# Split files by line and exclude the latest zip file
|
||||||
\$filesArray = \$files -split "`n" | Where-Object { \$_ -ne "" }
|
\$filesArray = \$files -split "`n" | Where-Object { \$_ -ne "" }
|
||||||
\$latestFile = "${LATEST_ZIP_FILENAME}"
|
\$latestFile = "${env.LATEST_ZIP_FILENAME}"
|
||||||
\$filesArray = \$filesArray | Where-Object { \$_ -ne \$latestFile }
|
\$filesArray = \$filesArray | Where-Object { \$_ -ne \$latestFile }
|
||||||
|
|
||||||
# If more than 3 files exist, delete the oldest ones
|
# If more than 3 files exist, delete the oldest ones
|
||||||
@@ -112,13 +113,6 @@ pipeline {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Declarative: Post Actions') {
|
|
||||||
steps {
|
|
||||||
echo "Executing post-build cleanup..."
|
|
||||||
// Clean up any resources after the pipeline run
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
|||||||
Reference in New Issue
Block a user