Code Monkey home page Code Monkey logo

sonarqube-fetch-qualitygate-status's Introduction

Get SonarQube Project Quality Gate Status

It is always recommended that you maintain a certain quality of software. There are many tools available in the market for static code analysis. One of the most widely tools is SonarQube. This PowerShell script can be used to get the SonarQube quality gate rating, once the code analysis is complete for a Sonar Project. If the Quality Gate status is not OK, it throws an exception.

This script can be run standalone or used as part of Continuous Integration Process to determine if the code committted pass throgh the criteria defined. If not, it can be used to fail the builld.

Getting Started

These instructions will allow you to run the PowerShell script. This script uses the basic cmdlets which are available from PowerShell version 3.0 or later.

Prerequisites

  • You need to have your own SonarQube Server and it should be accessible from the build agent.
  • You need to have PowerShell installed on the build agent.

Parameters

  • SonarToken - This is a token which belongs to one of the user accounts in the SonarQube which has access to the Sonar Project referred.
  • SonarProjectKey - This key is used to uniquely identify a Sonar Project
  • SonarServerName - This is the fully qualified domain name or DNS name of the Sonar Server. It needs to be accessible from the build agent.

Examples

  • Example 1:
    .\get-sonarqube-quality-gate-status.ps1 -SonarServerName "my-sonar-server-name.fqdn.com" -SonarProjectKey "teraVis-App-CI" -SonarToken "c501b24d-e00a-44cb-b67d-4e6465a8c255"

    In this case, it will return the status of the SonarProject associated with the Sonar Project Key.

  • Example 2:
    $SonarServerName = "my-sonar-server-name.fqdn.com"
    $SonarProjectKey = "teraVis-App-CI"
    $SonarToken = "c501b24d-e00a-44cb-b67d-4e6465a8c255"

    .\get-sonarqube-quality-gate-status.ps1 -SonarServerName $(SonarServerName) -SonarProjectKey $(SonarProjectKey) -SonarToken $(SonarToken)

    In this case, it will return the status of the SonarProject associated with the Sonar Project Key.

sonarqube-fetch-qualitygate-status's People

Contributors

goyalmohit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.