From ccc598d746fd06f684b15d588a5a13698ffbfe1c Mon Sep 17 00:00:00 2001 From: dzaitsev Date: Sun, 4 May 2025 15:09:01 +0300 Subject: [PATCH] gdrive update1 --- build/jenkins/GDriveUpload | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/build/jenkins/GDriveUpload b/build/jenkins/GDriveUpload index 0e316b4..99c65cd 100644 --- a/build/jenkins/GDriveUpload +++ b/build/jenkins/GDriveUpload @@ -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 @@ -118,7 +119,18 @@ pipeline { } else { 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 + } } } }