--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAD9wyxEpf977L%3DxpzxaBZ0qMqOPO2CDQDEym7ue8MUGimhM2sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. If you are not using the 'withSonarQubeEnv' wrapper to run your analysis, you have to pass the attributes manually to this step.
at org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.processStepParameters(WaitForQualityGateStep.java:127)
at org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.start(WaitForQualityGateStep.java:107)
stage('sonar-build') {
steps { script { withSonarQubeEnv('VantageSonar') {
sh 'mvn clean package sonar:sonar'
def qg = waitForQualityGate() if (qg.status != 'OK') { error "Pipeline aborted due to quality gate failure: ${qg.status}" } } } }
}Enter code here...
Hi Julien,this feature is nice but it has been easily possible to achieve the same with https://github.com/SonarQubeCommunity/sonar-build-breaker (or https://github.com/AmadeusITGroup/sonar-stash that we use ATM).
A lot more important would be the long-standing issue https://jira.sonarsource.com/browse/SONAR-6763 - any news when quality gates on incremental (or if not incremental, at least on "non-server-side-saving") sonar runs will be possible?
Fabrice BELLINGARD | SonarSource SonarQube & SonarLint Product Manager http://sonarsource.com |
Best RegardsGeorg
On Wednesday, 22 February 2017 16:02:24 UTC+1, Julien HENRY wrote:Hi,I would like to collect feedback before the upcoming release of the SonarQube Scanner for Jenkins.The main new feature is that we introduced a new pipeline step that would put the pipeline in pause until SonarQube analysis is finished, and the step will then give access to the quality gate status. You can then implement any logic you want.Example:stage("build & SonarQube analysis") {node {withSonarQubeEnv('My SonarQube Server') {sh 'mvn clean package sonar:sonar'}}}stage("Quality Gate"){timeout(time: 1, unit: 'HOURS') {def qg = waitForQualityGate()if (qg.status != 'OK') {error "Pipeline aborted due to quality gate failure: ${qg.status}"}}}You can test using this artifact:Documentation is available directly on the step in the pipeline snippet generator.Feedback period is open until Friday.Regards,Julien
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/cd1b94a5-4fe1-47ac-b4ee-54db83ef8499%40googlegroups.com.
api/webhooks/deliveries result:
{"deliveries":[{"id":"AVqQTJiMvUKPnZt1PZie","componentKey":"com.mycompany:web-app","ceTaskId":"AVqQTI00uNSR7Z9AqVMA","name":"Jenkins
ATI","url":"http://jenkins.mycompany.com:8080/jenkins/sonarqube-webhook/","at":"2017-03-02T19:33:43+0100","success":false,"httpStatus":403,"durationMs":7}]}
api/webhooks/delivery result:
{"delivery":{"id":"AVqQTJiMvUKPnZt1PZie","componentKey":"com.mycompany:web-app","ceTaskId":"AVqQTI00uNSR7Z9AqVMA","name":"Jenkins
ATI","url":"http://jenkins.mycompany.com:8080/jenkins/sonarqube-webhook/","at":"2017-03-02T19:33:43+0100","success":false,"httpStatus":403,"durationMs":7,"payload":"{\"taskId\":\"AVqQTI00uNSR7Z9AqVMA\",\"status\":\"SUCCESS\",\"analysedAt\":\"2017-03-02T19:33:34+0100\",\"project\":{\"key\":\"com.mycompany:web-app\",\"name\":\"com.mycompany:web-app\"},\"qualityGate\":{\"name\":\"SonarQube
way\",\"status\":\"OK\",\"conditions\":[{\"metric\":\"new_security_rating\",\"operator\":\"GREATER_THAN\",\"value\":\"1\",\"status\":\"OK\",\"onLeakPeriod\":true,\"errorThreshold\":\"1\"},{\"metric\":\"new_reliability_rating\",\"operator\":\"GREATER_THAN\",\"value\":\"1\",\"status\":\"OK\",\"onLeakPeriod\":true,\"errorThreshold\":\"1\"},{\"metric\":\"new_maintainability_rating\",\"operator\":\"GREATER_THAN\",\"value\":\"1\",\"status\":\"OK\",\"onLeakPeriod\":true,\"errorThreshold\":\"1\"},{\"metric\":\"new_coverage\",\"operator\":\"LESS_THAN\",\"status\":\"NO_VALUE\",\"onLeakPeriod\":true,\"errorThreshold\":\"80\"}]},\"properties\":{}}"}}
Hi Julien,this feature is nice but it has been easily possible to achieve the same with https://github.com/SonarQubeCommunity/sonar-build-breaker
A lot more important would be the long-standing issue https://jira.sonarsource.com/browse/SONAR-6763 - any news when quality gates on incremental (or if not incremental, at least on "non-server-side-saving") sonar runs will be possible?
*Should* the waitForQualityGate be outside a node, or *must* it be outside of a node? We have some existing scripts which use a single node scope for the whole script, and would like to integrate the quality gate with minimal changes. The extra wait time is no issue at the moment.
stage ("SonarQube analysis") {
steps {
script {
STAGE_NAME = "SonarQube analysis"
if (BRANCH_NAME == "develop") {
echo "In 'develop' branch, don't analyze."
}
else { // this is a PR build, run sonar analysis
withSonarQubeEnv("SonarGate") {
sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"
}
}
}
}
}
stage ("SonarQube Gatekeeper") {
steps {
script {
STAGE_NAME = "SonarQube Gatekeeper"
if (BRANCH_NAME == "develop") {
echo "In 'develop' branch, skip."
}
else { // this is a PR build, fail on threshold spill
def qualitygate = waitForQualityGate()
if (qualitygate.status != "OK") {
error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
}
}
}
}
}
stage ("SonarQube analysis") {
STAGE_NAME = "SonarQube analysis"
if (BRANCH_NAME == "develop") {
echo "In 'develop' branch, don't analyze."
}
else { // this is a PR build, run sonar analysis
withSonarQubeEnv("SonarGate") {
sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"
}
}
}
stage ("SonarQube Gatekeeper") {
STAGE_NAME = "SonarQube Gatekeeper"
if (BRANCH_NAME == "develop") {
echo "In 'develop' branch, skip."
}
else { // this is a PR build, fail on threshold spill
def qualitygate = waitForQualityGate()
if (qualitygate.status != "OK") {
error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
}
}
}
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/20c139a7-1e33-48d0-a9ae-ca5512f28785%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAD9wyxENJfUfUhgkNL9hCLXtgig8%2B%2BBQfrcKqiwMsRFu_FXErQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAJp9yiNOAFmHvEZ5i4jWzA1ciiuTKJQfR%3Da79-PnBt6h4M2aqA%40mail.gmail.com.
#!groovy
--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/z_K_wz_8Vw8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CAD9wyxEf%2BR_tbPQwfCUYnrw8DW5ftePsfsP%2B5QLzEXSW4z4nuA%40mail.gmail.com.
Let me know if you want any other tests.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/20c139a7-1e33-48d0-a9ae-ca5512f28785%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAD9wyxENJfUfUhgkNL9hCLXtgig8%2B%2BBQfrcKqiwMsRFu_FXErQ%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAJp9yiNOAFmHvEZ5i4jWzA1ciiuTKJQfR%3Da79-PnBt6h4M2aqA%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/z_K_wz_8Vw8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CAD9wyxEf%2BR_tbPQwfCUYnrw8DW5ftePsfsP%2B5QLzEXSW4z4nuA%40mail.gmail.com.
(but it's not always clear to me which
ones actually do that, and since which version)
stage ("SonarQube analysis") {
steps {
script {
withSonarQubeEnv('SonarQube') {
sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"
}
def qualitygate = waitForQualityGate()
if (qualitygate.status != "OK") {
error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
}
}
}
}
java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. Please use the 'withSonarQubeEnv' wrapper to run your analysis.
INFO: ANALYSIS SUCCESSFUL, you can browse http://****:9000/sonarqube/dashboard/index/cert-mgmt-dashboard
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://****:9000/sonarqube/api/ce/task?id=AVr1S35oyohgD3UCfaIt
{"task":{"organization":"default-organization","id":"AVr1S35oyohgD3UCfaIt","type":"REPORT","componentId":"AVrnCD3cyohgD3UCfaG0","componentKey":"****","componentName":"****","componentQualifier":"TRK","analysisId":"AVr1S4EhtEGQbCizBv8A","status":"SUCCESS","submittedAt":"2017-03-22T11:14:09+0200","submitterLogin":"****","startedAt":"2017-03-22T11:14:10+0200","executedAt":"2017-03-22T11:14:11+0200","executionTimeMs":473,"logs":false,"hasScannerContext":true}}
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/9fe415f6-4f2c-435f-b77c-8158082818e5%40googlegroups.com.
Hi,I would like to collect feedback before the upcoming release of the SonarQube Scanner for Jenkins.The main new feature is that we introduced a new pipeline step that would put the pipeline in pause until SonarQube analysis is finished, and the step will then give access to the quality gate status. You can then implement any logic you want.Example:
stage("build & SonarQube analysis") {node {withSonarQubeEnv('My SonarQube Server') {sh 'mvn clean package sonar:sonar'}}}stage("Quality Gate"){timeout(time: 1, unit: 'HOURS') {def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"}}}
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6415f21e-3570-4440-b043-0192746d59fa%40googlegroups.com.
java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. Please use the 'withSonarQubeEnv' wrapper to run your analysis. at org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.processStepParameters(WaitForQualityGateStep.java:125)
Although I have only a single Jenkins Master instance and there is no slave.
My pipeline looks like:
stage('SonarQube-Analysis'){
steps {
withSonarQubeEnv('SonarCube_Dev'){
sh 'mvn sonar:sonar'
}
}
}
stage("SonarQube-Quality Gate") {
steps {
timeout(time: 1, unit: 'MINUTES') {
script{
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}
I am using SonarQube Scanner for Jenkins version : 2.6.1
Jenkins : 2.61
java.lang.IllegalStateException: Unable to parse response from http://XXX:9000//api/ce/task?id=AV6D5DbyM7CuBmXBR6FP: