i was not able to fix this issue using CustomTool plugin, so the solution was to get rid of it, and create a dedicated jenkins job to install/update the SonarQube build wrapper tool.
In case it can help, find below an excerpt of the pipeline code, which relies on File Operations && Pipeline Utility Steps plugins so that it is OS agnostic (windows & unix).
This should be wrapped within a Pipeline job taking as parameter a string "InstallOnLabel". Each node has a property "SONAR_BUILDWRAPPER_HOME" defining installation folder.
[parameters([string(defaultValue: 'sonar', name: 'InstallOnLabel')])] // will execute on all nodes having label
)
def nodes = nodesByLabel label: "${InstallOnLabel}"
nodes = nodes.sort()
Map tasks = [:]
for (int i = 0; i < nodes.size(); i++) {
def label = nodes[i]
tasks[label] = {
node(label) {
stage(label) {
stage("Install") {
withSonarQubeEnv('sonarqube-prod') {
_hostflavor = isUnix() ? "linux" : "win"
_bwDlUrl = "${env.SONAR_HOST_URL}/static/cpp/build-wrapper-${_hostflavor}-x86.zip"
echo "[INFO] Installing SonarQube ${_hostflavor} build-wrapper into ${env.SONAR_BUILDWRAPPER_HOME}/bin"
echo "[INFO] Downloading from ${_bwDlUrl}"
fileOperations([
folderDeleteOperation(folderPath: "${env.SONAR_BUILDWRAPPER_HOME}"),
folderCreateOperation(folderPath: "${env.SONAR_BUILDWRAPPER_HOME}"),
fileDownloadOperation(url: "${_bwDlUrl}", targetFileName: 'build-wrapper-x86.zip', targetLocation: ".", userName: "", password: ""),
fileUnZipOperation(filePath: 'build-wrapper-x86.zip', targetLocation: "${env.SONAR_BUILDWRAPPER_HOME}"),
folderRenameOperation(source: "${env.SONAR_BUILDWRAPPER_HOME}/build-wrapper-${_hostflavor}-x86", destination: "${env.SONAR_BUILDWRAPPER_HOME}/bin"),
])
}
}
stage("Validate") {
if (isUnix()) {
sh '''
set +e
ls -Rl ${SONAR_BUILDWRAPPER_HOME}
build-wrapper-linux-x86-64
(( $? == 10 )) && exit 0
'''
} else {
bat '''
dir /s "%SONAR_BUILDWRAPPER_HOME%"
build-wrapper-win-x86-64
if ERRORLEVEL 1 ( exit /b 0 )
exit /b 1
'''
}
}
}
}
}
}
timeout(time: 5, unit: 'MINUTES') {
parallel(tasks)
}