Skip to content

Commit

Permalink
update sonar scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
RobBrazier committed Sep 9, 2017
1 parent 628535b commit b734c58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions ci/scripts/sonar.sh
Expand Up @@ -7,15 +7,14 @@ rm /tmp/scanner.zip
executable="$(ls /tmp/sonar*/bin/sonar-scanner)"
version="$(jq -M -r '.version' composer.json)"
cmd="$executable -Dsonar.projectVersion=$version"
REPO_SLUG="$(git remote show -n origin | grep 'Fetch URL' | sed -e 's/\s*Fetch URL:\s*//g' -e 's/github.com[\/:]//g' -e 's/git@//g' -e 's/https:\/\///g' -e 's/.git//g')"
if [[ "$REPO_SLUG" == "RobBrazier/Laravel_Piwik" ]]; then
if [[ "$SEMAPHORE_REPO_SLUG" == "RobBrazier/Laravel_Piwik" ]]; then
pr_num="$(curl https://api.github.com/repos/RobBrazier/Laravel_Piwik/pulls?head=RobBrazier:$BRANCH_NAME | jq .[0].number)"
if [[ "$pr_num" -ne "null" ]]; then
CHANGE_ID="$pr_num"
PULL_REQUEST_NUMBER="$pr_num"
fi
fi
[[ "$BRANCH_NAME" == "master" ]] || cmd="$cmd -Dsonar.analysis.mode=issues"
[[ "$CHANGE_ID" == "" ]] || cmd="$cmd -Dsonar.github.pullRequest=$CHANGE_ID"
[[ "$PULL_REQUEST_NUMBER" == "" ]] || cmd="$cmd -Dsonar.github.pullRequest=$PULL_REQUEST_NUMBER"
[[ "$SONAR_TOKEN" == "" ]] || cmd="$cmd -Dsonar.login=$SONAR_TOKEN"
[[ "$GITHUB_TOKEN" == "" ]] || cmd="$cmd -Dsonar.github.oauth=$GITHUB_TOKEN"

Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/utils.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [ -z "$CONTAINER_RUNTIME" ]; then
CONTAINER_RUNTIME="hyper"
CONTAINER_RUNTIME="docker"
fi

is_docker() {
Expand Down

0 comments on commit b734c58

Please sign in to comment.