gdrive update1

This commit is contained in:
dzaitsev
2025-05-04 15:09:01 +03:00
parent c83ed53672
commit ccc598d746
+14 -2
View File
@@ -77,8 +77,9 @@ pipeline {
stage('Cleanup Older Files on Google Drive') {
steps {
echo "Cleaning up older files on Google Drive..."
powershell '''
script {
// Writing PowerShell cleanup script to a temporary file
def cleanupScript = '''
# List all files in the Google Drive folder
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
@@ -119,6 +120,17 @@ pipeline {
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
}
}
}
}