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 17:10:29 +02:00
parent f27eea2363
commit 277e092367
2 changed files with 7 additions and 4 deletions
+3
View File
@@ -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,
},
},
],
+4 -4
View File
@@ -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: