Skip to content
This repository was archived by the owner on Jul 17, 2018. It is now read-only.

Commit 441c30d

Browse files
author
Dan Rees
committed
renamed sonar config files
1 parent fdeca7a commit 441c30d

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e # exit immediately if a simple command exits with a non-zero status
4+
set -u # report the usage of uninitialized variables
5+
6+
<% if defined?p('github.server.url') %>
7+
export JAVA_HOME="/var/vcap/packages/oraclejdk"
8+
export GROOVY_HOME="/var/vcap/packages/groovy"
9+
export GROOVY="${GROOVY_HOME}/bin/groovy"
10+
11+
cd /var/vcap/jobs/sonarqube/config
12+
13+
${GROOVY} configure-settings.groovy
14+
${GROOVY} configure-groups.groovy
15+
<% end %>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Script must be called from the script directory to pick up the imported Class.
2+
import SonarApiClient
3+
4+
def sonarApiSettingsUrl = SonarApiClient.sonarApiUrl + 'settings/set'
5+
// Could connect to 'settings/get' after to test without exercising functionality.
6+
7+
def gitHubUrl = SonarApiClient.gitHubUrl
8+
9+
def keySingleValuePairs = [
10+
new Tuple2('sonar.core.serverBaseURL', SonarApiClient.sonarUrl),
11+
new Tuple2('sonar.auth.github.enabled', 'true'),
12+
new Tuple2('sonar.auth.github.apiUrl', gitHubUrl + '/api/v3/'),
13+
new Tuple2('sonar.auth.github.allowUsersToSignUp', 'true'),
14+
new Tuple2('sonar.auth.github.webUrl', gitHubUrl),
15+
new Tuple2('sonar.auth.github.clientSecret.secured', SonarApiClient.clientSecret),
16+
new Tuple2('sonar.auth.github.loginStrategy', 'Same as GitHub login'),
17+
new Tuple2('sonar.auth.github.clientId.secured', SonarApiClient.clientId)
18+
]
19+
20+
for (pair in keySingleValuePairs) {
21+
def key = SonarApiClient.buildSingleValuedKeyPair('key', pair.first)
22+
def value = SonarApiClient.buildSingleValuedKeyPair('value', pair.second)
23+
def keyValues = [key, value]
24+
def queryString = SonarApiClient.buildQueryString(keyValues.iterator())
25+
def querySucceeded = SonarApiClient.postQueryString(sonarApiSettingsUrl, queryString)
26+
27+
if (!querySucceeded) {
28+
System.exit(1)
29+
}
30+
}
31+
32+
System.exit(0)

0 commit comments

Comments
 (0)