Skip to content

Commit

Permalink
Merge pull request #620 from microsoft/main
Browse files Browse the repository at this point in the history
Release latest SetupAssist
  • Loading branch information
dpaulson45 authored Jul 1, 2021
2 parents 2189b40 + c4219e8 commit c8271bb
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 16 deletions.
29 changes: 29 additions & 0 deletions .build/BuildFunctions/Get-FileMostRecentCommit.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

. $PSScriptRoot\Test-PathCaseSensitive.ps1

function Get-FileMostRecentCommit {
[CmdletBinding()]
[OutputType([DateTime])]
param (
[Parameter()]
[string]
$File
)

Write-Verbose "Get-FileMostRecentCommit called for file $File"

if (-not (Test-PathCaseSensitive $File)) {
Write-Error "Path case is not correct: $File"
}

try {
$commitTime = [DateTime]::Parse((git log -n 1 --format="%ad" --date=rfc $File))
Write-Verbose "Commit time $commitTime for file $File"
return $commitTime
} catch {
Write-Error "Failed to get commit time for file $File"
throw
}
}
17 changes: 8 additions & 9 deletions .build/BuildFunctions/Get-ScriptProjectMostRecentCommit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT License.

. $PSScriptRoot\Get-EmbeddedFileList.ps1
. $PSScriptRoot\Get-FileMostRecentCommit.ps1

<#
.SYNOPSIS
Expand All @@ -19,15 +20,13 @@ function Get-ScriptProjectMostRecentCommit {

process {
Write-Verbose "Get-ScriptProjectMostRecentCommit called for file $File"
$mostRecentCommit = [DateTime]::MinValue
if ([DateTime]::TryParse((git log -n 1 --format="%ad" --date=rfc $File), [ref] $mostRecentCommit)) {
Get-EmbeddedFileList $File | ForEach-Object {
Write-Verbose "Getting commit time for $_"
$commitTime = [DateTime]::Parse((git log -n 1 --format="%ad" --date=rfc $_))
if ($commitTime -gt $mostRecentCommit) {
$mostRecentCommit = $commitTime
Write-Host ("Changing commit time to: $($commitTime.ToString("yy.MM.dd.HHmm"))")
}
$mostRecentCommit = Get-FileMostRecentCommit $File
foreach ($embeddedFile in (Get-EmbeddedFileList $File)) {
Write-Verbose "Getting commit time for $embeddedFile"
$commitTime = Get-FileMostRecentCommit $embeddedFile
if ($commitTime -gt $mostRecentCommit) {
$mostRecentCommit = $commitTime
Write-Host ("Changing commit time to: $($commitTime.ToString("yy.MM.dd.HHmm"))")
}
}

Expand Down
29 changes: 29 additions & 0 deletions .build/BuildFunctions/Test-PathCaseSensitive.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

function Test-PathCaseSensitive {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$Path
)

if (-not (Test-Path $Path)) {
Write-Warning "Path does not exist: $Path"
return $false
}

$directoryName = [IO.Path]::GetDirectoryName($Path)
$fileName = [IO.Path]::GetFileName($Path)
$childItem = Get-ChildItem $directoryName -Filter $fileName
$actualPath = $childItem.FullName
if ($actualPath -ceq $Path) {
return $true
}

Write-Warning "Provided path: $Path"
Write-Warning "Actual path: $actualPath"
Write-Warning "Path case is not correct."
return $false
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Exchange Server Support Scripts

[![Build Status](https://dev.azure.com/CSS-Exchange-Tools/CSS%20Exchange%20Scripts/_apis/build/status/microsoft.CSS-Exchange?branchName=main)](https://dev.azure.com/CSS-Exchange-Tools/CSS%20Exchange%20Scripts/_build/latest?definitionId=7&branchName=main)
[![Build Status](https://dev.azure.com/CSS-Exchange-Tools/CSS%20Exchange%20Scripts/_apis/build/status/microsoft.CSS-Exchange?branchName=release)](https://dev.azure.com/CSS-Exchange-Tools/CSS%20Exchange%20Scripts/_build/latest?definitionId=7&branchName=release)

## The Repository

Expand Down
32 changes: 26 additions & 6 deletions Setup/SetupAssist/Checks/Test-ExchangeAdLevel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ function Test-ExchangeAdSetupObjects {

$exchLatest = @{}
$exchLatest.Add("2016", [PSCustomObject]@{
CU = "CU20"
UpperRange = 15333
CU = "CU21"
UpperRange = 15334
})
$exchLatest.Add("2019", [PSCustomObject]@{
CU = "CU9"
UpperRange = 17002
CU = "CU10"
UpperRange = 17003
})
$exchLatest.Add("2013", [PSCustomObject]@{
CU = "CU23"
Expand Down Expand Up @@ -185,6 +185,16 @@ function Test-ExchangeAdSetupObjects {
return
}
Write-ReadyFor -ExchangeVersion "2016" -UpperRange $schemaValue -CU $CU
} elseif ($schemaValue -eq 15334) {

if ($MESOValue -eq 13241 -and
$orgValue -eq 16221) {
$CU = "CU21"
} else {
Write-Mismatch -ExchVersion "2016" -UpperRange $schemaValue
return
}
Write-ReadyFor -ExchangeVersion "2016" -UpperRange $schemaValue -CU $CU
}
#Exchange 2019 CU2+
elseif ($schemaValue -eq 17001) {
Expand All @@ -199,7 +209,7 @@ function Test-ExchangeAdSetupObjects {
Write-Mismatch -ExchVersion "2019" -UpperRange $schemaValue
return
}
Write-ReadyFor -ExchangeVersion "2016" -UpperRange $schemaValue -CU $CU
Write-ReadyFor -ExchangeVersion "2019" -UpperRange $schemaValue -CU $CU
} elseif ($schemaValue -eq 17002) {

if ($MESOValue -eq 13239 -and
Expand All @@ -212,7 +222,17 @@ function Test-ExchangeAdSetupObjects {
Write-Mismatch -ExchVersion "2019" -UpperRange $schemaValue
return
}
Write-ReadyFor -ExchangeVersion "2016" -UpperRange $schemaValue -CU $CU
Write-ReadyFor -ExchangeVersion "2019" -UpperRange $schemaValue -CU $CU
} elseif ($schemaValue -eq 17003) {

if ($MESOValue -eq 13241 -and
$orgValue -eq 16758) {
$CU = "CU10"
} else {
Write-Mismatch -ExchVersion "2019" -UpperRange $schemaValue
return
}
Write-ReadyFor -ExchangeVersion "2019" -UpperRange $schemaValue -CU $CU
} else {
Write-Mismatch -ExchVersion "2019" -UpperRange $schemaValue
}
Expand Down

0 comments on commit c8271bb

Please sign in to comment.