From 277e0923676bc5a3f6a7f959e07aab1c2987aa2e Mon Sep 17 00:00:00 2001 From: David Christofas Date: Fri, 10 Jul 2020 17:10:29 +0200 Subject: [PATCH] tweak sonar config only set pullrequest config if the build was triggered by a pull request Signed-off-by: David Christofas --- .drone.star | 3 +++ sonar-project.properties | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.drone.star b/.drone.star index 48c08c2920..ec91d1a115 100644 --- a/.drone.star +++ b/.drone.star @@ -146,6 +146,9 @@ def testing(ctx): 'SONAR_TOKEN': { 'from_secret': 'sonar_token', }, + 'SONAR_PULL_REQUEST_BASE': 'master' if ctx.build.event == 'pull_request' else None, + 'SONAR_PULL_REQUEST_BRANCH': ctx.build.source if ctx.build.event == 'pull_request' else None, + 'SONAR_PULL_REQUEST_KEY': ctx.build.ref.replace("refs/pull/", "").split("/")[0] if ctx.build.event == 'pull_request' else None, }, }, ], diff --git a/sonar-project.properties b/sonar-project.properties index b66d2855d2..f9be5326c5 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.projectKey=owncloud_ocis-accounts sonar.organization=owncloud-1 -sonar.projectName=ownCloud Infinite Scale: ACCOUNTS +sonar.projectName=ocis-accounts sonar.projectVersion=1.0 sonar.host.url=https://sonarcloud.io @@ -25,9 +25,9 @@ sonar.sources=. # Pull Requests sonar.pullrequest.provider=GitHub sonar.pullrequest.github.repository=owncloud/ocis-accounts -sonar.pullrequest.base=${env.DRONE_BRANCH} -sonar.pullrequest.branch=${env.DRONE_SOURCE_BRANCH} -sonar.pullrequest.key=${env.DRONE_PULL_REQUEST} +sonar.pullrequest.base=${env.SONAR_PULL_REQUEST_BASE} +sonar.pullrequest.branch=${env.SONAR_PULL_REQUEST_BRANCH} +sonar.pullrequest.key=${env.SONAR_PULL_REQUEST_KEY} # Properties specific to language plugins: