Closed eeisenbr closed 1 year ago
There's a couple issues that will prevent this from working with SonarQube 10.x (and anything after). First, the sorting of the releases retrieved from GitHub is using alpha, so 9 will always be higher than 10:
if(!$Version -or ($Version -ieq 'Latest')) { # binaries.sonarsource.com moved to S3 and is not easily searchable anymore. Getting the latest version from GitHub releases. $releasesFromApi = (Invoke-WebRequest -Uri 'https://api.github.com/repos/SonarSource/sonarqube/releases' -UseBasicParsing).Content $releasesPS = $releasesFromApi | ConvertFrom-Json $Version = $releasesPS.Name | Sort-Object -Descending | Select-Object -First 1 Write-Output "Found the latest release to be $Version" }
The code above will always find 9.x as the latest release.
Second, the version comparison in the startup script is alpha, having the same problem of 10 being less than 9:
$sqver = $propFile.FullName.split("\")[4].split("-")[1] log("SQ version: $sqver") if ($sqver -ge 9.6) { log("SQ ver >= 9.6, use env var not wrapper.conf") $Env:SONAR_JAVA_PATH = "$Env:JAVA_HOME\bin\java.exe" log("Set Java exe path env var (SONAR_JAVA_PATH) to: $Env:SONAR_JAVA_PATH") } else { log('SQ ver < 9.6, use wrapper.conf')
$sqver is a string so "10.1" will always be less than "9.6".
I'm facing the exact same problem, due to the inherit problem of sorting or comparing numerical values as strings.
Are pull requests something to consider ?
Facing the exact same issue. It does not pull the Latest 10.2 and I can't define version 10.2 as well when deploying. When deploying add version manually from the https://api.github.com/repos/SonarSource/sonarqube/releases and it works.
But, then again it shows
@jeckyl2010 I am always open to PR submissions.
As I don't use SQ on a daily basis anymore changes are pretty much community driven at this point.
I've submitted a PR for this #86
@caosborn thanks a bunch!
No worries, hope it helps 🙂
There's a couple issues that will prevent this from working with SonarQube 10.x (and anything after). First, the sorting of the releases retrieved from GitHub is using alpha, so 9 will always be higher than 10:
The code above will always find 9.x as the latest release.
Second, the version comparison in the startup script is alpha, having the same problem of 10 being less than 9:
$sqver is a string so "10.1" will always be less than "9.6".