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:

    sonarScannerZip=$(curl -sS ${sonarScannerRepo} | grep '"sonar-scanner-cli-.*"' | 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:

    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\$ | 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.


You can download the latest version directly from Maven Central using this link:

1 Like