Skip to content

Commit

Permalink
3-15 nightly - forgot to hit commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengillie committed Mar 19, 2024
1 parent 91a1359 commit 776ae4d
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 33 deletions.
52 changes: 30 additions & 22 deletions Tools/ManualValidationPipeline.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
//Copyright 2022-2024 Microsoft Corporation
//Author: Stephen Gillie
//Title: WinGet Approval Pipeline v3.-73.0
//Title: WinGet Approval Pipeline v3.-68.0
//Created: 1/19/2024
//Updated: 3/14/2024
//Updated: 3/15/2024
//Notes: Tool to streamline evaluating winget-pkgs PRs.
//Update log:
//3.-68.0 - Depreciate RotateLog.
//3.-69.0 - Finish porting PRPopulateRecord.
//3.-70.1 - Create RefreshStatus to handle updating outBox_vm. This was done before by standard PowerShell display of a CSV-like array as a table.
//3.-70.0 - Port SetStatus.
//3.-71.0 - Port GetValidationData.
//3.-71.0 - Depreciate AddValidationData.
//3.-72.1 - Improve PR field regex.
//3.-72.0 - Port CommitFile.
//3.-73.0 - Port ManifestEntryCheck.
//3.-74.0 - Soft-depreciate ManifestOtherAutomation.
//3.-75.0 - Port AddWaiver.





/*Contents: (Remaining functions to port or depreciate: 66)

/*Contents: (Remaining functions to port or depreciate: 62)
- Init vars (?)
- Boilerplate (?)
- UI top-of-box (?)
Expand All @@ -28,20 +31,28 @@
- Manifests Etc (6)
- VM Image Management (3)
- VM Pipeline Management (6)
- VM Status (3)
- VM Status (2)
- VM Versioning (1)
- VM Orchestration (4)
- File Management (4)
- File Management (3)
- Inject into files on disk (2)
- Inject into PRs (4)
- Timeclock (4)
- Reporting (3)
- Reporting (2)
- Clipboard (3)
- Etc (4)
- Etc (2)
- PR Watcher Utility functions (1)
- Powershell equivalency (+8)
- VM Window management (3)
- Misc data (+5)
Et cetera:
- UserInput field
- Mode through button effects
- VM control buttons
- PR counters on certain buttons - Approval-Ready, ToWork, Defender, IEDS
- Better way to display VM/Validation lists.
- CLI switches such as --hourly-run
*/


