Skip to content

Commit e84f9d2

Browse files
Nuno Silvapintonunes
andauthored
R11PIT-242 - Unify SetupTools versions and behavior (#99)
* R11PIT-242 - Change Install-OSServerPreReqs : * Add two optional parameters MinorVersion and PatchVersion * Evaluate the need to install .NET Core 2.1 by checking Minor and Patch version * Add logic in PlatformSetup to calculate if a given version is newer than a given version * Add tests * R11PIT-242 - Change name of the install binaries for net core 2.1 and net core 3.1 * R11PIT-242 - Add new parameters description * R11PIT-242 - Add Major Version to ShouldInstallDotNetCoreHostingBundleVersion2 * Add logic to not install .NET Core 3.1 if we decided to install .NET Core 2.1 based on the optional parameters * Change tests to validate this behavior * Improved net core installation detection * Bumped version and updated CHANGELOG Co-authored-by: Pedro Nunes <37883272+pintonunes@users.noreply.github.com>
1 parent 074b1eb commit e84f9d2

6 files changed

Lines changed: 147 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Outsystems.SetupTools Release History
22

3+
## 3.14.0.0
4+
5+
- Updated Install-OSServerPreReqs. Install .NET Core hosting bundle version 3.1.14 only if we are above OutSystems version 11.12.2.0. Added parameters so the full OutSystems version can be specified
6+
37
## 3.13.1.0
48

59
- Fixed Get-OSRepoAvailableVersions. Was getting versions from an old storage account

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 3.13.1.{build}
1+
version: 3.14.0.{build}
22

33
only_commits:
44
files:

src/Outsystems.SetupTools/Functions/Install-OSServerPreReqs.ps1

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ function Install-OSServerPreReqs
1212
Specifies the platform major version.
1313
Accepted values: 10 or 11.
1414
15+
.PARAMETER MinorVersion
16+
Specifies the platform minor version.
17+
Accepted values: one or more digit numbers.
18+
19+
.PARAMETER PatchVersion
20+
Specifies the platform patch version.
21+
Accepted values: single digits only.
22+
1523
.PARAMETER InstallIISMgmtConsole
1624
Specifies if the IIS Managament Console will be installed.
1725
On servers without GUI this feature can't be installed so you should set this parameter to $false.
@@ -22,6 +30,9 @@ function Install-OSServerPreReqs
2230
.EXAMPLE
2331
Install-OSServerPreReqs -MajorVersion "10"
2432
33+
.EXAMPLE
34+
Install-OSServerPreReqs -MajorVersion "11" -MinorVersion "12" -PatchVersion "3"
35+
2536
.EXAMPLE
2637
Install-OSServerPreReqs -MajorVersion "11" -InstallIISMgmtConsole:$false
2738
@@ -43,7 +54,15 @@ function Install-OSServerPreReqs
4354
[string]$SourcePath,
4455

4556
[Parameter()]
46-
[bool]$InstallIISMgmtConsole = $true
57+
[bool]$InstallIISMgmtConsole = $true,
58+
59+
[Parameter()]
60+
[ValidatePattern('\d+')]
61+
[string]$MinorVersion = "0",
62+
63+
[Parameter()]
64+
[ValidatePattern('\d$')]
65+
[string]$PatchVersion = "0"
4766
)
4867

