I’m trying to add my github project to sonarclound, i do all the require step like add new organization, add project and when in the step configure project i get stuck, i do the exactly every step but it still can’t not configure:
I add the SONAR_TOKEN:
i add the SONAR_TOKEN to build.yml file:
I added required sonar-project.properties
But it won’t work, so i use the cli, using this function to add the scanner:
export SONAR_SCANNER_VERSION=4.7.0.2747
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
export SONAR_SCANNER_OPTS="-server"
Use this to add to current project:
sonar-scanner \
-Dsonar.organization=khanh21011999 \
-Dsonar.projectKey=khanh21011999_testUnitTest \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io
But it return this in the terminal
ERROR: You're not authorized to run analysis. No sonar.login or SONAR_TOKEN env variable was set
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.```
Please help, what did i do wrong?