Options to integrate gitlab with Sonarqube 7.9 version ( Project is Javascript/ReactJs project)

  • SonarQube version 7.9 (community editions) and sonar-project.properties file created in project folder
  • Showing my team sonarqube benefits and suggesting to start using it
  • I have setup SonarQube server running at some IP:9000 port and it’s not public ip.

Faced challenges how to integrate with gitlab and with only one branch and add it as part of gitlab-ci

Currently my gitlab-ci.yml has this type of pipeline already run.

variables:
SOME_VARIABLES: clone

stages:

  • setup
  • test

Deploy review:
stage: setup
script:
- echo “Deploying a review app”
environment:
name: review/xyz
url: xyz
only: [merge_requests]
except:
- master

Check code formatting:
stage: test
only: [merge_requests]
script:

  • npm ci
  • npm run-script check-format

Lint:
stage: test
only: [merge_requests]
script:

  • npm ci
  • npm run-script lint – --quiet && npm run-script lint

Unittest branch:
stage: test
only: [merge_requests]
except:
refs:
- master
script:

  • npm ci
  • git merge --no-commit remotes/origin/xyz && git status
  • npm run-script test-ci
    artifacts:
    when: always
    reports:
    junit: artifact/junit.xml
    expire_in: 1 week

Verify master:
stage: test
only:
refs:
- master
script:

  • npm ci
  • npm run-script check-format
  • npm run-script lint – --quiet && npm run-script lint
  • npm run-script test-ci
    artifacts:
    when: always
    reports:
    junit: artifact/junit.xml
    expire_in: 1 week

Hi,

Welcome to the community!

Have you seen these docs?

https://docs.sonarqube.org/latest/analysis/gitlab-cicd/

 
Ann