4968
begin
@@ -128,8 +147,29 @@ function Install-OSServerPreReqs
128147
default
129148
{
130149
# Check .NET Core Windows Server Hosting version
131-
$installDotNetCoreHostingBundle2 = $true
132-
$installDotNetCoreHostingBundle3 = $true
150+
$fullVersion = [version]"$MajorVersion.$MinorVersion.$PatchVersion.0"
151+
if ($fullVersion -eq [version]"$MajorVersion.0.0.0")
152+
{
153+
# Here means that no specific minor and patch version were specified
154+
# So we install both versions
155+
$installDotNetCoreHostingBundle2 = $true
156+
$installDotNetCoreHostingBundle3 = $true
157+
}
158+
elseif ($fullVersion -gt [version]"11.12.2.0")
159+
{
160+
# Here means that minor and patch version were specified and we are above version 11.12.2.0
161+
# We install version 3 only
162+
$installDotNetCoreHostingBundle2 = $false
163+
$installDotNetCoreHostingBundle3 = $true
164+
}
165+
else
166+
{
167+
# Here means that minor and patch version were specified and we are below version 11.12.2.0
168+
# We install version 2 only
169+
$installDotNetCoreHostingBundle2 = $true
170+
$installDotNetCoreHostingBundle3 = $false
171+
}
172+
133173
foreach ($version in GetDotNetCoreHostingBundleVersions)
134174
{
135175
# Check version 2.1

src/Outsystems.SetupTools/Lib/Constants.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ $OSDotNetCoreHostingBundleReq = @{
118118
'2' = @{
119119
Version = '2.1.12'
120120
ToInstallDownloadURL = 'https://download.visualstudio.microsoft.com/download/pr/eebd54bc-c3a2-4580-bb29-b35c1c5ffa92/22ffe5649861167d3d5728d3cb4b10a1/dotnet-hosting-2.1.12-win.exe'
121-
InstallerName = 'DotNetCore_WindowsHosting_21.exe'
121+
InstallerName = 'DotNetCore_WindowsHosting.exe'
122122
}
123123
'3' = @{
124124
Version = '3.1.14'
125125
ToInstallDownloadURL = 'https://download.visualstudio.microsoft.com/download/pr/bdc70151-74f7-427c-a368-716d5f1840c5/6186889f6c784bae224eb15fb94c45fe/dotnet-hosting-3.1.14-win.exe'
126-
InstallerName = 'DotNetCore_WindowsHosting.exe'
126+
InstallerName = 'DotNetCore_WindowsHosting_31.exe'
127127
}
128128
}
129129

src/Outsystems.SetupTools/OutSystems.SetupTools.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'OutSystems.SetupTools.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '3.13.1.0'
15+
ModuleVersion = '3.14.0.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

test/unit/Install-OSServerPreReqs.Tests.ps1

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,5 +927,101 @@ InModuleScope -ModuleName OutSystems.SetupTools {
927927
It 'Should output an error' { $err[-1] | Should Be 'Error configuring the Message Queuing service' }
928928
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '10' -ErrorAction SilentlyContinue } | Should Not throw }
929929
}
930+
931+
Context 'When trying to install prerequisites for a OS 11 version in Minor version 12 and Patch version newer than 2 (11.12.3)' {
932+
933+
$result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '12' -PatchVersion '3' -ErrorVariable err -ErrorAction SilentlyContinue
934+
935+
It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet }
936+
It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools }
937+
It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures }
938+
It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 }
939+
It 'Should run the .NET core 3.1 installation' { Assert-MockCalled @assRunInstallDotNetCore }
940+
It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI }
941+
It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch }
942+
It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS }
943+
It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog }
944+
It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer }
945+
946+
It 'Should return the right result' {
947+
$result.Success | Should Be $true
948+
$result.RebootNeeded | Should Be $false
949+
$result.ExitCode | Should Be 0
950+
$result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed'
951+
}
952+
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '12' -PatchVersion '3' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
953+
}
954+
955+
Context 'When trying to install prerequisites for a OS 11 version in Minor version 12 and Patch version older than 2 (11.12.1)' {
956+
957+
$result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '12' -PatchVersion '1' -ErrorVariable err -ErrorAction SilentlyContinue
958+
959+
It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet }
960+
It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools }
961+
It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures }
962+
It 'Should run the .NET core 2.1 installation' { Assert-MockCalled @assRunInstallDotNetCore21 }
963+
It 'Should not run the .NET core 3.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore }
964+
It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI }
965+
It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch }
966+
It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS }
967+
It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog }
968+
It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer }
969+
970+
It 'Should return the right result' {
971+
$result.Success | Should Be $true
972+
$result.RebootNeeded | Should Be $false
973+
$result.ExitCode | Should Be 0
974+
$result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed'
975+
}
976+
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '12' -PatchVersion '1' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
977+
}
978+
979+
Context 'When trying to install prerequisites for a OS 11 version in Minor version 13 (11.13.0)' {
980+
981+
$result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '13' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue
982+
983+
It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet }
984+
It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools }
985+
It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures }
986+
It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 }
987+
It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore }
988+
It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI }
989+
It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch }
990+
It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS }
991+
It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog }
992+
It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer }
993+
994+
It 'Should return the right result' {
995+
$result.Success | Should Be $true
996+
$result.RebootNeeded | Should Be $false
997+
$result.ExitCode | Should Be 0
998+
$result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed'
999+
}
1000+
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '13' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
1001+
}
1002+
1003+
Context 'When trying to install prerequisites for a OS 11 version without passing the optional Minor and Patch Versions' {
1004+
1005+
$result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue
1006+
1007+
It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet }
1008+
It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools }
1009+
It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures }
1010+
It 'Should run the .NET core 2.1 installation' { Assert-MockCalled @assRunInstallDotNetCore21}
1011+
It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore }
1012+
It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI }
1013+
It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch }
1014+
It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS }
1015+
It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog }
1016+
It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer }
1017+
1018+
It 'Should return the right result' {
1019+
$result.Success | Should Be $true
1020+
$result.RebootNeeded | Should Be $false
1021+
$result.ExitCode | Should Be 0
1022+
$result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed'
1023+
}
1024+
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
1025+
}
9301026
}
9311027
}

0 commit comments

Comments
 (0)