mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 06:36:31 +00:00
latest fixes for Gdrive upload
This commit is contained in:
@@ -55,13 +55,14 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Upload to Google Drive using rclone') {
|
||||
stage('Upload or Delete Local If Already Exists') {
|
||||
steps {
|
||||
echo "Checking if ${env.LATEST_ZIP_FILENAME} already exists on Google Drive..."
|
||||
powershell """
|
||||
\$fileName = "${env.LATEST_ZIP_FILENAME}"
|
||||
\$folder = "${params.GOOGLE_DRIVE_FOLDER}"
|
||||
\$rcloneRemote = "AzaionGoogleDrive:\$folder"
|
||||
\$localFilePath = "C:/Jenkins/workspace/AzaionSuite/suite/\$fileName"
|
||||
|
||||
Write-Output "Checking for existing files in: \$rcloneRemote"
|
||||
\$existingFiles = rclone lsf --files-only \$rcloneRemote
|
||||
@@ -69,12 +70,17 @@ pipeline {
|
||||
Write-Output \$existingFiles
|
||||
|
||||
if (\$existingFiles -match "^\$fileName\$") {
|
||||
Write-Output "File '\$fileName' already exists on Google Drive. Skipping upload."
|
||||
Write-Output "File '\$fileName' already exists on Google Drive. Deleting local copy..."
|
||||
if (Test-Path \$localFilePath) {
|
||||
Remove-Item -Force \$localFilePath
|
||||
Write-Output "Local file deleted: \$localFilePath"
|
||||
} else {
|
||||
Write-Output "Local file not found for deletion: \$localFilePath"
|
||||
}
|
||||
} else {
|
||||
Write-Output "Uploading '\$fileName' to Google Drive..."
|
||||
\$filePath = "C:/Jenkins/workspace/AzaionSuite/suite/\$fileName"
|
||||
\$env:RCLONE_CONFIG = 'C:/Program Files/rclone/rclone.conf'
|
||||
rclone copy "\$filePath" \$rcloneRemote --progress --drive-chunk-size 64M
|
||||
rclone copy "\$localFilePath" \$rcloneRemote --progress --drive-chunk-size 64M
|
||||
Write-Output "Upload complete."
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user