gdrive update1

This commit is contained in:
dzaitsev
2025-05-04 15:09:01 +03:00
parent c83ed53672
commit ccc598d746
+15 -3
View File
@@ -77,8 +77,9 @@ pipeline {
stage('Cleanup Older Files on Google Drive') { stage('Cleanup Older Files on Google Drive') {
steps { steps {
echo "Cleaning up older files on Google Drive..." script {
powershell ''' // Writing PowerShell cleanup script to a temporary file
def cleanupScript = '''
# List all files in the Google Drive folder # List all files in the Google Drive folder
Write-Output "Listing all files in the folder ${params.GOOGLE_DRIVE_FOLDER} on Google Drive..." Write-Output "Listing all files in the folder ${params.GOOGLE_DRIVE_FOLDER} on Google Drive..."
$files = rclone lsf --files-only AzaionGoogleDrive:${params.GOOGLE_DRIVE_FOLDER} --format "tp" --max-depth 1 $files = rclone lsf --files-only AzaionGoogleDrive:${params.GOOGLE_DRIVE_FOLDER} --format "tp" --max-depth 1
@@ -118,7 +119,18 @@ pipeline {
} else { } else {
Write-Output "No files found on Google Drive to clean up." Write-Output "No files found on Google Drive to clean up."
} }
''' '''
// Write the PowerShell cleanup script to a temporary file
def tempScriptFile = "cleanup_script.ps1"
writeFile file: tempScriptFile, text: cleanupScript
// Run the PowerShell script
powershell script: tempScriptFile
// Clean up the temporary PowerShell script file
deleteFile tempScriptFile
}
} }
} }
} }