Skip to content

Commit

Permalink
Fix jq version evaluation (#866)
Browse files Browse the repository at this point in the history
* Update

* UpdateTestCase

* Update

* Update
  • Loading branch information
Jefajers committed Mar 21, 2024
1 parent fcc716c commit c37e9fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions scripts/UpdateRequiredModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ $existingmodule = @()
$newmodule = @()
$updated = $false
$data.RequiredModules | ForEach-Object {
$moduleVersion = $_.RequiredVersion
[int]$moduleVersionInt = $moduleVersion.Replace('.',',')
$galleryVersion = (Find-Module -Name $_.ModuleName).Version
[int]$galleryVersionInt = $galleryVersion.Replace('.',',')
if ($moduleVersionInt -lt $galleryVersionInt) {
$moduleVersion = New-Object System.Version($_.RequiredVersion)
$galleryVersion = New-Object System.Version((Find-Module -Name $_.ModuleName).Version)
if ($moduleVersion -lt $galleryVersion) {
$newmodule = @{
"ModuleName" = $_.ModuleName
"RequiredVersion" = $galleryVersion
Expand Down
6 changes: 3 additions & 3 deletions src/internal/functions/Assert-AzOpsJqDependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

process {
Write-AzOpsMessage -LogLevel InternalComment -LogString 'Assert-AzOpsJqDependency.Validating'

$minVersion = New-Object System.Version("1.6")
$result = (Invoke-AzOpsNativeCommand -ScriptBlock { jq --version } -IgnoreExitcode)
$installed = $result -as [bool]

if ($installed) {
[double]$version = ($result).Split("-")[1]
if ($version -ge 1.6) {
$version = New-Object System.Version(($result).Split("-")[1])
if ($version -ge $minVersion) {
Write-AzOpsMessage -LogLevel InternalComment -LogString 'Assert-AzOpsJqDependency.Success'
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"name": "[parameters('publicIPAddressesName')]",
"location": "northeurope",
"sku": {
"name": "Basic",
"name": "Standard",
"tier": "Regional"
},
"properties": {
"ipAddress": "20.219.217.108",
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"publicIPAllocationMethod": "Static",
"idleTimeoutInMinutes": 4,
"dnsSettings": {
"domainNameLabel": "[parameters('publicIPAddressesName')]",
Expand Down

0 comments on commit c37e9fd

Please sign in to comment.