Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"SonarQube Branches & Pull Requests" feature displays configuration logs more than once #82

Closed
axel3rd opened this issue Aug 11, 2020 · 4 comments

Comments

@axel3rd
Copy link
Contributor

axel3rd commented Aug 11, 2020

Currently, the header configuration log is displayed more than once (one by step in fact):

[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'
[13:01:16] SonarQube plugin detects pull-request, 'env.SONARQUBE_SCANNER_PARAMS' set with '{"sonar.pullrequest.key":"42","sonar.pullrequest.branch":"Foo bar","sonar.pullrequest.base":"master","sonar.pullrequest.provider":"github","sonar.pullrequest.github.repository":"foo/bar"}'

But log "SonarQube plugin detects [pull-request|branch], 'env.SONARQUBE_SCANNER_PARAMS' set with ..." is displayed 3 times ... I should understand why 😒

Fixed by Execute process once (and not 4 each steps). It was because ParametersPreprocessor is executed for each steps of build.

Initial implementation (#77) has not fixed the problem.


if (build.getBuildFeaturesOfType(BranchesAndPullRequestsBuildFeature.BUILD_FEATURE_TYPE).isEmpty() || buildParams.containsKey(SQS_SYSENV)) {
// Currently only GitHub is supported => if feature defined, it is for GitHub
// ParametersPreprocessor is called for each steps (or could be defined manually). So if sysenv already defined, skip process.
return;

The code seems executed at same time => sysenv flag is not suffisant.

Adding a block synchronize is perhaps the solution. @Linfar : Is it tolerable in a ParametersPreprocessor ?

@Linfar
Copy link
Member

Linfar commented Aug 25, 2020

Synchronization can only solve problems caused by several threads concurrently modifying a shared state. Here there is only one thread initializing AgentBuild so synchronization won't help. Since runParameters isn't used anyway then probably BranchesAndPullRequestsParametersPreprocessor could be rewritten to BuildStartContextProcessor?

@axel3rd
Copy link
Contributor Author

axel3rd commented Aug 31, 2020

I'm currently /OOO, but I will try to achieve that this month.

@axel3rd
Copy link
Contributor Author

axel3rd commented Sep 9, 2020

Historical link: commit 0b78ca0

This was referenced Sep 11, 2020
@axel3rd
Copy link
Contributor Author

axel3rd commented Oct 12, 2020

Fixed by #84 (merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants