diff --git a/images/win/scripts/Installers/Install-AWS.ps1 b/images/win/scripts/Installers/Install-AWS.ps1 index d15d90d5..9c1e8899 100644 --- a/images/win/scripts/Installers/Install-AWS.ps1 +++ b/images/win/scripts/Installers/Install-AWS.ps1 @@ -15,4 +15,4 @@ $env:Path = $env:Path + ";$env:ProgramFiles\Amazon\SessionManagerPlugin\bin" # Install AWS SAM CLI Install-Binary -Url "https://github.com/awslabs/aws-sam-cli/releases/latest/download/AWS_SAM_CLI_64_PY3.msi" -Name "AWS_SAM_CLI_64_PY3.msi" -Invoke-PesterTests -TestFile "Tools" -TestName "AWS" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "AWS" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-AliyunCli.ps1 b/images/win/scripts/Installers/Install-AliyunCli.ps1 index 6172f4bc..025f7f3e 100644 --- a/images/win/scripts/Installers/Install-AliyunCli.ps1 +++ b/images/win/scripts/Installers/Install-AliyunCli.ps1 @@ -17,4 +17,4 @@ Extract-7Zip -Path $aliyunArchivePath -DestinationPath $aliyunPath # Add aliyun-cli to path Add-MachinePathItem $aliyunPath -Invoke-PesterTests -TestFile "Tools" -TestName "AliyunCli" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Aliyun CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-AzureCli.ps1 b/images/win/scripts/Installers/Install-AzureCli.ps1 index ea823a1d..8247956c 100644 --- a/images/win/scripts/Installers/Install-AzureCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureCli.ps1 @@ -10,4 +10,4 @@ New-Item -ItemType "directory" -Path $AzureCliExtensionPath [Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $AzureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine) -Invoke-PesterTests -TestFile "Tools" -TestName "AzureCli" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Azure CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 b/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 index d9757ecc..1c7d1bbf 100644 --- a/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 @@ -5,4 +5,4 @@ az extension add -n azure-devops -Invoke-PesterTests -TestFile "Tools" -TestName "Azure DevOps CLI" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Azure DevOps CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 index 8d6b44d6..65831bd7 100644 --- a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 +++ b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 @@ -22,4 +22,4 @@ Extract-7Zip -Path $CloudFoundryArchPath -DestinationPath $CloudFoundryCliPath # Add cf to path Add-MachinePathItem $CloudFoundryCliPath -Invoke-PesterTests -TestFile "Tools" -TestName "CloudFoundryCli" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "CloudFoundry CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 25ce857d..2a5ea925 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -41,4 +41,4 @@ Choco-Install -PackageName hub Add-MachinePathItem "C:\Program Files\Git\bin" Invoke-PesterTests -TestFile "Git" -TestName "Git" -Invoke-PesterTests -TestFile "Git" -TestName "Hub" +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI" diff --git a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 index 98cc5149..7891991d 100644 --- a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 +++ b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 @@ -7,4 +7,4 @@ Choco-Install -PackageName gh Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI" -Invoke-PesterTests -TestFile "Tools" -TestName "GitHub-CLI" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "GitHub CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 deleted file mode 100644 index f1913088..00000000 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ /dev/null @@ -1,78 +0,0 @@ -################################################################################ -## File: Install-SQLExpress.ps1 -## Desc: Install SQL Express for Windows -################################################################################ -Import-Module -Name ImageHelpers -Force; - -function Download-FullSQLPackage { - param( - [String]$InstallerPath, - [String]$DownloadPath, - [String]$Arguments = ("/MEDIAPATH=$DownloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") - ) - Write-Host "Downloading full package to $DownloadPath..." - $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode - if ($exitCode -eq 0) - { - Write-Host -Object "Full SQL Express package has been successfully downloaded to $DownloadPath : ExitCode: $exitCode" - } - else - { - Write-Host -Object "Full package downloading process was unsuccessful. Exit code: $exitCode." - exit $exitCode - } -} - -function Unpack-SQLInstaller { - param( - [String]$InstallPath, - [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") - ) - Write-Host "Start unpacking procedure to $InstallPath..." - $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode -# Exit code -2067529716 is added since SQL Unpack procedure returns it on success. - if ($exitCode -eq 0 -or $exitCode -eq -2067529716) - { - Write-Host -Object "SQL installer unpacking has been completed." - } - else - { - Write-Host -Object "SQL installer unpacking was interrupted : $exitCode." - exit $exitCode - } -} - -function Start-Installer { - param( - [String]$InstallerPath, - [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") - ) - Write-Host "Installating SQL Express..." - $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode - if ($exitCode -eq 0) - { - Write-Host -Object "SQL Express has been successfully installed: ExitCode: $exitCode" - } - else - { - Write-Host -Object "Installation procedure was not correctly completed. Exit code: $exitCode." - exit $exitCode - } -} -#Main function -$installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" -$downloadPath = "C:\SQLInstall" -$setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" -#Create directory for temporary files -New-Item -Path $downloadPath -ItemType Directory -Set-Location -Path $downloadPath -$installerPath = Start-DownloadWithRetry -Url $installerUrl -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" -Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath -Unpack-SQLInstaller -InstallPath "$setupPath.exe" -$resultPath = Join-Path $setupPath "SETUP.exe" -Start-Installer -InstallerPath $resultPath -#Cleanup folder with installation packages. -Remove-Item $downloadPath -Recurse -Force diff --git a/images/win/scripts/Installers/Validate-AzureCli.ps1 b/images/win/scripts/Installers/Validate-AzureCli.ps1 deleted file mode 100644 index 9c801f0b..00000000 --- a/images/win/scripts/Installers/Validate-AzureCli.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -################################################################################ -## File: Validate-AzureCli.ps1 -## Desc: Validate Azure CLI -################################################################################ - -if (Get-Command -Name 'az') -{ - Write-Host "Azure Cli $(az --version) on path" -} -else -{ - Write-Error "Azure Cli not on path" - exit 1 -} - diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 deleted file mode 100644 index c1f32eca..00000000 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -################################################################################ -## File: Validate-SQLExpress.ps1 -## Desc: Validate Microsoft SQL Express installation -################################################################################ - -#Parameters for database access -$sqlUser = "sa" -$sqlPassword = "P@ssword!!" -$sqlInstance = "SQL2019" - -function Test-SqlConnection { - param( - [Parameter(Mandatory)] - [string]$ServerName, - [Parameter(Mandatory)] - [string]$IntegratedSecurity, - [Parameter(Mandatory)] - [string]$UserName, - [Parameter(Mandatory)] - [string]$Password - ) - $ErrorActionPreference = 'Stop' - try { - $connectionString = 'Server={0};Integrated Security={1};User ID={2};Password={3}' -f $ServerName,$IntegratedSecurity,$UserName,$Password - $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString - $sqlConnection.Open() - Write-Host -Object "Connection to SQL Express was successful." - } catch { - Write-Host -Object "Connection to SQL Express cannot be established." - exit 1 - - } finally { - ## Close the connection when we're done - $sqlConnection.Close() - } -} - -$instanceName = "$env:computername\$sqlInstance" -Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName $sqlUser -Password $sqlPassword - diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Databases.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Databases.psm1 index b95198eb..86c58bc1 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Databases.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Databases.psm1 @@ -6,16 +6,17 @@ function Get-PostgreSQLMarkdown $pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "") $env:Path += ";${env:PGBIN}" $pgVersion = (postgres --version).split()[2].Trim() - $content = [PSCustomObject]@{ - Version = $pgVersion - UserName = $env:PGUSER - Password = $env:PGPASSWORD - EnvironmentVariables = "PGBIN=$env:PGBIN;
PGDATA=$env:PGDATA;
PGROOT=$env:PGROOT" - Path = $pgRoot - ServiceName = $pgService.Name - ServiceStatus = $pgService.State - ServiceStartType = $pgService.StartMode - } | New-MDTable + + $content = @( + [PSCustomObject]@{ Property = "ServiceName"; Value = $pgService.Name }, + [PSCustomObject]@{ Property = "Version"; Value = $pgVersion }, + [PSCustomObject]@{ Property = "ServiceStatus"; Value = $pgService.State }, + [PSCustomObject]@{ Property = "ServiceStartType"; Value = $pgService.StartMode }, + [PSCustomObject]@{ Property = "EnvironmentVariables"; Value = "`PGBIN=$env:PGBIN`
`PGDATA=$env:PGDATA`
`PGROOT=$env:PGROOT` " }, + [PSCustomObject]@{ Property = "Path"; Value = $pgRoot }, + [PSCustomObject]@{ Property = "UserName"; Value = $env:PGUSER }, + [PSCustomObject]@{ Property = "Password"; Value = $env:PGPASSWORD } + ) | New-MDTable Build-MarkdownElement -Head $name -Content $content } diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index a9968f8c..7fefbf79 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -70,6 +70,7 @@ $markdown += New-MDList -Style Unordered -Lines @( $markdown += New-MDHeader "Tools" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-AzCosmosDBEmulatorVersion), + (Get-AzCopyVersion), (Get-BazelVersion), (Get-BazeliskVersion), (Get-CMakeVersion), @@ -78,6 +79,7 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-DockerComposeVersion), (Get-GitVersion), (Get-GitLFSVersion), + (Get-GoogleCloudSDKVersion), (Get-InnoSetupVersion), (Get-JQVersion), (Get-KubectlVersion), @@ -105,7 +107,6 @@ $markdown += New-MDList -Style Unordered -Lines @( $markdown += New-MDHeader "CLI Tools" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-AzureCLIVersion), - (Get-AzCopyVersion), (Get-AzureDevopsExtVersion), (Get-AWSCLIVersion), (Get-AWSSAMVersion), @@ -113,7 +114,7 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-AlibabaCLIVersion), (Get-CloudFoundryVersion), (Get-HubVersion), - (Get-GoogleCloudSDKVersion) + (Get-GHVersion) ) $markdown += New-MDHeader "Rust Tools" -Level 3 diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 2dc90306..ce3ca0fd 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -220,4 +220,8 @@ function Get-GoogleCloudSDKVersion { function Get-NewmanVersion { return "Newman $(newman --version)" +} + +function Get-GHVersion { + return "GitHub CLI $(gh --version)" } \ No newline at end of file diff --git a/images/win/scripts/Tests/CLI.Tools.Tests.ps1 b/images/win/scripts/Tests/CLI.Tools.Tests.ps1 new file mode 100644 index 00000000..d230fcfc --- /dev/null +++ b/images/win/scripts/Tests/CLI.Tools.Tests.ps1 @@ -0,0 +1,56 @@ + +Describe "Azure CLI" { + It "Azure CLI" { + "az --version" | Should -ReturnZeroExitCode + } +} + +Describe "Azure DevOps CLI" { + It "az devops" { + "az devops -h" | Should -ReturnZeroExitCode + } +} + +Describe "Aliyun CLI" { + It "Aliyun CLI" { + "aliyun version" | Should -ReturnZeroExitCode + } +} + + +Describe "AWS" { + It "AWS CLI" { + "aws --version" | Should -ReturnZeroExitCode + } + + It "Session Manager Plugin for the AWS CLI" { + session-manager-plugin | Out-String | Should -Match "plugin was installed successfully" + } + + It "AWS SAM CLI" { + "sam --version" | Should -ReturnZeroExitCode + } +} + + +Describe "GitHub CLI" { + It "gh" { + "gh --version" | Should -ReturnZeroExitCode + } +} + +Describe "CloudFoundry CLI" { + It "cf is located in C:\cf-cli" { + "C:\cf-cli\cf.exe" | Should -Exist + } + + It "cf" { + "cf --version" | Should -ReturnZeroExitCode + } +} + +Describe "Hub CLI" { + It "hub is installed" { + "hub --version" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/win/scripts/Tests/Git.Tests.ps1 b/images/win/scripts/Tests/Git.Tests.ps1 index 97100e78..8dd159fa 100644 --- a/images/win/scripts/Tests/Git.Tests.ps1 +++ b/images/win/scripts/Tests/Git.Tests.ps1 @@ -24,12 +24,6 @@ Describe "Git" { } } -Describe "Hub" { - It "hub is installed" { - "hub --version" | Should -ReturnZeroExitCode - } -} - Describe "GitVersion" { It "gitversion is installed" { "gitversion /version" | Should -ReturnZeroExitCode diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index fe3343cf..22d17b7e 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -6,26 +6,6 @@ Describe "7-Zip" { } } -Describe "AliyunCli" { - It "AliyunCli" { - "aliyun version" | Should -ReturnZeroExitCode - } -} - -Describe "AWS" { - It "AWS CLI" { - "aws --version" | Should -ReturnZeroExitCode - } - - It "Session Manager Plugin for the AWS CLI" { - session-manager-plugin | Out-String | Should -Match "plugin was installed successfully" - } - - It "AWS SAM CLI" { - "sam --version" | Should -ReturnZeroExitCode - } -} - Describe "AzCopy" { It "AzCopy" { "azcopy --version" | Should -ReturnZeroExitCode @@ -46,18 +26,6 @@ Describe "Azure Cosmos DB Emulator" { } } -Describe "AzureCli" { - It "AzureCli" { - "az --version" | Should -ReturnZeroExitCode - } -} - -Describe "Azure DevOps CLI" { - It "az devops" { - "az devops -h" | Should -ReturnZeroExitCode - } -} - Describe "Bazel" { It "" -TestCases @( @{ ToolName = "bazel" } @@ -162,22 +130,6 @@ Describe "InnoSetup" { } } -Describe "GitHub-CLI" { - It "gh" { - "gh --version" | Should -ReturnZeroExitCode - } -} - -Describe "CloudFoundryCli" { - It "cf is located in C:\cf-cli" { - "C:\cf-cli\cf.exe" | Should -Exist - } - - It "cf" { - "cf --version" | Should -ReturnZeroExitCode - } -} - Describe "GoogleCouldSDK" { It "" -TestCases @( @{ ToolName = "bq" }