gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 208 forks source link

Run preview analysis for all commits in branch #75

Open lenertovalucie opened 7 years ago

lenertovalucie commented 7 years ago

Hi,

is there possibility run preview analysis for all commits in branch?

My command for SonarQube begin: MSBuild.SonarQube.Runner.exe begin /k:some_key /d:sonar.host.url=some_url /d:sonar.analysis.mode=preview /d:sonar.gitlab.only_issue_from_commit_line=true /d:sonar.gitlab.commit_sha=12345 /d:sonar.gitlab.ref_name=some_branch

The command is working but If I have two commits and push to the server, analysis run only for the last commit.

Is there possibility add more than one commit in property /d:sonar.gitlab.commit_sha?

gabrie-allaigre commented 7 years ago

Hi, Yes -Dsonar.gitlab.commit_sha=$(git log --pretty=format:%H origin/master..$CI_BUILD_REF | tr '\n' ',')

lenertovalucie commented 7 years ago

Thanks, I tried your command but: 'tr' is not recognized as an internal or external command, operable program or batch file.

I can write some Powershell command for getting commits with git log, but I need to know how should property /d:sonar.gitlab.commit_sha looks like if there are more commits.

rkalkani commented 6 years ago

Alternative PowerShell command would be

(git log --pretty=format:%H origin/master..$env:CI_BUILD_REF) -join ","

for gitlab 9.x or above

(git log --pretty=format:%H origin/master..$env:CI_COMMIT_SHA) -join ","