Skip to content

Commit 4c9df46

Browse files
committed
SONAR-23559 Improves editions and versions setting for sonarqube chart
1 parent 552f8af commit 4c9df46

File tree

99 files changed

+1418
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1418
-258
lines changed

.cirrus/Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG CIRRUS_AWS_ACCOUNT
2-
FROM ${CIRRUS_AWS_ACCOUNT:-275878209202}.dkr.ecr.eu-central-1.amazonaws.com/base:j11-latest as tools
2+
FROM ${CIRRUS_AWS_ACCOUNT:-275878209202}.dkr.ecr.eu-central-1.amazonaws.com/base:j11-latest AS tools
33

4-
FROM docker:20.10
4+
FROM docker:27.4
55

66
USER root
77

@@ -27,24 +27,25 @@ ENV PATH=/usr/bin/google-cloud-sdk/bin:${PATH}
2727

2828
RUN apk add --update --no-cache \
2929
aws-cli \
30-
ca-certificates \
3130
bash \
32-
jq \
33-
moreutils \
31+
ca-certificates \
3432
curl \
3533
gcompat \
3634
git \
3735
gnupg \
36+
go \
37+
jq \
3838
libc6-compat \
3939
libstdc++ \
40+
moreutils \
4041
openssh-client \
4142
py3-pip \
4243
py3-wheel \
4344
python3 && \
44-
pip install --upgrade pip==24.2
45+
pip install --break-system-packages --upgrade pip==24.2
4546

46-
RUN pip install "yamllint==${YAMLLINT_VERSION}" && \
47-
pip install "yamale==${YAMALE_VERSION}"
47+
RUN pip install --break-system-packages "yamllint==${YAMLLINT_VERSION}" && \
48+
pip install --break-system-packages "yamale==${YAMALE_VERSION}"
4849

4950
RUN set -eux; \
5051
curl -sL ${HELM_BASE_URL}/${HELM_TAR_FILE} -o ${HELM_TAR_FILE} ; \

.cirrus/schema_test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
cd "$(dirname "$0")/../tests/unit-test"
6+
7+
go test -timeout=0 -v schema_test.go

.cirrus/tasks.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ chart_static_compatibility_test_task:
137137
- ./.cirrus/build_chart_dependencies.sh charts/sonarqube-dce
138138
- ./.cirrus/unit_helm_compatibility_test.sh sonarqube-dce
139139

140+
chart_schema_test_task:
141+
eks_container:
142+
<<: *CONTAINER_TEMPLATE
143+
cpu: 1
144+
memory: 2Gb
145+
<<: *CLONE_SCRIPT_TEMPLATE
146+
script:
147+
- ./.cirrus/build_chart_dependencies.sh charts/sonarqube
148+
- ./.cirrus/build_chart_dependencies.sh charts/sonarqube-dce
149+
- ./.cirrus/schema_test.sh
150+
140151
chart_fixture_test_task:
141152
<<: *ONLY_ON_NON_RELEASE_DRAFT_TEMPLATE
142153
timeout_in: 30m

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
gcloud 470.0.0
22
helm-ct 3.10.1
33
kubeconform 0.6.3
4+
golang 1.22.0

charts/sonarqube/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All changes to this chart will be documented in this file.
66
* Update ingress-nginx subchart to 4.11.3
77
* Support Kubernetes v1.32
88
* Remove the default passcode provided with `monitoringPasscode`
9+
* Improves editions and versions setting for sonarqube chart
910

1011
## [10.8.1]
1112
* Update Chart's version to 10.8.1

charts/sonarqube/Chart.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ annotations:
3838
description: "Support Kubernetes v1.32"
3939
- kind: changed
4040
description: "Remove the default passcode provided with 'monitoringPasscode'"
41+
- kind: changed
42+
description: "Improves editions and versions setting for sonarqube chart"
4143
artifacthub.io/containsSecurityUpdates: "false"
4244
artifacthub.io/images: |
4345
- name: sonarqube

