GithubHelp home page GithubHelp logo

geofflancaster / sonar-quality-gates Goto Github PK

View Code? Open in Web Editor NEW

This project forked from usaa/sonar-quality-gates

0.0 1.0 0.0 148 KB

A Gradle plugin to specify quality gates/profiles on a project and verify gates were passed.

License: Apache License 2.0

Groovy 97.07% Java 2.93%

sonar-quality-gates's Introduction

Sonar Quality Gate Plugin

Build Status Sonar Quality Gate Badge License

This Gradle plugin will use the SonarQube API to verify the state of a given project's quality gate(s).

This plugin requires that you also apply and configure the SonarQube plugin and have SonarQube server version 6.3+.

If the project does not already exist within SonarQube, it will be created.

Version compatibility

Sonar version Plugin Version
6.3+ 3.+
5.6 - 7.0 1.+

Usage:

// build.gradle
buildscript {
  dependencies {
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2.1"
    classpath "com.usaa.plugin.gradle:sonarqube-quality-gates:3.0.0"
  }
}
apply plugin: 'org.sonarqube'
apply plugin: 'sonarqube-quality-gates'

Gradle Tasks

SonarQube Utility tasks
-----------------------
applyQualityGate - Applies SonarQube quality gate to project
applyQualityProfile - Applies SonarQube quality profile to project
verifySonarqubeQualityGates - Verifies no quality gate errors exist for project

Ex) ./gradlew applyQualityGate applyQualityProfile sonarqube verifySonarqubeQualityGates will execute the entire workflow, including the sonar scan.

Optional Configuration:

Any of the following options are available. You can override one or all as required.

sonarqubeQualityGate {
  sleep '1000' // the amount of time to sleep between api calls while scan is queued. Time is in milliseconds. Default: 1000
  maxWait '1800000' // the amount of time to wait for scan to complete before failing. Time is in milliseconds. Default: 1800000 (30min)
  gate 'Sonar way' // override default gate
  profile 'Sonar way' // override default profile
  username ''
  password ''
  apiKey ''
}

Default Settings

sleep '1000'
maxWait '1800000'
gate 'SonarQube way'
profile 'Sonar way'

Permissions

Permissions can be set via the sonarqubeQualityGate closure or via system properties. Note that precedence is important for determining which value is used.

Username

  1. Closure
  2. sonar.quality.username (System Property)

Password

  1. Closure
  2. sonar.quality.password (System Property)

Api Key

  1. Closure
  2. sonar.quality.login (System Property)
  3. sonar.login (System Property)

System properties can be set within the gradle.properties file.

systemProp.sonar.login=<token>

Note: This project is not affiliated in anyway with the SonarQube project.

sonar-quality-gates's People

Contributors

geofflancaster avatar josephndenton avatar usaaopensource avatar

Watchers

James Cloos 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.