I am using Community Edition of Sonarqube.
I very new in sonarqube and gitlab. I need to integration with sonar and gitlab but I am getting this error.
I try to add project from my repository with gitlab CI and Sonarqube gives me .gitlab-ci.yml content.
when I commit .gitlab-ci.yml script I am getting this error.
Hi @tugbaOzturk and welcome to our community
Can you tell me which build technology are you using (Maven, .NET, Gradle, etc)?
From what I understand, the only yml we provide with an apt-get command is the one from .NET. But there is no apt-get install gitlab-runner command in what we provide.
Hello Chiritophe,
Thank you for reply. I am using .NET. Of course i can provide the yml file.
Processing: gitlab-ci.yml…
sonarqube-check:
image: GitHub - microsoft/containerregistry: Microsoft Container Registry description and related FAQ
variables:
SONAR_USER_HOME: “${CI_PROJECT_DIR}/.sonar” # Defines the location of the analysis task cache
GIT_DEPTH: “0” # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: “${CI_JOB_NAME}”
paths:
- .sonar/cache
script:
- sonar.qualitygate.wait=true
- “apt-get update”
- “apt-get install --yes openjdk-11-jre”
- “dotnet tool install --global dotnet-sonarscanner”
- “export PATH=”$PATH:$HOME/.dotnet/tools""
- “dotnet sonarscanner begin /k:“gitlabdeneme_deneme_AXrmxi8qyRN88oGWNdos” /d:sonar.login=”$SONAR_TOKEN" /d:“sonar.host.url=$SONAR_HOST_URL” "
- “dotnet build”
- “dotnet sonarscanner end /d:sonar.login=”$SONAR_TOKEN""
allow_failure: true
only:
- master # or the name of your main branch
I did a bit of research and according to it the default package manager used in CentOS is yum. So, If you change from apt-get to sudo yum, it should solve your problem.
Thank you , I am gonna try to run script with sudo yum.
I get same error also for this line - “dotnet tool install --global dotnet-sonarscanner” (dotnet: command not found)
What should I use for dotnet ? @Caba_Sagi
@tugbaOzturk
It seems to me that you don`t have dotnet installed on the machine. Please take a look at the Microsoft guide for installing dotnet on CentOs.
I have another problem. Now I want to analysis .NET Famwork 4.8 in sonarqube. Our sonarqube and runners are installed linux servers. İs there a way to installsonarscannerfor MSBuild for .NETframework in linux.