Last active
May 30, 2023 20:58
-
-
Save wilbit/4eba5b9bbf9dced260fdde7e8242964c to your computer and use it in GitHub Desktop.
It removes sonar.branch.name property in Azure Pipeline. Put it somewhere between your SonarQubePrepare and SonarQubeAnalyze tasks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- powershell: | | |
$params = "$env:SONARQUBE_SCANNER_PARAMS" -replace '"sonar.branch.name":"[\w/,-.]*"\,?' | |
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_PARAMS]$params" |
@ElaineBSchwaner , for Mac agent you better use @dasMulli 's version for Bash shell
The final version looks like this
- bash: |
FILTERED_PARAMS=$(echo $SONARQUBE_SCANNER_PARAMS | sed 's/"sonar.branch.name":"[\w/,-.]*"\,//g')
echo "##vso[task.setvariable variable=SONARQUBE_SCANNER_PARAMS]$FILTERED_PARAMS"
displayName: Filter out non-CE sonar parameters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, @wilbit,
How can I use this with Mac agent?
I tried and the error was:
/Users/runner/work/_temp/ebba7608-9021-4e4f-9953-4dd7bc559b34.sh: line 1: =: command not found
/Users/runner/work/_temp/ebba7608-9021-4e4f-9953-4dd7bc559b34.sh: line 2: Write-Host: command not found