Expand All @@ -59,39 +70,36 @@ PRInstallerStatusInnerWrapper might be unnecessary.
PadRight
PRStateFromComments
LineFromCommitFile
PRPopulateRecord
#Todo:
Add-ValidationData
Get-TrackerVMSetStatus
Get-LoadFileIfExists
Get-UpdateArchInPR
Add-DependencyToPR
Get-TimeRunning
Get-OSFromVersion
Test-Admin
Get-PRApproval
Add-ToValidationFile
Get-PRFromRecord
Get-UpdateHashInPR
Get-UpdateHashInPR2
#Blocked:
Get-ManifestListing#Find-WinGetPackage
Get-ConnectedVM#Test-Admin
Add-ToValidationFile#Get-TrackerVMSetStatus
Add-InstallerSwitch#Add-ToValidationFile
Get-Timeclock#Get-Date
Get-PRFullReport#Get-PRReportFromRecord
Open-AllURL#Start-Process
Open-PRInBrowser#Start-Process
Get-ListingDiff#Get-ManifestListing
Get-TrackerVMRebuildStatus#Get-VM
Get-PRFromRecord#Get-PRPopulateRecord
Get-PRReportFromRecord#Get-PRFromRecord
Get-PRFullReport#Get-PRReportFromRecord
Get-TrackerVMValidateByID#Get-TrackerVMValidate
Get-TrackerVMValidateByConfig#Get-TrackerVMValidate
Get-TrackerVMValidateByArch#Get-TrackerVMValidate
Get-TrackerVMValidateByScope#Get-TrackerVMValidate
Get-TrackerVMValidateBothArchAndScope#Get-TrackerVMValidate
Get-UpdateHashInPR#Add-GitHubReviewComment
Get-UpdateHashInPR2#Add-GitHubReviewComment
Get-SearchGitHub#Get-Date, Start-Process
Get-ManifestAutomation#Get-ManifestFile, Get-NextFreeVM
Expand All @@ -103,9 +111,10 @@ PRInstallerStatusInnerWrapper might be unnecessary.
Get-Sandbox#Stop-Process, Start-Process
Get-NextFreeVM#Get-Random, Test-Admin
Get-RemoveFileIfExist#New-Item, Remove-Item
Get-TrackerVMRevert#Restore-VMCheckpoint, Test-Admin
Get-TrackerVMResetStatus#Get-ConnectedVM, Stop-Process
Get-TrackerVMLaunchWindow#Get-ConnectedVM, Stop-Process, Test-Admin
Get-TrackerVMRevert#Get-TrackerVMSetStatus, Restore-VMCheckpoint, Test-Admin
Get-TrackerVMRunTracker#Get-AutoValLog, Get-ConnectedVM, Get-Date, Get-HoursWorkedToday, Get-PRLabelAction, Get-Random, Get-RandomIEDS, Get-SearchGitHub, Get-TimeRunning, Get-TrackerMode, Get-TrackerVMCycle, Get-TrackerVMRotate, Get-TrackerVMValidate, Get-TrackerVMWindowArrange, Get-VM, Set-Vm, start-process
Get-PRWatch#Approve-PR, Compare-Object, Find-WinGetPackage, Get-CleanClip, Get-Command, Get-Date, Get-ListingDiff, Get-LoadFileIfExists, Get-PadRight, Get-PRApproval, Get-Random, Get-Sandbox, Get-TrackerVMValidate
Expand All @@ -114,14 +123,13 @@ PRInstallerStatusInnerWrapper might be unnecessary.
Get-PRLabelAction#Soothing label action. #Get-AutoValLog, Get-Date, Get-GitHubPreset, Get-PRStateFromComments, Get-UpdateHashInPR2
Get-AutoValLog#Expand-Archive, Get-BuildFromPR, Get-ChildItem, Get-GitHubPreset, Open-PRInBrowser, Remove-Item, Start-Process, Stop-Process
Get-RandomIEDS#Get-ManifestFile, Get-NextFreeVM, Get-Random, Get-SearchGitHub
Get-TrackerVMValidate#Find-WinGetPackage, ForEach-Object, Get-ChildItem, Get-NextFreeVM, Get-OSFromVersion, Get-PipelineVmGenerate, Get-RemoveFileIfExist, Get-TrackerVMLaunchWindow, Get-TrackerVMRevert, Get-TrackerVMSetStatus, Get-VM, Get-YamlValue, Open-AllURL, Start-Process, Test-Admin
Get-TrackerVMValidate#Find-WinGetPackage, ForEach-Object, Get-ChildItem, Get-NextFreeVM, Get-OSFromVersion, Get-PipelineVmGenerate, Get-RemoveFileIfExist, Get-TrackerVMLaunchWindow, Get-TrackerVMRevert, Get-VM, Get-YamlValue, Open-AllURL, Start-Process, Test-Admin
Get-ManifestFile#Get-NextFreeVM, Get-RemoveFileIfExist, Get-TrackerVMValidate
Get-PipelineVmGenerate#Get-Date, Get-RemoveFileIfExist, Get-TrackerVMLaunchWindow, Get-TrackerVMRevert, Get-VM, Import-VM, Remove-VMCheckpoint, Rename-VM, Start-VM, Test-Admin
Get-PipelineVmDisgenerate#Get-ConnectedVM, Get-RemoveFileIfExist, Get-TrackerVMSetStatus, Remove-VM, Stop-Process, Stop-TrackerVM, Test-Admin, Write-Progress
Get-ImageVMStart#Get-TrackerVMLaunchWindow, Get-TrackerVMRevert, Start-VM, Test-Admin
Get-ImageVMStop#Get-ConnectedVM, Redo-Checkpoint, Stop-Process, Stop-TrackerVM, Test-Admin
Get-ImageVMMove#Get-Date, Get-VM, Move-VMStorage, Rename-VM, Test-Admin
Get-TrackerVMResetStatus#Get-ConnectedVM, Get-TrackerVMSetStatus, Stop-Process
Get-TrackerVMRotate#Get-Random, Get-TrackerVMSetStatus, Get-TrackerVMVersion
Complete-TrackerVM#Get-ConnectedVM, Get-RemoveFileIfExist, Get-TrackerVMSetStatus, Stop-Process, Stop-TrackerVM, Test-Admin
Redo-Checkpoint#Checkpoint-VM, Get-TrackerVMSetStatus, Redo-Checkpoint, Remove-VMCheckpoint, Test-Admin
Expand Down
2 changes: 1 addition & 1 deletion Tools/ManualValidationPipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $PeriodicRunLog = "$MainFolder\misc\PeriodicRunLog.txt"
$SharedErrorFile = "$writeFolder\err.txt"
$DataFileName = "$ReposFolder\Tools\ManualValidationPipeline.csv"

