Skip to content

Instantly share code, notes, and snippets.

@RavianXReaver
Last active December 20, 2020 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RavianXReaver/a2e9658e8487b760cb90bfd0026d2537 to your computer and use it in GitHub Desktop.
Save RavianXReaver/a2e9658e8487b760cb90bfd0026d2537 to your computer and use it in GitHub Desktop.
Jenkins pipeline for Sonarqube
pipeline {
agent any
stages {
stage ("SonarQube analysis") {
steps {
script{
withSonarQubeEnv('SonarQube') {
sh "/downloads/sonarqube/sonar-scanner-4.2.0.1873-linux/bin/sonar-scanner " +
"-Dsonar.projectKey=dsadasd " +
"-Dsonar.projectBaseDir=/var/lib/jenkins/workspace/CloudBot-Discord-GitJob " +
"-Dsonar.scanner.metadataFilePath=/var/lib/jenkins/workspace/test2/.scannerwork/report-task.txt " +
"-Dsonar.analysis.mode=publish " +
"-X"
}
}
script {
sleep(10)
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment