Skip to content

Commit

Permalink
Fixes for Kubernetes deploy and ES
Browse files Browse the repository at this point in the history
  • Loading branch information
wkoot committed Nov 8, 2024
1 parent df31270 commit 443cfb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ jobs:
run: |
docker build --build-arg="IMAGE_EDITION=${{ matrix.env.IMAGE_EDITION }}" -t ictu/sonar:ci-latest .
eval $(minikube -p minikube docker-env)
minikube image load ictu/sonar:ci-latest
kubectl apply -f helm/deploy-ci.yaml
helm dependency build helm
helm upgrade --set-json='sonarqube.image.tag="ci-latest"' --install --render-subchart-notes ictu-sonarqube helm
helm upgrade --set-json='sonarqube.elasticsearch.bootstrapChecks="false"' --set-json='sonarqube.image.tag="ci-latest"' --install --render-subchart-notes ictu-sonarqube helm
- name: Disable ES disk watermark checks
run: |
eval $(minikube -p minikube docker-env)
kubectl wait pod/ictu-sonarqube-sonarqube-0 --timeout=1m --for=jsonpath='{.status.phase}'=Running
kubectl logs -f pod/ictu-sonarqube-sonarqube-0 |& sed "/app\[\]\[o.s.a.SchedulerImpl\] Process\[es\] is up/ q"
kubectl exec pod/ictu-sonarqube-sonarqube-0 -- curl -s -XPUT "http://localhost:9001/_cluster/settings" -H "Content-Type: application/json" -d '{"transient":{"cluster.routing.allocation.disk.threshold_enabled":false}}'
- name: Wait for Sonar instance to start
# profile for language 'web' is the last; assume everything is working if we got this far
Expand Down
9 changes: 5 additions & 4 deletions src/start-with-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ function waitForDatabase {
echo "Only PostgreSQL databases are supported"
return
fi
echo "Waiting for database connection on ${host}:${port}"
local pg_connect_params
pg_connect_params="-h ${host} -p ${port} ${SONAR_JDBC_USERNAME:+-U "$SONAR_JDBC_USERNAME"} -d $(basename "${SONAR_JDBC_URL%%\?*}")"
echo "Waiting for database connection with pg connect params '${pg_connect_params}'"
local count=0
local sleep=5
local timeout=${DB_START_TIMEOUT:-60}
until pg_isready -h "${host}" -p "${port}" ${SONAR_JDBC_USERNAME:+-U "$SONAR_JDBC_USERNAME"}
do
until pg_isready ${pg_connect_params} ; do
if [[ count -gt timeout ]]; then
echo "ERROR: Failed to start database within ${timeout} seconds"
exit 1
Expand All @@ -43,7 +44,7 @@ function waitForDatabase {
# - https://community.sonarsource.com/t/rules-not-registered-and-index-correctly-after-upgrade-to-10-7/128030
# - https://sonarsource.atlassian.net/browse/SONAR-23466
echo "Forcing ElasticSearch full reindex of rules, due to bug in version 10.7.0"
PGPASSWORD=${SONAR_JDBC_PASSWORD} psql -h "${host}" -p "${port}" ${SONAR_JDBC_USERNAME:+-U "$SONAR_JDBC_USERNAME"} -d "$(basename "${SONAR_JDBC_URL}")" -c "UPDATE PLUGINS SET FILE_HASH = ''"
PGPASSWORD=${SONAR_JDBC_PASSWORD} psql ${pg_connect_params} -c "UPDATE PLUGINS SET FILE_HASH = ''"
}

# Wait until SonarQube is operational
Expand Down

0 comments on commit 443cfb8

Please sign in to comment.