# ============================================================================ # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE # ---------------------------------------------------------------------------- <# .Synopsis p4verify.ps1 performs archive verification on all appropriate depots .Description Runs "p4 verify -qz //depot/..." as appropriate. .Parameter sdp-instance The specified SDP instance to verify .Example p4verify.ps1 Master .Example p4verify.ps1 1 #> [CmdletBinding()] param ([string]$SDPInstance = $(throw "SDPInstance parameter is required.")) Set-StrictMode -Version 2.0 # Source the SDP Functions shared between scripts $SDPFunctionsPath = Split-Path -parent $MyInvocation.MyCommand.Path | Join-Path -childpath "SDP-Functions.ps1" . $SDPFunctionsPath $global:ScriptName = "P4Verify.ps1" $global:ScriptTask = "Verify" $global:LogFileName = "p4verify.log" Parse-SDPConfigFile $MyInvocation.MyCommand.Path Create-LogFile $OrigPath = convert-path . Set-Location -Path $global:LOGS_DIR Function Run-Verify () { Log "Running verify" #$result = & $global:P4exe -p $global:P4PORT -u $global:SDP_P4SUPERUSER depots 2>&1 $result = & $global:P4exe -p $global:P4PORT -u $global:SDP_P4SUPERUSER depots 2>&1 Log $result if ($lastexitcode -ne 0) { throw "ERROR - failed to get depots!" } foreach ($dline in $result) { $dname = $dline.split()[1] $dtype = $dline.split()[3] Log "$dname has type $dtype" if (!($dtype -match "remote|archive")) { if ($dtype -match "unload") { $cmd = "$global:P4exe -p $global:P4PORT -s -u $global:SDP_P4SUPERUSER verify -U -q //$dname/... >> $global:LogFile 2>&1" Log $cmd cmd /c $cmd } else { $cmd = "$global:P4exe -p $global:P4PORT -s -u $global:SDP_P4SUPERUSER verify -qz //$dname/... >> $global:LogFile 2>&1" Log $cmd cmd /c $cmd $cmd = "$global:P4exe -p $global:P4PORT -s -u $global:SDP_P4SUPERUSER verify -qS //$dname/... >> $global:LogFile 2>&1" Log $cmd cmd /c $cmd } } } # Finally we check for errors $matches = Get-Content $global:logfile | Select-String -Pattern "BAD!|MISSING!" -AllMatches if ($matches -ne $null) { $count = $matches.matches.count if ($count -gt 0) { throw "Found $count verify errors in logfile - contact support@perforce.com if you need help to resolve" } } } try { Log "If there are errors in this log, you may wish to contact support@perforce.com for help." Invoke-P4Login Run-Verify Remove-OldLogs Log "End ${global:SDP_INSTANCE_P4SERVICE_NAME} ${global:ScriptTask}" Send-Email "${env:computername} ${global:SDP_INSTANCE_P4SERVICE_NAME} ${global:ScriptTask} log." Write-Output "`r`n${global:ScriptTask} completed successfully - see ${global:logfile}" } Catch { write-error $error[0].ScriptStackTrace LogException $_.Exception Send-Email "FAILED: ${env:computername} ${global:SDP_INSTANCE_P4SERVICE_NAME} ${global:ScriptTask} log." Write-Output "`r`nFAILED - ${global:ScriptTask} - see ${global:logfile}" } Set-Location -Path $OrigPath
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#7 | 28858 | C. Thomas Tyler |
Released SDP 2022.1.28855 (2022/05/27). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#6 | 28651 | C. Thomas Tyler |
Released SDP 2021.2.28649 (2022/03/03). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#5 | 27331 | C. Thomas Tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#4 | 26161 | C. Thomas Tyler |
Released SDP 2019.3.26159 (2019/11/06). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#3 | 22920 | Robert Cowham |
Bring latest changes in from dev for Windows. - fixed p4verify for replicas with -t - created upgrade.ps1 |
||
#2 | 21851 | Robert Cowham | Fix exception on matches property | ||
#1 | 21606 | Robert Cowham | Propagate Windows changes - reinstate instance specific .bat files. | ||
//guest/perforce_software/sdp/dev/Server/Windows/p4/common/bin/p4verify.ps1 | |||||
#1 | 21602 | Robert Cowham | Add p4verify.ps1 |