-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONAR-24184 Define the structure for 2025.2.0 cycle
- Loading branch information
1 parent
6dcbc60
commit 1970ef9
Showing
11 changed files
with
486 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
FROM eclipse-temurin:17-jre-noble | ||
|
||
LABEL io.k8s.description="SonarQube Server is a self-managed, automatic code review tool that systematically helps you deliver Clean Code." | ||
LABEL io.openshift.min-cpu=400m | ||
LABEL io.openshift.min-memory=2048M | ||
LABEL io.openshift.non-scalable=false | ||
LABEL io.openshift.tags=sonarqube,static-code-analysis,code-quality,clean-code | ||
LABEL org.opencontainers.image.url=https://github.com/SonarSource/docker-sonarqube | ||
LABEL com.googleapis.cloudmarketplace.product.service.name=services/sonarqube-dce | ||
|
||
ENV LANG='en_US.UTF-8' \ | ||
LANGUAGE='en_US:en' \ | ||
LC_ALL='en_US.UTF-8' | ||
|
||
# | ||
# SonarQube setup | ||
# | ||
ARG SONARQUBE_VERSION=2025.1.0.102418 | ||
ARG SONARQUBE_ZIP_URL=https://binaries.sonarsource.com/CommercialDistribution/sonarqube-datacenter/sonarqube-datacenter-${SONARQUBE_VERSION}.zip | ||
ENV DOCKER_RUNNING="true" \ | ||
JAVA_HOME='/opt/java/openjdk' \ | ||
SONARQUBE_HOME=/opt/sonarqube \ | ||
SONAR_VERSION="${SONARQUBE_VERSION}" \ | ||
SQ_DATA_DIR="/opt/sonarqube/data" \ | ||
SQ_EXTENSIONS_DIR="/opt/sonarqube/extensions" \ | ||
SQ_LOGS_DIR="/opt/sonarqube/logs" \ | ||
SQ_TEMP_DIR="/opt/sonarqube/temp" \ | ||
SONAR_CLUSTER_NODE_TYPE="application" \ | ||
SONAR_CLUSTER_ENABLED="true" | ||
|
||
RUN set -eux; \ | ||
deluser ubuntu; \ | ||
useradd --system --uid 1000 --gid 0 sonarqube; \ | ||
apt-get update; \ | ||
apt-get --no-install-recommends -y install \ | ||
bash \ | ||
curl \ | ||
fonts-dejavu \ | ||
gnupg \ | ||
iproute2 \ | ||
unzip; \ | ||
echo "networkaddress.cache.ttl=5" >> "${JAVA_HOME}/conf/security/java.security"; \ | ||
sed --in-place --expression="s?securerandom.source=file:/dev/random?securerandom.source=file:/dev/urandom?g" "${JAVA_HOME}/conf/security/java.security"; \ | ||
# pub 2048R/D26468DE 2015-05-25 | ||
# Key fingerprint = F118 2E81 C792 9289 21DB CAB4 CFCA 4A29 D264 68DE | ||
# uid sonarsource_deployer (Sonarsource Deployer) <[email protected]> | ||
# sub 2048R/06855C1D 2015-05-25 | ||
for server in $(shuf -e hkps://keys.openpgp.org \ | ||
hkps://keyserver.ubuntu.com) ; do \ | ||
gpg --batch --keyserver "${server}" --recv-keys 679F1EE92B19609DE816FDE81DB198F93525EC1A && break || : ; \ | ||
done; \ | ||
mkdir --parents /opt; \ | ||
cd /opt; \ | ||
curl --fail --location --output sonarqube.zip --silent --show-error "${SONARQUBE_ZIP_URL}"; \ | ||
curl --fail --location --output sonarqube.zip.asc --silent --show-error "${SONARQUBE_ZIP_URL}.asc"; \ | ||
gpg --batch --verify sonarqube.zip.asc sonarqube.zip; \ | ||
unzip -q sonarqube.zip; \ | ||
mv "sonarqube-${SONARQUBE_VERSION}" sonarqube; \ | ||
rm sonarqube.zip*; \ | ||
rm -rf ${SONARQUBE_HOME}/bin/*; \ | ||
ln -s "${SONARQUBE_HOME}/lib/sonar-application-${SONARQUBE_VERSION}.jar" "${SONARQUBE_HOME}/lib/sonarqube.jar"; \ | ||
chmod -R 550 ${SONARQUBE_HOME}; \ | ||
chmod -R 770 "${SQ_DATA_DIR}" "${SQ_EXTENSIONS_DIR}" "${SQ_LOGS_DIR}" "${SQ_TEMP_DIR}"; \ | ||
apt-get remove -y gnupg unzip; \ | ||
rm -rf /var/lib/apt/lists/*; | ||
|
||
VOLUME ["${SQ_DATA_DIR}", "${SQ_EXTENSIONS_DIR}", "${SQ_LOGS_DIR}", "${SQ_TEMP_DIR}"] | ||
|
||
COPY run.sh sonar.sh ${SONARQUBE_HOME}/docker/ | ||
|
||
WORKDIR ${SONARQUBE_HOME} | ||
EXPOSE 9000 | ||
|
||
USER sonarqube | ||
STOPSIGNAL SIGINT | ||
|
||
ENTRYPOINT ["/opt/sonarqube/docker/run.sh"] | ||
CMD ["/opt/sonarqube/docker/sonar.sh"] |
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,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
HOSTNAME=$(hostname) | ||
IP=$(ip -4 address show scope global | grep inet | awk '{ print $2 }' | head -n 1 | cut -d \/ -f 1) | ||
|
||
declare -a sq_opts=() | ||
set_prop() { | ||
if [ "$2" ]; then | ||
sq_opts+=("-D$1=$2") | ||
fi | ||
} | ||
|
||
# if nothing is passed, assume we want to run sonarqube server | ||
if [ "$#" == 0 ]; then | ||
set -- /opt/sonarqube/docker/sonar.sh | ||
fi | ||
|
||
# if first arg looks like a flag, assume we want to run sonarqube server with flags | ||
if [ "${1:0:1}" = '-' ]; then | ||
set -- /opt/sonarqube/docker/sonar.sh "$@" | ||
fi | ||
|
||
if [[ "$1" = '/opt/sonarqube/docker/sonar.sh' ]]; then | ||
|
||
# | ||
# Change log path to ensure every app node can write in their own directory | ||
# This resolves a cluttered log on docker-compose with scale > 1 | ||
# | ||
if [ -z "${SONAR_PATH_LOGS:-}" ] | ||
then | ||
SONAR_CLUSTER_PATH_LOGS="logs/${HOSTNAME}" | ||
mkdir -p ${SONARQUBE_HOME}/${SONAR_CLUSTER_PATH_LOGS} | ||
else | ||
SONAR_CLUSTER_PATH_LOGS="${SONAR_PATH_LOGS}/${HOSTNAME}" | ||
mkdir -p ${SONAR_CLUSTER_PATH_LOGS}} | ||
fi | ||
|
||
# | ||
# Set mandatory properties | ||
# | ||
set_prop "sonar.cluster.node.host" "${IP:-}" | ||
set_prop "sonar.path.logs" "${SONAR_CLUSTER_PATH_LOGS:-}" | ||
if [ ${#sq_opts[@]} -ne 0 ]; then | ||
set -- "$@" "${sq_opts[@]}" | ||
fi | ||
fi | ||
|
||
exec "$@" |
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,3 @@ | ||
#!/usr/bin/env bash | ||
# JVM args needed for hazelcast | ||
exec /opt/java/openjdk/bin/java --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -jar lib/sonar-application-"${SONAR_VERSION}".jar -Dsonar.log.console=true "$@" |
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,81 @@ | ||
FROM eclipse-temurin:17-jre-noble | ||
|
||
LABEL io.k8s.description="SonarQube Server is a self-managed, automatic code review tool that systematically helps you deliver Clean Code." | ||
LABEL io.openshift.min-cpu=400m | ||
LABEL io.openshift.min-memory=2048M | ||
LABEL io.openshift.non-scalable=false | ||
LABEL io.openshift.tags=sonarqube,static-code-analysis,code-quality,clean-code | ||
LABEL org.opencontainers.image.url=https://github.com/SonarSource/docker-sonarqube | ||
LABEL com.googleapis.cloudmarketplace.product.service.name=services/sonarqube-dce | ||
|
||
ENV LANG='en_US.UTF-8' \ | ||
LANGUAGE='en_US:en' \ | ||
LC_ALL='en_US.UTF-8' | ||
|
||
# | ||
# SonarQube setup | ||
# | ||
ARG SONARQUBE_VERSION=2025.1.0.102418 | ||
ARG SONARQUBE_ZIP_URL=https://binaries.sonarsource.com/CommercialDistribution/sonarqube-datacenter/sonarqube-datacenter-${SONARQUBE_VERSION}.zip | ||
ENV DOCKER_RUNNING="true" \ | ||
JAVA_HOME='/opt/java/openjdk' \ | ||
SONARQUBE_HOME=/opt/sonarqube \ | ||
SONAR_VERSION="${SONARQUBE_VERSION}" \ | ||
SQ_DATA_DIR="/opt/sonarqube/data" \ | ||
SQ_EXTENSIONS_DIR="/opt/sonarqube/extensions" \ | ||
SQ_LOGS_DIR="/opt/sonarqube/logs" \ | ||
SQ_TEMP_DIR="/opt/sonarqube/temp" \ | ||
SONAR_CLUSTER_NODE_TYPE="search" \ | ||
SONAR_CLUSTER_ENABLED="true" | ||
|
||
# Separate stage to use variable expansion | ||
ENV ES_TMPDIR="${SQ_TEMP_DIR}" | ||
|
||
RUN set -eux; \ | ||
deluser ubuntu; \ | ||
useradd --system --uid 1000 --gid 0 sonarqube; \ | ||
apt-get update; \ | ||
apt-get --no-install-recommends -y install \ | ||
bash \ | ||
curl \ | ||
fonts-dejavu \ | ||
gnupg \ | ||
iproute2 \ | ||
unzip; \ | ||
echo "networkaddress.cache.ttl=5" >> "${JAVA_HOME}/conf/security/java.security"; \ | ||
sed --in-place --expression="s?securerandom.source=file:/dev/random?securerandom.source=file:/dev/urandom?g" "${JAVA_HOME}/conf/security/java.security"; \ | ||
# pub 2048R/D26468DE 2015-05-25 | ||
# Key fingerprint = F118 2E81 C792 9289 21DB CAB4 CFCA 4A29 D264 68DE | ||
# uid sonarsource_deployer (Sonarsource Deployer) <[email protected]> | ||
# sub 2048R/06855C1D 2015-05-25 | ||
for server in $(shuf -e hkps://keys.openpgp.org \ | ||
hkps://keyserver.ubuntu.com) ; do \ | ||
gpg --batch --keyserver "${server}" --recv-keys 679F1EE92B19609DE816FDE81DB198F93525EC1A && break || : ; \ | ||
done; \ | ||
mkdir --parents /opt; \ | ||
cd /opt; \ | ||
curl --fail --location --output sonarqube.zip --silent --show-error "${SONARQUBE_ZIP_URL}"; \ | ||
curl --fail --location --output sonarqube.zip.asc --silent --show-error "${SONARQUBE_ZIP_URL}.asc"; \ | ||
gpg --batch --verify sonarqube.zip.asc sonarqube.zip; \ | ||
unzip -q sonarqube.zip; \ | ||
mv "sonarqube-${SONARQUBE_VERSION}" sonarqube; \ | ||
rm sonarqube.zip*; \ | ||
rm -rf ${SONARQUBE_HOME}/bin/*; \ | ||
ln -s "${SONARQUBE_HOME}/lib/sonar-application-${SONARQUBE_VERSION}.jar" "${SONARQUBE_HOME}/lib/sonarqube.jar"; \ | ||
chmod -R 550 ${SONARQUBE_HOME}; \ | ||
chmod -R 770 "${SQ_DATA_DIR}" "${SQ_EXTENSIONS_DIR}" "${SQ_LOGS_DIR}" "${SQ_TEMP_DIR}"; \ | ||
apt-get remove -y gnupg unzip curl; \ | ||
rm -rf /var/lib/apt/lists/*; | ||
|
||
VOLUME ["${SQ_DATA_DIR}", "${SQ_EXTENSIONS_DIR}", "${SQ_LOGS_DIR}", "${SQ_TEMP_DIR}"] | ||
|
||
COPY run.sh sonar.sh ${SONARQUBE_HOME}/docker/ | ||
|
||
WORKDIR ${SONARQUBE_HOME} | ||
EXPOSE 9000 | ||
|
||
USER sonarqube | ||
STOPSIGNAL SIGINT | ||
|
||
ENTRYPOINT ["/opt/sonarqube/docker/run.sh"] | ||
CMD ["/opt/sonarqube/docker/sonar.sh"] |
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,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
HOSTNAME=$(hostname) | ||
IP=$(ip -4 address show scope global | grep inet | awk '{ print $2 }' | head -n 1 | cut -d \/ -f 1) | ||
|
||
declare -a sq_opts=() | ||
set_prop() { | ||
if [ "$2" ]; then | ||
sq_opts+=("-D$1=$2") | ||
fi | ||
} | ||
|
||
# if nothing is passed, assume we want to run sonarqube server | ||
if [ "$#" == 0 ]; then | ||
set -- /opt/sonarqube/docker/sonar.sh | ||
fi | ||
|
||
# if first arg looks like a flag, assume we want to run sonarqube server with flags | ||
if [ "${1:0:1}" = '-' ]; then | ||
set -- /opt/sonarqube/docker/sonar.sh "$@" | ||
fi | ||
|
||
if [[ "$1" = '/opt/sonarqube/docker/sonar.sh' ]]; then | ||
|
||
# | ||
# Set mandatory properties | ||
# | ||
set_prop "sonar.cluster.node.search.host" "${IP:-}" | ||
set_prop "sonar.cluster.node.es.host" "${IP:-}" | ||
|
||
if [ ${#sq_opts[@]} -ne 0 ]; then | ||
set -- "$@" "${sq_opts[@]}" | ||
fi | ||
fi | ||
|
||
exec "$@" |
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,3 @@ | ||
#!/usr/bin/env bash | ||
# JVM args needed for hazelcast | ||
exec /opt/java/openjdk/bin/java --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -jar lib/sonar-application-"${SONAR_VERSION}".jar -Dsonar.log.console=true "$@" |
Oops, something went wrong.