Parametrize libraries (#2942)

Add a secret for configuring SP libraries to purge
---

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [x] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Georgi Matev 2023-03-24 16:36:24 -07:00 committed by GitHub
parent dfdd7339d2
commit a28871c4c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,8 @@ inputs:
description: User whose data is to be purged. description: User whose data is to be purged.
site: site:
description: Sharepoint site where data is to be purged. description: Sharepoint site where data is to be purged.
libraries:
description: List of library names within site where data is to be purged.
folder-prefix: folder-prefix:
description: Name of the folder to be purged. If falsy, will purge the set of static, well known folders instead. description: Name of the folder to be purged. If falsy, will purge the set of static, well known folders instead.
older-than: older-than:
@ -65,7 +67,7 @@ runs:
M365_TENANT_ADMIN_USER: ${{ inputs.m365-admin-user }} M365_TENANT_ADMIN_USER: ${{ inputs.m365-admin-user }}
M365_TENANT_ADMIN_PASSWORD: ${{ inputs.m365-admin-password }} M365_TENANT_ADMIN_PASSWORD: ${{ inputs.m365-admin-password }}
run: | run: |
./onedrivePurge.ps1 -Site ${{ inputs.site }} -FolderPrefixPurgeList ${{ inputs.folder-prefix }} -PurgeBeforeTimestamp ${{ inputs.older-than }} ./onedrivePurge.ps1 -Site ${{ inputs.site }} -LibraryNameList ${{ inputs.libraries }} -FolderPrefixPurgeList ${{ inputs.folder-prefix }} -PurgeBeforeTimestamp ${{ inputs.older-than }}
- name: Reset retention for all mailboxes to 0 - name: Reset retention for all mailboxes to 0
if: ${{ inputs.user == '' }} if: ${{ inputs.user == '' }}

View File

@ -30,6 +30,7 @@ jobs:
user: ${{ secrets[matrix.user] }} user: ${{ secrets[matrix.user] }}
site: ${{ secrets.CORSO_M365_TEST_SITE_URL}} site: ${{ secrets.CORSO_M365_TEST_SITE_URL}}
folder-prefix: "Corso_Restore_, TestRestore, testfolder, incrementals_ci_, Alcion_Restore_" folder-prefix: "Corso_Restore_, TestRestore, testfolder, incrementals_ci_, Alcion_Restore_"
libraries: ${{ secrets.CORSO_M365_TEST_SITE_LIBRARIES }}
older-than: ${{ env.HALF_HOUR_AGO }} older-than: ${{ env.HALF_HOUR_AGO }}
azure-client-id: ${{ secrets.CLIENT_ID }} azure-client-id: ${{ secrets.CLIENT_ID }}
azure-client-secret: ${{ secrets.CLIENT_SECRET }} azure-client-secret: ${{ secrets.CLIENT_SECRET }}

View File

@ -70,6 +70,8 @@ function Purge-Library {
[String[]]$SiteSuffix [String[]]$SiteSuffix
) )
Write-Host "`nPurging library: $LibraryName"
$foldersToPurge = @() $foldersToPurge = @()
$folders = Get-PnPFolderItem -FolderSiteRelativeUrl $LibraryName -ItemType Folder $folders = Get-PnPFolderItem -FolderSiteRelativeUrl $LibraryName -ItemType Folder