JetBrains / TeamCity.SonarQubePlugin

A plugin for TeamCity server allowing you to configure and run SonarQube analysis from the CI
Apache License 2.0
53 stars 31 forks source link

Branches & PullRequests feature doesn't work - PR detected as branch #89

Closed axel3rd closed 3 years ago

axel3rd commented 3 years ago

Since TeamCity 2020.1.5 (build 78938) upgrade, the Branches & PullRequests feature doesn't work.

A pull-request is detected as branch, viewable in logs:

SonarQube plugin detects branch, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.branch.name":"pull/183","sonar.branch.target":"master"}'

The TeamCity parameters "seems" correct:

image

But not detected by:

https://github.com/JetBrains/TeamCity.SonarQubePlugin/blob/9a43bb0c144ddc2ccfb51855f8283bbb666ec844/sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/buildfeatures/BranchesAndPullRequestsParametersPreprocessor.java#L63-L64

axel3rd commented 3 years ago

Re-tested with TeamCity 2019.2, the behavior is the same (PR detected as branch).

=> The root cause is probably linked to #82 (switch to BuildStartContextProcessor).

axel3rd commented 3 years ago

TeamCity Plugin Development requested for advice: BuildStartContextProcessor prerequisites build feature.

Linfar commented 3 years ago

I've answered in the forum thread. Basically it's needed to implement PositionAware interface.

axel3rd commented 3 years ago

@Linfar : 👊 (😗 #NotCovidCompliant).

90 fixes the problem. Target branch is Lakhnau-2020.1 (not sure which is the best to use compared to master).

axel3rd commented 3 years ago

Merged (#90) in Lakhnau-2020.1 branch. Plugin available in dedicated TeamCity build.