3

I'm using the plugin : github-pr-coverage-status-plugin to make pull request checks on the coverage on Sonar. This plugin enables to record coverage for master, and then compare test coverage of that pull request with the coverage recorded of master branch.

Here what I do, and it works fine :

stage('RECORD COVERAGE') {
            when { branch 'master' }
            steps {
                script {
                    currentBuild.result = 'SUCCESS'
                 }
                step([$class: 'MasterCoverageAction', scmVars: [GIT_URL: scm.getUserRemoteConfigs()[0].getUrl()]])
            }
        }

        stage('COMPARE COVERAGE') {
            when { branch 'PR-*' }
            steps{
                script {
                    currentBuild.result = 'SUCCESS'
                 }
                step([$class: 'CompareCoverageAction', scmVars: [GIT_URL: scm.getUserRemoteConfigs()[0].getUrl()]])
            }
        }

But I would like to do is that I want to compare not with the master but with the base branch to which the pull request is made... To be sure that the code of the head branch won't be worst than what exists (base branch).

It seems that in the logic of the plugin, the coverage is always made for master.

Did anyone use that pipeline, and figured the same need ?

sirineBEJI
  • 1,170
  • 2
  • 14
  • 25

0 Answers0