File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,19 +136,23 @@ commands:
136136 environment :
137137 SONAR_TOKEN : $SONAR_TOKEN
138138 command : |
139- export SONAR_SCANNER_VERSION=7.2.0.5079
139+ #!/usr/bin/env bash
140+
141+ PR_NUMBER=$(echo ${CIRCLE_PULL_REQUEST} | sed 's/.*\///')
142+ SONAR_SCANNER_VERSION=${SONAR_SCANNER_VERSION}
140143 export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
144+ SONAR_TOKEN=${SONAR_TOKEN}
141145 curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
142146 unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
143147 export PATH=$SONAR_SCANNER_HOME/bin:$PATH
144148 export SONAR_SCANNER_OPTS="-server"
145- if [[ -n "${CIRCLE_PR_NUMBER }" ]]; then
149+ if [[ -n "${PR_NUMBER }" ]]; then
146150 sonar-scanner \
147151 -Dsonar.organization=instana \
148152 -Dsonar.projectKey=instana_ruby-sensor \
149153 -Dsonar.sources=. \
150154 -Dsonar.host.url="${SONARQUBE_URL}" \
151- -Dsonar.pullrequest.key="${CIRCLE_PR_NUMBER }" \
155+ -Dsonar.pullrequest.key="${PR_NUMBER }" \
152156 -Dsonar.pullrequest.branch="${CIRCLE_BRANCH}"
153157 else
154158 sonar-scanner \
You can’t perform that action at this time.
0 commit comments