-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix code coverage, introduce local Sonarqube docker-compose
- Loading branch information
1 parent
a5483ce
commit 96b8103
Showing
7 changed files
with
3,722 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
COMPOSE_PROJECT_NAME=keycloak_migration_demo | ||
KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:17.0.1 | ||
KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:17.0.1 | ||
|
||
SONAR_VERSION=9.4.0-community | ||
SONAR_CONFIG_VERSION=3.13.5 | ||
SONAR_USER=admin | ||
SONAR_PASSWORD=admin | ||
SONAR_URL=sonarqube:9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: '3.3' | ||
services: | ||
### CODE ANALYSIS ### | ||
sonarqube: | ||
image: sonarqube:$SONAR_VERSION | ||
ports: | ||
- "9000:9000" | ||
networks: | ||
- internal | ||
volumes: | ||
- sonarqube_data:/opt/sonarqube/data | ||
- sonarqube_extensions:/opt/sonarqube/extensions | ||
depends_on: | ||
- sonarqube_config | ||
stop_grace_period: 5m | ||
|
||
sonarqube_config: | ||
image: alpine:$SONAR_CONFIG_VERSION | ||
environment: | ||
SONAR_URL: $SONAR_URL | ||
SONAR_USER: $SONAR_USER | ||
SONAR_PASSWORD: $SONAR_PASSWORD | ||
entrypoint: ["sh", "/docker-entrypoint.sh"] | ||
volumes: | ||
- ./sonarqube/import_data.sh:/docker-entrypoint.sh:ro | ||
- ./sonarqube/java_profile.xml:/java_profile.xml:ro | ||
networks: | ||
- internal | ||
### END CODE ANALYSIS ### | ||
|
||
networks: | ||
internal: | ||
|
||
volumes: | ||
sonarqube_data: | ||
sonarqube_extensions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Initiating..." | ||
|
||
SONAR_RESTORE_PROFILE_URL="$SONAR_URL/api/qualityprofiles/restore" | ||
SONAR_DEFAULT_PROFILE_URL="$SONAR_URL/api/qualityprofiles/set_default" | ||
|
||
CUSTOM_PROFILE_JAVA="Sonar%20way%20(extended)" | ||
FILE_JAVA="/java_profile.xml" | ||
|
||
# INSTALL CURL | ||
apk --no-cache add curl | ||
|
||
# WAIT UNTIL SONARQUBE IS UP | ||
until curl --output /dev/null --silent --head --fail -u "$SONAR_USER":"$SONAR_PASSWORD" "$SONAR_URL/api/system/health"; do | ||
>&2 echo "Sonarqube is unavailable - sleeping" | ||
sleep 1 | ||
done | ||
>&2 echo "Sonarqube is up - executing command" | ||
|
||
# PROFILE - JAVA | ||
echo "Importing custom profile ($FILE_JAVA)..." | ||
|
||
curl -X POST -u "$SONAR_USER":"$SONAR_PASSWORD" "$SONAR_RESTORE_PROFILE_URL" --form backup=@$FILE_JAVA | ||
|
||
echo "Setting the profile as default..." | ||
curl -u admin:admin -d "language=java&qualityProfile=$CUSTOM_PROFILE_JAVA" -X POST "$SONAR_DEFAULT_PROFILE_URL" | ||
|
||
echo "Data import done." |
Oops, something went wrong.