Skip to content

Commit

Permalink
Return "<unknown>" if a SonarQube server version cannot be determined.
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
headcr4sh committed Jan 31, 2018
1 parent 349aea7 commit a20f61a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion assets/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ function sq_qualitygates_project_status {
}

# Retrieves the version of a SonarQube server instance
# If the version cannot be determined due to an error, the string
# "<unknown>" will be returned.
# Params:
# $1 - Username or Access token, a colon and optional the password, e.g. "user:password" (required)
# $2 - SonarQube URL. Must end with a slash (required)
function sq_server_version {
curl -s -L -u "${1}" "${2}api/server/version"
curl -s -L -u "${1}" "${2}api/server/version" || echo "<unknown>"
}

0 comments on commit a20f61a

Please sign in to comment.