Downloading "latest" version of tools

Is there a recommended way to download latest version of tools? Until recently, we’ve been able to do this:

    sonarScannerRepo="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/"
    sonarScannerZip=$(curl -sS ${sonarScannerRepo} | grep '"sonar-scanner-cli-.*linux.zip"' | sed '$s/.*"\(.*\)".*/\1/p;d')
    curl -sS -O ${sonarScannerRepo}/${sonarScannerZip}

to find and download latest version of sonar-scanner-cli for example. But it looks like you’ve changed the repo to an AWS S3 bucket fronted by a JS app which has broken this method. Do you have any suggestions for getting latest version of tools from the new download service?

Thanks in advance!

not pretty, but got something working:

    sonarSourceDownloads="https://binaries.sonarsource.com"
    sonarSourceBucket=$(curl -sSL ${sonarSourceDownloads} | awk -F\' '/BUCKET_URL/{print $2}')
    sonarScannerPath=$(curl -sSL ${sonarSourceBucket}\?prefix=Distribution/sonar-scanner-cli/ | xq -r '.ListBucketResult.Contents[].Key' | grep linux.zip\$ | tail -1)

    curl -sS -O ${sonarSourceDownloads}/${sonarScannerPath}

I’d be interested in whether there’s a more elegant way to do this, perhaps using aws s3? I tried using aws s3 ls ... but getting AWS credentials errors…

Thank you for posting this @lmgray - we just ran into this issue for a GH action we host/use.

I wish sonarsource had a better API to do this that they actually supported.

Hi,

You can download the latest version directly from Maven Central using this link: https://search.maven.org/remote_content?g=org.sonarsource.scanner.cli&a=sonar-scanner-cli&v=LATEST&c=linux&e=zip

1 Like