-
Notifications
You must be signed in to change notification settings - Fork 53
feat: requirements #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: requirements #279
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| function Test-Tooling { | ||
| $checkResults = @() | ||
| $hasFailure = $false | ||
|
|
||
| # Check if PowerShell is the correct version | ||
| Write-Verbose "Checking PowerShell version" | ||
| $powerShellVersionTable = $PSVersionTable | ||
| $powerShellVersion = $powerShellVersionTable.PSVersion.ToString() | ||
| if ($powerShellVersionTable.PSVersion.Major -lt 7) { | ||
| $checkResults += @{ | ||
| message = "PowerShell version $powerShellVersion is not supported. Please upgrade to PowerShell 7.4 or higher. Either switch to the `pwsh` prompt or follow the instructions here: https://aka.ms/install-powershell" | ||
| result = "Failure" | ||
| } | ||
| $hasFailure = $true | ||
| } elseif ($powerShellVersionTable.PSVersion.Major -eq 7 -and $powerShellVersionTable.PSVersion.Minor -lt 4) { | ||
| $checkResults += @{ | ||
| message = "PowerShell version $powerShellVersion is not supported. Please upgrade to PowerShell 7.4 or higher. Either switch to the `pwsh` prompt or follow the instructions here: https://aka.ms/install-powershell" | ||
| result = "Failure" | ||
| } | ||
| $hasFailure = $true | ||
| } else { | ||
| $checkResults += @{ | ||
| message = "PowerShell version $powerShellVersion is supported." | ||
| result = "Success" | ||
| } | ||
| } | ||
|
|
||
| # Check if Git is installed | ||
| Write-Verbose "Checking Git installation" | ||
| $gitPath = Get-Command git -ErrorAction SilentlyContinue | ||
| if ($gitPath) { | ||
| $checkResults += @{ | ||
| message = "Git is installed." | ||
| result = "Success" | ||
| } | ||
| } else { | ||
| $checkResults += @{ | ||
| message = "Git is not installed. Follow the instructions here: https://git-scm.com/downloads" | ||
| result = "Failure" | ||
| } | ||
| $hasFailure = $true | ||
| } | ||
|
|
||
| # Check if Azure CLI is installed | ||
| Write-Verbose "Checking Azure CLI installation" | ||
| $azCliPath = Get-Command az -ErrorAction SilentlyContinue | ||
| if ($azCliPath) { | ||
| $checkResults += @{ | ||
| message = "Azure CLI is installed." | ||
| result = "Success" | ||
| } | ||
| } else { | ||
| $checkResults += @{ | ||
| message = "Azure CLI is not installed. Follow the instructions here: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli" | ||
| result = "Failure" | ||
| } | ||
| $hasFailure = $true | ||
| } | ||
|
|
||
| # Check if Azure CLI is logged in | ||
| Write-Verbose "Checking Azure CLI login status" | ||
| $azCliAccount = $(az account show -o json) | ConvertFrom-Json | ||
| if ($azCliAccount) { | ||
| $checkResults += @{ | ||
| message = "Azure CLI is logged in. Tenant ID: $($azCliAccount.tenantId), Subscription: $($azCliAccount.name) ($($azCliAccount.id))" | ||
| result = "Success" | ||
| } | ||
| } else { | ||
| $checkResults += @{ | ||
| message = "Azure CLI is not logged in. Please login to Azure CLI using 'az login -t `"00000000-0000-0000-0000-000000000000}`"', replacing the empty GUID with your tenant ID." | ||
| result = "Failure" | ||
| } | ||
| $hasFailure = $true | ||
| } | ||
|
|
||
| # Check if latest ALZ module is installed | ||
| Write-Verbose "Checking ALZ module version" | ||
| $alzModuleCurrentVersion = Get-InstalledModule -Name ALZ | ||
| $alzModuleLatestVersion = Find-Module -Name ALZ | ||
| if ($alzModuleCurrentVersion.Version -lt $alzModuleLatestVersion.Version) { | ||
| $checkResults += @{ | ||
| message = "ALZ module is not the latest version. Your version: $($alzModuleCurrentVersion.Version), Latest version: $($alzModuleLatestVersion.Version). Please update to the latest version using 'Update-Module ALZ'." | ||
| result = "Failure" | ||
| } | ||
| $hasFailure = $true | ||
| } else { | ||
| $checkResults += @{ | ||
| message = "ALZ module is the latest version ($($alzModuleCurrentVersion.Version))." | ||
| result = "Success" | ||
| } | ||
| } | ||
|
|
||
| Write-Verbose "Showing check results" | ||
| $checkResults | ForEach-Object {[PSCustomObject]$_} | Format-Table -Property @{ | ||
| Label = "Check Result"; Expression = { | ||
| switch ($_.result) { | ||
| 'Success' { $color = "92"; break } | ||
| 'Failure' { $color = "91"; break } | ||
| default { $color = "0" } | ||
| } | ||
| $e = [char]27 | ||
| "$e[${color}m$($_.result)${e}[0m" | ||
| } | ||
| }, @{ Label = "Check Details"; Expression = {$_.message} } -AutoSize -Wrap | ||
|
|
||
| if($hasFailure) { | ||
| Write-InformationColored "Accelerator software requirements have no been met, please review and install the missing software." -ForegroundColor Red -InformationAction Continue | ||
| Write-InformationColored "Cannot continue with Deployment..." -ForegroundColor Red -InformationAction Continue | ||
| throw "Accelerator software requirements have no been met, please review and install the missing software." | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.