Gitlab integration with SonarQube

后端 未结 5 939
醉酒成梦
醉酒成梦 2021-01-30 14:50

I am pretty new to Development community and specifically to DevOps practices , as a part of project we are trying to integrate SonarQube with Gitlab , did some R& D on Sona

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 15:19

    I was into same requirement and here is how I implemented,

    Create a runner without specifying any tags and of shared type. Create a file .gitlab-ci.yml file with the following commands,

    variables:
      SONAR_URL: "http://your_sonar_url"
      SONAR_LOGIN: "sonar_user_id"
      SONAR_PASSWORD: "sonar_password"
    
    sonarqube_master_job:
      stage: test
      only:
        - master
      image: maven:3.3.9-jdk-8-alpine
      script:
        - mvn --batch-mode verify sonar:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD
    

    If you create runner with specific tags, then you need to mention the tags in the .gitlab-ci.yml file

    you can get more information on adding tags in this link, https://forum.gitlab.com/t/activated-specific-runner-is-not-working/7002

提交回复
热议问题