charts/sonarqube/ci/cirrus-values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
community:
2+
enabled: true
3+
14
image:
25
pullSecrets:
36
- name: pullsecret

charts/sonarqube/openshift-verifier/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
community:
2+
enabled: true
3+
14
OpenShift:
25
enabled: true
36
route:

charts/sonarqube/templates/_helpers.tpl

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,39 @@ Expand the Application Image name.
5858

5959
{{/*
6060
Define the image.tag value that computes the right tag to be used as `sonarqube.image`
61+
The tag is derived from the following parameters:
62+
- .Values.image.tag
63+
- .Values.community.enabled
64+
- .Values.community.buildNumber
65+
- .Values.edition
66+
- .Chart.AppVersion
67+
68+
The logic to generate the tag is as follows:
69+
There should not be a default edition, with users that specify it.
70+
The edition must be one of these values: developer/enterprise.
71+
When “edition“ is used and “image.tag” is not, we use “appVersion” for paid editions and the latest release of SQ-CB for the community.
72+
The CI supports the release of the Server edition.
6173
*/}}
6274
{{- define "image.tag" -}}
63-
{{- if empty .Values.image.tag -}}
64-
{{- if and (not (empty .Values.edition)) (or (eq .Values.edition "developer") (eq .Values.edition "enterprise")) -}}
65-
{{- printf "%s-%s" .Chart.AppVersion .Values.edition -}}
66-
{{- else if or (.Values.community.enabled) (and (not (empty .Values.edition)) (eq .Values.edition "community")) -}}
67-
{{- printf "%s-%s" .Values.community.buildNumber "community" -}}
68-
{{- end -}}
69-
{{- else -}}
70-
{{- .Values.image.tag -}}
71-
{{- end -}}
75+
{{- $imageTag := "" -}}
76+
{{- if not (empty .Values.edition) -}}
77+
{{- if or (empty .Values.image) (empty .Values.image.tag) -}}
78+
{{- $imageTag = printf "%s-%s" .Chart.AppVersion .Values.edition -}}
79+
{{- else -}}
80+
{{- $imageTag = printf "%s" .Values.image.tag -}}
81+
{{- end -}}
82+
{{- else if (and (.Values.community) .Values.community.enabled) -}}
83+
{{- if or (empty .Values.image) (empty .Values.image.tag) -}}
84+
{{- if not (empty .Values.community.buildNumber) -}}
85+
{{- $imageTag = printf "%s-%s" .Values.community.buildNumber "community" -}}
86+
{{- else -}}
87+
{{- $imageTag = printf "community" -}}
88+
{{- end -}}
89+
{{- else -}}
90+
{{- $imageTag = printf "%s" .Values.image.tag -}}
91+
{{- end -}}
92+
{{- end -}}
93+
{{- printf "%s" $imageTag -}}
7294
{{- end -}}
7395

