Haufe-Lexware / gocd-plugins

A collection of our OSS plugins for use with Go.CD
Apache License 2.0
36 stars 34 forks source link

Sonar Qualitygates plugin doesn't show the correct status on immediate run #1

Closed akshaydewan closed 7 years ago

akshaydewan commented 8 years ago

We tried integrating the sonar-qualitygates-plugin with our app and found that it wasn't showing the correct status of the quality gate after running. On subsequent runs, it started showing the correct result.

We think that it may be because the sonar server was still processing the result while the plugin queried the server. We see the following message from sonar after the run:

Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.

Also, this documentation indicates that we must poll the sonar server for the status before we check the quality gates.

markus2810 commented 8 years ago

Thank you for the feedback. We are using the plugin not directly behind executing the sonar scan. In our case the quality gate result is requested some minutes after the scan. Do you execute the sonar scan in the same pipeline, stage or job in that you run the scan? Would your issue be solved, if the plugin would be extended like follow:

  1. scan result must not be older than the start of the pipeline run
  2. poll for a new result with a definable timeout e.g. 5 minutes and fail if there is no new result in that time frame

Kind Regards, Markus

akshaydewan commented 8 years ago

Hi Markus,

We've set up the plugin to run as a Task immediately after we run the Sonar scan task (in the same Job).

The solution you've suggested sounds good. I think it would solve the problem.

Thanks!

akshaydewan commented 8 years ago

Hi,

I've been dabbling with this in my free time. Do you have any guidelines for contributing?

Right now, I'm facing a few issues with the build:

Failed tests: 
  JobPropParamParserTest.testOnePropVarInParameter:57 expected:<[Test Value ]1> but was:<[test_property_]1>
  JobPropParamParserTest.testEnvVarAsPropVarNameInParameter:90 expected:<[Test Value ]1TestPluginStage> but was:<[test_property_]1TestPluginStage>
  JobPropParamParserTest.testPropVarAndEnvVarInParameter:79 expected:<[Test Value 3]> but was:<[test_property_TestPluginStage]>
  JobPropParamParserTest.testTwoPropVarsInParameter:67 expected:<[Test Value 1Test Value ]2> but was:<[test_property_1test_property_]2>

Any idea around these failing tests?

Also, the package structure starting with com.tw is confusing. Shouldn't your packages start with com.haufe-lexware.?

Thanks!

markus2810 commented 8 years ago

Hi,

we do not have contribution guidelines yet. For submitting a change, please send a pull request. As code quality check, we run sonaqube. Have a look at http://bob.xeam-solutions.com for current issues.

for running these tests, you need an test pipeline where the unit tests can read pipeline properties.

image

Sure, the namespace should start as you suggested. We started developing the plugins with the com.tw namespace and did not renamed them yet.

We appreciate your contribution

Thanks!

akshaydewan commented 8 years ago

Great! Thanks a lot for the info!

markus2810 commented 8 years ago

Are you working on fixing this issue? If not we will start to implement this. Thanks!

akshaydewan commented 8 years ago

Unfortunately, I haven't been able to pick this up. You guys can go ahead and fix it. Thanks!

bradeac commented 8 years ago

Hello,

I have tried to fix this issue, although I could not replicate this problem on my machine.

I pushed the changes and also an updated .jar which includes the changes. Please inform us if the changes are fixing your issue or not.

Thank you !