# Sonarqube and gitlab integration error

**URL:** <https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462>\
**Category:** SonarQube Server / Community Build\
**Tags:** csharp, gitlab, sonarqube\
**Created:** [August 3, 2021, 6:04am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462 "2021-08-03T06:04:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![tugbaOzturk](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@tugbaOzturk](https://community.sonarsource.com/u/tugbaOzturk)\
**Post date:** [August 3, 2021, 6:04am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/1 "2021-08-03T06:04:41Z")

</div>

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.

Please help me.  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/1/c/1cf0c1da32c9a89b156364ce45a99a9247fe8405.png)

---

<div class="post-metadata">

**Author:** ![Christophe\_Havard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/christophe_havard/32/12373_2.png) [@Christophe\_Havard](https://community.sonarsource.com/u/Christophe_Havard)\
**Post date:** [August 5, 2021, 6:47am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/4 "2021-08-05T06:47:45Z")

</div>

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.

Can you provide us the yml file you use?

Thanks.  
Kind regards,  
Christophe

---

<div class="post-metadata">

**Author:** ![tugbaOzturk](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@tugbaOzturk](https://community.sonarsource.com/u/tugbaOzturk)\
**Post date:** [August 11, 2021, 3:04pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/5 "2021-08-11T15:04:32Z")

</div>

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](http://mcr.microsoft.com/dotnet/core/sdk:latest)  
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

---

<div class="post-metadata">

**Author:** ![Caba\_Sagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/caba_sagi/32/17409_2.png) [@Caba\_Sagi](https://community.sonarsource.com/u/Caba_Sagi)\
**Post date:** [October 8, 2021, 12:55pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/8 "2021-10-08T12:55:38Z")

</div>

Hello @tugbaOzturk

Could you please share with us what operating system are you using? I assume that apt-get is not installed on your OS.

---

<div class="post-metadata">

**Author:** ![tugbaOzturk](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@tugbaOzturk](https://community.sonarsource.com/u/tugbaOzturk)\
**Post date:** [October 12, 2021, 11:05am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/9 "2021-10-12T11:05:28Z")

</div>

Hello, @Caba_Sagi @Christophe_Havard  
I am using linux centos for my runner and and gitlab.  
Is there any way convert this script for linux centos ?

Thank you for your reply.

---

<div class="post-metadata">

**Author:** ![Caba\_Sagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/caba_sagi/32/17409_2.png) [@Caba\_Sagi](https://community.sonarsource.com/u/Caba_Sagi)\
**Post date:** [October 12, 2021, 12:00pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/10 "2021-10-12T12:00:47Z")

</div>

@tugbaOzturk

I did a bit of research and according to it the [default package manager](https://wiki.centos.org/PackageManagement/Yum) used in CentOS is yum. So, If you change from apt-get to sudo yum, it should solve your problem.

---

<div class="post-metadata">

**Author:** ![tugbaOzturk](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@tugbaOzturk](https://community.sonarsource.com/u/tugbaOzturk)\
**Post date:** [October 13, 2021, 9:19am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/11 "2021-10-13T09:19:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Caba\_Sagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/caba_sagi/32/17409_2.png) [@Caba\_Sagi](https://community.sonarsource.com/u/Caba_Sagi)\
**Post date:** [October 13, 2021, 9:52am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/12 "2021-10-13T09:52:27Z")

</div>

@tugbaOzturk  
It seems to me that you don`t have dotnet installed on the machine. Please take a look at the Microsoft [guide](https://docs.microsoft.com/en-us/dotnet/core/install/linux-centos) for installing dotnet on CentOs.

---

<div class="post-metadata">

**Author:** ![Caba\_Sagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/caba_sagi/32/17409_2.png) [@Caba\_Sagi](https://community.sonarsource.com/u/Caba_Sagi)\
**Post date:** [October 21, 2021, 1:42pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/13 "2021-10-21T13:42:34Z")

</div>

Hello @tugbaOzturk

Did you manage to make it work?

---

<div class="post-metadata">

**Author:** ![Pinar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/pinar/32/43454_2.png) [@Pinar](https://community.sonarsource.com/u/Pinar)\
**Post date:** [December 25, 2022, 4:17pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/14 "2022-12-25T16:17:33Z")

</div>

Hello I am getting same error. I installed dotnet on machine.  
Do you have any advice for this.

---

<div class="post-metadata">

**Author:** ![P\_S](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/p_s/32/29895_2.png) [@P\_S](https://community.sonarsource.com/u/P_S)\
**Post date:** [December 26, 2022, 10:21am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/15 "2022-12-26T10:21:09Z")

</div>

Hi,  
Can you also share the error log?

---

<div class="post-metadata">

**Author:** ![Caba\_Sagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/caba_sagi/32/17409_2.png) [@Caba\_Sagi](https://community.sonarsource.com/u/Caba_Sagi)\
**Post date:** [January 2, 2023, 12:24pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/16 "2023-01-02T12:24:49Z")

</div>

Hello @Pinar and welcome to our community.

Can you share some more information? What OS are you using? Did you manage to install dotnet?

---

<div class="post-metadata">

**Author:** ![Pinar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/pinar/32/43454_2.png) [@Pinar](https://community.sonarsource.com/u/Pinar)\
**Post date:** [March 24, 2023, 10:05am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/17 "2023-03-24T10:05:11Z")

</div>

Thanks for your interest. I did it. The problem was because of server which have runner.

---

<div class="post-metadata">

**Author:** ![Pinar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/pinar/32/43454_2.png) [@Pinar](https://community.sonarsource.com/u/Pinar)\
**Post date:** [March 24, 2023, 10:08am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/18 "2023-03-24T10:08:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [March 24, 2023, 11:43am UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/19 "2023-03-24T11:43:45Z")

</div>

Hi @Pinar,

A new question deserves a new thread.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![Pinar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/pinar/32/43454_2.png) [@Pinar](https://community.sonarsource.com/u/Pinar)\
**Post date:** [March 24, 2023, 12:00pm UTC](https://community.sonarsource.com/t/sonarqube-and-gitlab-integration-error/47462/20 "2023-03-24T12:00:37Z")

</div>

Surely. Thanks @ganncamp
