Feature List
  • 8.x
    • Team Feature
      • Data-Prep Features
      • Pipeline Features
        • What's New Window Pop-up
        • Failure Db-Sync
        • Testing for Kafka 3.1.0
        • Python 3.10 R&D
        • Job History
        • SPC (Single Page for Configuration)
        • Python Jobs
        • Failure Alerts
        • Event Channel Alerts
        • Pipeline Error handling
        • Pipeline : PySpark Component (PySpark Job)
      • Dashboard Charting
        • Widget as component
        • Knowledge Graph Chart
          • Sample Library based code
        • Word Cloud
        • Tile component
        • Sankey Chart
        • Model as API Connector
        • Dataprep recipe in Dataset selection
        • Decomposition Enhancment
      • Python Upgrade
        • Core Platform : Data Services
        • Core Platform : Data Catalog
        • Core Platform : Data Center
        • Data Science Lab
      • Sonar Code Scan automation by DevOps
      • DS Lab PySpark Project.
      • Core Platform
        • Tag Feature For Data Connector , Dataset , DataStore etc..
        • DataStore & Metadatastore Migration
        • MongoDB & ClickHouse Support For DataSheet
        • Data As API WorkBench
        • Pagination in Home , DataCenter , Dataset , DataStore etc..
        • Sharing Data Connector & Data Set with View or Edit Permission.
        • Core Monitoring & Alerting
      • Data Science Lab
        • Auto Forecasting Requirements
          • User Input
          • Forecasting Method
          • Explainability
        • DSLAB Sprint May1-2023-May12-2023
        • DS LAB Sprint Apr10-Apr21
        • Provide Static Variables for DSLAB Component In AutoML
        • Scheduler For DSLAB Scripts
        • Optimisation of Model Explainability code
    • QA
    • DevOps
Powered by GitBook
On this page
  1. 8.x
  2. Team Feature

Sonar Code Scan automation by DevOps

Every commit need to be scanned and report need to be attached, so that the person who is merging the code can see the code quality and unit test coverage and take a decision.

Who will work on this

  • DevOps need to Setup Sonar and configure

  • Integration with Sonar and Gitlab

To enable the integration of SonarQube scan reports with GitLab merge requests, you can follow these steps:

  1. Make sure that you have a SonarQube server set up and running, and that you have integrated it with your code repository in GitLab.

  2. In GitLab, go to your project's settings and navigate to the "CI/CD" section.

  3. Under "General pipelines settings", make sure that the "Git strategy" is set to "Merge request rebase".

  4. Under "Variables", create a new variable named "SONAR_TOKEN" and set its value to your SonarQube authentication token. This token should have permission to access the SonarQube project associated with your code repository.

  5. In your project's root directory, create a .gitlab-ci.yml file with the following contents:

// Some code
stages:
  - sonarqube

sonarqube:
  image: sonarsource/sonar-scanner-cli
  stage: sonarqube
  script:
    - sonar-scanner
  allow_failure: true
  only:
    - merge_requests

This YAML configuration file sets up a job named sonarqube that runs the SonarQube scanner on merge requests, using the sonarsource/sonar-scanner-cli Docker image. The only keyword ensures that the job is only run on merge requests, and the allow_failure keyword ensures that the job does not fail the pipeline if the SonarQube scan fails.

  1. Save and commit the .gitlab-ci.yml file to your Git repository.

  2. Create a new merge request in GitLab and ensure that the pipeline runs successfully. Once the pipeline is complete, you should see a "SonarQube" widget on the merge request page, displaying the results of the SonarQube scan.

By following these steps, you can enable the integration of SonarQube scan reports with GitLab merge requests, allowing you to track code quality and potential issues more effectively as part of your code review process

PreviousData Science LabNextDS Lab PySpark Project.

Last updated 2 years ago