From c9daeb52fa88b239fcfa8f161150e61d36ce35f7 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Fri, 10 Jul 2020 16:37:46 +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 | 5 +++++ sonar-project.properties | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.drone.star b/.drone.star index 8eb9e76a8..24da7a04d 100644 --- a/.drone.star +++ b/.drone.star @@ -134,6 +134,11 @@ def testing(ctx): 'SONAR_TOKEN': { 'from_secret': 'sonar_token', }, + 'SONAR_PULL_REQUEST_PROVIDER': 'GitHub' if ctx.build.event == 'pull_request' else None, + 'SONAR_PULL_REQUEST_REPO': 'owncloud/ocis-thumbnails' if ctx.build.event == 'pull_request' else None, + '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 if ctx.build.event == 'pull_request' else None, }, }, ], diff --git a/sonar-project.properties b/sonar-project.properties index aede03677..05a5d21ff 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -23,11 +23,11 @@ sonar.links.issue=https://github.com/owncloud/ocis-thumbnails/issues sonar.sources=. # Pull Requests -sonar.pullrequest.provider=GitHub -sonar.pullrequest.github.repository=owncloud/ocis-thumbnails -sonar.pullrequest.base=${env.DRONE_BRANCH} -sonar.pullrequest.branch=${env.DRONE_SOURCE_BRANCH} -sonar.pullrequest.key=${env.DRONE_PULL_REQUEST} +sonar.pullrequest.provider=${SONAR_PULL_REQUEST_PROVIDER} +sonar.pullrequest.github.repository=${SONAR_PULL_REQUEST_REPO} +sonar.pullrequest.base=${SONAR_PULL_REQUEST_BASE} +sonar.pullrequest.branch=${SONAR_PULL_REQUEST_BRANCH} +sonar.pullrequest.key=${SONAR_PULL_REQUEST_KEY} # Properties specific to language plugins: