From fd5cf311088b03535c746a7e71d80890f8dbaa05 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 4 Sep 2020 16:20:40 +0200 Subject: [PATCH] travis: Read project/organization for SonarCloud from environment variable --- .travis.yml | 8 +++++--- scripts/test.sh | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50cacc310..41a163738 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,15 +39,17 @@ env: jobs: include: - env: TEST=sonarcloud - if: type = push AND env(SONAR_TOKEN) IS present + if: | + type = push AND env(SONAR_TOKEN) IS present AND \ + env(SONAR_PROJECT) IS present AND \ + env(SONAR_ORGANIZATION) IS present git: depth: false cache: directories: - $HOME/.sonar-cache addons: - sonarcloud: - organization: "strongswan" + sonarcloud: true - env: TEST=lgtm if: type = push AND env(LGTM_TOKEN) IS present git: diff --git a/scripts/test.sh b/scripts/test.sh index af99825f8..0c5cebc9b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -448,7 +448,8 @@ apidoc) ;; sonarcloud) sonar-scanner \ - -Dsonar.projectKey=strongswan \ + -Dsonar.projectKey=${SONAR_PROJECT} \ + -Dsonar.organization=${SONAR_ORGANIZATION} \ -Dsonar.projectVersion=$(git describe)+${TRAVIS_BUILD_NUMBER} \ -Dsonar.sources=. \ -Dsonar.cfamily.threads=2 \