$Win10Folder = "$imagesFolder\Win10-Created010424-Original"
$Win10Folder = "$imagesFolder\Win10-Created031524-Original"
$Win11Folder = "$imagesFolder\Win11-Created010424-Original"

$GitHubBaseUrl = "https://github.com/$Owner/$Repo"
Expand Down
73 changes: 63 additions & 10 deletions Tools/ManualValidationProfile.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
$VM = 0
$build = 129
$build = 132
$ipconfig = (ipconfig)
$remoteIP = ([ipaddress](($ipconfig | select-string "Default Gateway") -split ": ")[1]).IPAddressToString
#$remoteIP = ([ipaddress](($ipconfig[($ipconfig | select-string "vEthernet").LineNumber..$ipconfig.length] | select-string "IPv4 Address") -split ": ")[1]).IPAddressToString
write-host "VM$VM with remoteIP $remoteIP version $build"
Write-Host "VM$VM with remoteIP $remoteIP version $build"

$MainFolder = "\\$remoteIP\ManVal"
$homePath = "C:\Users\User\Desktop"
cd $homePath
Set-Location $homePath

$runPath = "$MainFolder\vm\$VM"
$writeFolder = "\\$remoteIP\write"
Expand All @@ -17,21 +17,21 @@ $SharedFolder = $writeFolder
if ($VM -eq 0) {
$VM = (gc "$MainFolder\vmcounter.txt")-1
}
"`$VM = $VM" | out-file $profile
(gc "\\$remoteIP\ManVal\vm\0\profile.ps1")[1..999] | out-file $profile -append
"`$VM = $VM" | Out-File $profile
(Get-Content "\\$remoteIP\ManVal\vm\0\profile.ps1")[1..999] | Out-File $profile -append

Function Send-SharedError {
param(
$c = (Get-Clipboard)
$Clip = (Get-Clipboard)
)
Write-Host "Writing $($c.length) lines."
$c | Out-File "$writeFolder\err.txt"
Write-Host "Writing $($Clip.length) lines."
$Clip | Out-File "$writeFolder\err.txt"
Get-TrackerVMSetStatus "SendStatus"
}

Function Get-TrackerVMSetStatus {
param(
[ValidateSet("AddVCRedist","Approved","CheckpointComplete","Checkpointing","CheckpointReady","Completing","Complete","Disgenerate","Generating","Installing","Prescan","Prevalidation","Ready","Rebooting","Regenerate","Restoring","Revert","Scanning","SendStatus","Setup","SetupComplete","Starting","Updating","ValidationComplete")]
[ValidateSet("AddVCRedist","Approved","CheckpointComplete","Checkpointing","CheckpointReady","Completing","Complete","Disgenerate","Generating","Installing","Prescan","Prevalidation","Ready","Rebooting","Regenerate","Restoring","Revert","Scanning","SendStatus","Setup","SetupComplete","Starting","Updating","ValidationCompleted")]
$Status = "Complete",
[string]$Package,
[int]$PR
Expand Down Expand Up @@ -61,7 +61,7 @@ Function Get-TrackerVMRunValidation {
Function Get-TrackerVMStatus{
param(
[int]$vm,
[ValidateSet("AddVCRedist","Approved","CheckpointComplete","Checkpointing","CheckpointReady","Completing","Complete","Disgenerate","Generating","Installing","Prescan","Prevalidation","Ready","Rebooting","Regenerate","Restoring","Revert","Scanning","SendStatus","Setup","SetupComplete","Starting","Updating","ValidationComplete")]
[ValidateSet("AddVCRedist","Approved","CheckpointComplete","Checkpointing","CheckpointReady","Completing","Complete","Disgenerate","Generating","Installing","Prescan","Prevalidation","Ready","Rebooting","Regenerate","Restoring","Revert","Scanning","SendStatus","Setup","SetupComplete","Starting","Updating","ValidationCompleted")]
$Status,
$out = (Get-Content $StatusFile | ConvertFrom-Csv | where {$_.status -notmatch "ImagePark"})
)
Expand All @@ -73,3 +73,56 @@ Function Get-TrackerVMStatus{
}
$out
}

<#
#Clear event logs.
# Commands
#Get-TrackerVMRunValidation
Get-NetAdapter|Disable-NetAdapter;Get-NetAdapter|Enable-NetAdapter;sleep 5;Import-Module $Profile -Force;Import-Module $Profile -Force;cls;Write-Host "VM$VM with remoteIP $remoteIP version $build"
# Copy command then exit and checkpoint.
Import-Module $Profile -force; Get-TrackerVMSetStatus CheckpointReady;exit
# Reset display window
$vm = 0;notepad $profile;cls;Write-Host "VM$VM with remoteIP $remoteIP version $build"
# Close Notepad
Get-Process Notepad|Stop-Process;
# Reboot
shutdown -r -t 05
# Setup: ExecutionPolicy, Uninstall, Enable WinGet settings.
Set-ExecutionPolicy Unrestricted
winget uninstall Microsoft.Teams
winget uninstall Microsoft.OneDrive
winget uninstall Microsoft.MSIXPackagingTool_8wekyb3d8bbwe
winget settings --enable LocalManifestFiles;winget settings --enable LocalArchiveMalwareScanOverride;
# Files
Logs file: C:\Users\user\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
Programs: C:\Users\user\AppData\Local\Programs\
Download: C:\Users\user\AppData\Local\Temp\WinGet\
Portable: C:\Users\user\AppData\Local\Microsoft\WinGet\Packages\
Symlinks: C:\Users\user\AppData\Local\Microsoft\WinGet\Links\
New VM:
- Open Quick Create, create VM
- Connect, power on, use [email protected] to skip login.
- User username, easy to type password, security questions.
- Keyboard layout and locale, maybe a few other questions, then skip everything else.
- Do something else during initial setup.
- Install all store, winget, windows, and defender updates. Reboot as necessary.
ImageVMMove here at any point.
- Open PowerShell and run IPConfig, get switch IP.
- Connect to \\ip\ManVal\, open \vm\0\profile.ps1
- Run few setup and uninstall commands
- Copy to local profile.
- Set up PowerShell window sizes
- Enter commands in windows
ImageVMStop
- Wait for image to cool
PipelineVMGenerate
- VM is in system.
#>

0 comments on commit 776ae4d

Please sign in to comment.