7496
{{/*
@@ -431,4 +453,4 @@ Remove incompatible user/group values that do not work in Openshift out of the b
431453

432454
{{- $accountDeprecation := (include "deepMerge" (dict "map1" $map1 "map2" $map2)) -}}
433455
{{- $accountDeprecation }}
434-
{{- end -}}
456+
{{- end -}}

charts/sonarqube/values.schema.json

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
"properties": {
77
"edition": {
88
"type": "string",
9-
"enum": ["community", "developer", "enterprise"],
10-
"properties": {
11-
"community": {
12-
"type": "string",
13-
"deprecated": true,
14-
"$comment": "(DEPRECATED) Please use `community.enabled` instead"
15-
}
16-
}
9+
"enum": [
10+
"developer",
11+
"enterprise"
12+
]
1713
},
1814
"persistence": {
1915
"type": "object",
@@ -40,8 +36,7 @@
4036
}
4137
}
4238
},
43-
"OpenShift":
44-
{
39+
"OpenShift": {
4540
"type": "object",
4641
"properties": {
4742
"createSCC": {
@@ -98,7 +93,10 @@
9893
},
9994
"replicaCount": {
10095
"type": "integer",
101-
"enum": [0, 1]
96+
"enum": [
97+
0,
98+
1
99+
]
102100
},
103101
"jvmOpts": {
104102
"type": "string",
@@ -172,20 +170,17 @@
172170
"deprecated": true,
173171
"$comment": "(DEPRECATED) this option will be removed in the next major release"
174172
},
175-
"curlContainerImage":
176-
{
173+
"curlContainerImage": {
177174
"type": "string",
178175
"deprecated": true,
179176
"$comment": "(DEPRECATED) please use `setAdminPassword.image` at the value top level"
180177
},
181-
"adminJobAnnotations":
182-
{
178+
"adminJobAnnotations": {
183179
"type": "object",
184180
"deprecated": true,
185181
"$comment": "(DEPRECATED) please use `setAdminPassword.annotations` at the value top level"
186182
},
187-
"sonarqubeFolder":
188-
{
183+
"sonarqubeFolder": {
189184
"type": "string",
190185
"deprecated": true,
191186
"$comment": "(DEPRECATED) This value will is no longer required and will be dropped in future releases"
@@ -205,5 +200,65 @@
205200
}
206201
}
207202
}
208-
}
209-
}
203+
},
204+
"allOf": [
205+
{
206+
"if": {
207+
"properties": {
208+
"community": {
209+
"properties": {
210+
"enabled": {
211+
"const": true
212+
}
213+
}
214+
}
215+
}
216+
},
217+
"then": {
218+
"properties": {
219+
"edition": {
220+
"maxLength": 0
221+
}
222+
}
223+
}
224+
},
225+
{
226+
"if": {
227+
"properties": {
228+
"community": {
229+
"properties": {
230+
"enabled": {
231+
"const": false
232+
}
233+
}
234+
}
235+
}
236+
},
237+
"then": {
238+
"required": [
239+
"edition"
240+
]
241+
}
242+
},
243+
{
244+
"if": {
245+
"not": {
246+
"properties": {
247+
"community": {
248+
"properties": {
249+
"enabled": {
250+
"type": "boolean"
251+
}
252+
}
253+
}
254+
}
255+
}
256+
},
257+
"then": {
258+
"required": [
259+
"edition"
260+
]
261+
}
262+
}
263+
]
264+
}

charts/sonarqube/values.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@ OpenShift:
4848
# labels:
4949
# external: 'true'
5050

51-
# (DEPRECATED) The "community" value as the default of "edition" is deprecated and will be removed in the next release (in favor of an empty value). Please set "community" to "true", if you want to use SonarQube Community Build.
52-
edition: "community"
51+
# Configure the edition of SonarQube Server to deploy: developer or enterprise
52+
# edition: ""
5353

5454
# Set the chart to use the latest released SonarQube Community Build
5555
community:
56-
enabled: true
56+
enabled: false
5757
buildNumber: "24.12.0.100206"
5858

5959
image:
6060
repository: sonarqube
61-
# (DEPRECATED) The "image.tag" parameter is set to be empty as default.
62-
# image.tag is set according to the edition and community fields, user-defined have precedance.
63-
# tag: 10.8.1-{{ .Values.edition }}
61+
# tag: ""
6462
pullPolicy: IfNotPresent
6563
# If using a private repository, the imagePullSecrets to use
6664
# pullSecrets:
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
## Execute tests
1+
# Execute tests
22

3-
In order to execute the dynamic compability test locally, you need to have a k8s cluster running (configurations stored in the default folder), go (at least version 1.13).
3+
## Dynamic compatibility tests
44

5-
When the pre-requisites are fullfilled, just run:
5+
In order to execute the dynamic compatibility test locally, you need to have a k8s cluster running (configurations stored in the default folder), go (at least version 1.22).
66

7-
```
7+
When the pre-requisites are fulfilled, just run:
8+
9+
```bash
810
go test -timeout=0 -v sonarqube_standard_dynamic_test.go pod_utils.go
9-
```
11+
```
12+
13+
## Schema validation tests
14+
15+
```bash
16+
go test -v schema_test.go
17+
```

0 commit comments

Comments
 (0)