Skip to content

Branch analysis fails when sonar.gitlab.merge_request_discussion is enabled globally #17

@stalb

Description

@stalb

If sonar.gitlab.merge_request_discussion is enabled globally for the plugin on the sonarqube instance, you have to define it to false on branch analyses or the pipeline will fail to add comments for detected issues because merge request iid is missing.

error:

INFO: Executing post-job 'Final report'
INFO: Turn debug info on to get more details (sonar-scanner -X -Dsonar.verbose=true ...).
INFO: Executing post-job 'GitLab Commit Issue Publisher'
INFO: Will execute CommitPublishPostJob of GitlabPlugin.
INFO: GitLab plugin is enabled
INFO: Waiting quality gate to complete...
INFO: Quality gate status: ERROR
INFO: Reliability Rating on New Code : 1
INFO: Security Rating on New Code : 1
ERROR: Maintainability Rating on New Code: 4 > 1
INFO: Will try to update review comments.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:17.288s
INFO: Final Memory: 16M/70M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: SonarQube failed to complete the review of this commit: The merge request iid must be provided.
ERROR: Caused by: The merge request iid must be provided.

Expected behavior: the sonar.gitlab.merge_request_discussion should be used only for merge request analyses.
For branch analyses it should be ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions