Last active
December 20, 2020 19:13
-
-
Save RavianXReaver/a2e9658e8487b760cb90bfd0026d2537 to your computer and use it in GitHub Desktop.
Jenkins pipeline for Sonarqube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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