tweak sonar config

only set pullrequest config if the build was triggered by a pull request

Signed-off-by: David Christofas <dchristofas@owncloud.com>
This commit is contained in:
David Christofas
2020-07-10 16:37:46 +02:00
parent 2dc5a11484
commit c9daeb52fa
2 changed files with 10 additions and 5 deletions

View File

@@ -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,
},
},
],

View File

@@ -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: