Skip to content

Commit d8898d9

Browse files
authored
Prepare release 4.11.1 (#1359)
1 parent 429f4ab commit d8898d9

5 files changed

Lines changed: 44 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88

99
### Fixed
1010

11+
## [4.11.1] - 2025-12-05
12+
13+
### Changed
14+
- Adapted Sonarqube server configuration to make projects private and have custom gate ([#1347](https://github.com/opendevstack/ods-core/pull/1347))
15+
1116
## [4.11.0] - 2025-12-03
1217

1318
### Added
1419
- New core component, OpenDevStack API service ([#1356](https://github.com/opendevstack/ods-core/pull/1356)) & ([#1357](https://github.com/opendevstack/ods-core/pull/1357))
1520

1621
### Changed
1722
- Change Cnes report to custom SonarQube report ([#1354](https://github.com/opendevstack/ods-core/pull/1354))
18-
- Adapted Sonarqube server configuration to make projects private and have custom gate ([#1347](https://github.com/opendevstack/ods-core/pull/1347))
1923
- Update Aqua cli to 2022.4.829 ([#1353](https://github.com/opendevstack/ods-core/pull/1353))
2024
- Update SonarQube and use local image for database ([#1343](https://github.com/opendevstack/ods-core/pull/1343))
2125
- Cleanup SonarQube backup process as data folder for server does not need backup ([#1355](https://github.com/opendevstack/ods-core/pull/1355))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
kind: ConfigMap
2+
metadata:
3+
labels:
4+
app: {{ .Values.global.appName }}
5+
name: {{ .Values.global.appName }}-scan
6+
apiVersion: v1
7+
data:
8+
alertEmails: {{ .Values.scan.sonarAlertEmails }}
9+
enabled: {{ .Values.scan.sonarEnabled | quote }}
10+
exclusions: {{ .Values.scan.sonarExclusions | quote }}
11+
nexusRepository: {{ .Values.scan.sonarNexusRepository }}
12+
sonarQubeAccount: {{ .Values.scan.sonarQubeAccount }}
13+
sonarQubeProjectsPrivate: {{ .Values.scan.sonarProjectsPrivate | quote }}

sonarqube/chart/values.yaml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ buildConfig:
5858
memRequest: 1Gi
5959
memLimit: 2Gi
6060
scan:
61-
sonarAlertEmails: $SONAR_SCAN_ALERT_EMAILS
6261
sonarEnabled: $SONAR_SCAN_ENABLED
6362
sonarExclusions: $SONAR_SCAN_EXCLUSIONS
6463
sonarNexusRepository: $SONAR_SCAN_NEXUS_REPOSITORY
64+
sonarAlertEmails: $SONAR_SCAN_ALERT_EMAILS
6565
sonarProjectsPrivate: $SONAR_SCAN_PROJECTS_PRIVATE
6666
sonarQubeAccount: $SONAR_SCAN_ACCOUNT

sonarqube/configure.sh

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,43 @@ else
210210
echo_info "Default '${ADMIN_USER_NAME}' password is not in use."
211211
fi
212212

213+
# Check whether pipeline user exists; create it if missing.
213214
echo_info "Checking if '${PIPELINE_USER_NAME}' exists ..."
214215
encodedPipelineUser="$(uriencode "${PIPELINE_USER_NAME}")"
215-
encodedPipelinePassword="$(uriencode "${ADMIN_USER_PASSWORD}")"
216-
if curl ${INSECURE} -X POST -sSf --user "${ADMIN_USER_NAME}:${ADMIN_USER_PASSWORD}" \
217-
"${SONARQUBE_URL}/api/users/search?q=${encodedPipelineUser}" | grep '"users":\[\]' >/dev/null; then
218-
echo_info "No user '${PIPELINE_USER_NAME}' present yet."
216+
217+
# Query SonarQube for matching users and get count (fallback to 0 on error).
218+
userCount=$(curl ${INSECURE} -sS --user "${ADMIN_USER_NAME}:${ADMIN_USER_PASSWORD}" \
219+
"${SONARQUBE_URL}/api/users/search?q=${encodedPipelineUser}" | jq -r '.users | length' || echo 0)
220+
221+
if [ "${userCount}" -eq 0 ]; then
222+
echo_info "No user '${PIPELINE_USER_NAME}' found — creating it now."
223+
219224
if [ -z "${PIPELINE_USER_PWD}" ]; then
220-
echo "Please enter '${PIPELINE_USER_NAME}' password:"
225+
echo "Enter password for '${PIPELINE_USER_NAME}':"
221226
read -r -e -s input
222227
PIPELINE_USER_PWD=${input:-""}
223228
fi
224-
echo_info "Trying to login in as '${PIPELINE_USER_NAME}' ..."
229+
230+
encodedPipelinePassword="$(uriencode "${PIPELINE_USER_PWD}")"
231+
232+
echo_info "Creating SonarQube user '${PIPELINE_USER_NAME}' ..."
233+
if ! curl ${INSECURE} -X POST -sSf --user "${ADMIN_USER_NAME}:${ADMIN_USER_PASSWORD}" \
234+
"${SONARQUBE_URL}/api/users/create?login=${encodedPipelineUser}&name=${encodedPipelineUser}&password=${encodedPipelinePassword}"; then
235+
echo_error "Could not create user '${PIPELINE_USER_NAME}'."
236+
exit 1
237+
fi
238+
echo_info "User '${PIPELINE_USER_NAME}' created."
239+
240+
echo_info "Verifying login for '${PIPELINE_USER_NAME}' ..."
225241
if ! curl ${INSECURE} -X POST -sSf \
226242
"${SONARQUBE_URL}/api/authentication/login?login=${encodedPipelineUser}&password=${encodedPipelinePassword}"; then
227-
echo_error "Could not login as '${PIPELINE_USER_NAME}'."
243+
echo_error "Login verification for '${PIPELINE_USER_NAME}' failed."
228244
exit 1
229245
fi
230246
echo_info "Login for '${PIPELINE_USER_NAME}' successful."
247+
else
248+
echo_info "User '${PIPELINE_USER_NAME}' already exists in SonarQube."
231249
fi
232-
echo_info "User '${PIPELINE_USER_NAME}' exists in SonarQube."
233250

234251
sampleToken=$(grep SONAR_AUTH_TOKEN_B64 "${ODS_CORE_DIR}/configuration-sample/ods-core.env.sample" | cut -d "=" -f 2-)
235252
configuredToken=$(grep SONAR_AUTH_TOKEN_B64 "${ODS_CONFIGURATION_DIR}/ods-core.env" | cut -d "=" -f 2- | base64 --decode)

0 commit comments

Comments
 (0)