Skip to content

Commit 4cdee15

Browse files
committed
console: add nightly builds and schema gen
This commit configures CI to push nightly builds of the console chart to the console-unstable docker repository to aid in the release of console V3. Additionally, this commit adds schema generation to the console chart to prevent usage of out of date values files.
1 parent 7963626 commit 4cdee15

File tree

6 files changed

+42
-26
lines changed

6 files changed

+42
-26
lines changed

Taskfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ vars:
4141
OPERATOR_CHART_VERSION:
4242
# NB: OPERATOR_CHART_VERSION is currently only used for the operator chart's nightly releases.
4343
sh: git describe --dirty --tags --match 'charts/operator/v*' --always | sed 's#^charts/operator/##'
44+
CONSOLE_CHART_VERSION:
45+
# NB: CONSOLE_CHART_VERSION is currently only used for the console chart's nightly releases.
46+
sh: git describe --dirty --tags --match 'charts/console/v*' --always | sed 's#^charts/console/##'
4447

4548
includes:
4649
build: taskfiles/build.yml

gen/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ replace (
77
// want it to always operate on the current chart version.
88
github.com/redpanda-data/redpanda-operator/charts/operator => ../charts/operator
99
github.com/redpanda-data/redpanda-operator/charts/redpanda/v5 => ../charts/redpanda
10+
github.com/redpanda-data/redpanda-operator/charts/console => ../charts/console
1011
pgregory.net/rapid => github.com/chrisseto/rapid v0.0.0-20240815210052-cdeef406c65c
1112
)
1213

gen/schema/schema.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ import (
2222
"k8s.io/apimachinery/pkg/api/resource"
2323
"k8s.io/apimachinery/pkg/util/intstr"
2424

25+
"github.com/redpanda-data/redpanda-operator/charts/console"
2526
"github.com/redpanda-data/redpanda-operator/charts/operator"
2627
"github.com/redpanda-data/redpanda-operator/charts/redpanda/v5"
2728
"github.com/redpanda-data/redpanda-operator/pkg/valuesutil"
2829
)
2930

3031
var schemas = map[string]any{
3132
"redpanda": &redpanda.Values{},
33+
"console": &console.Values{},
3234
"operator": &operator.Values{},
3335
}
3436

taskfiles/charts.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ tasks:
1616
cmds:
1717
- task: genpartial
1818
vars: { CHART: console }
19+
- task: genschema
20+
vars: { CHART: console }
1921
- task: gotohelm
2022
vars: { CHART: console }
2123

taskfiles/ci.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,40 @@ tasks:
145145
- linux/arm64
146146
CLI_ARGS: "--push"
147147
# Package and push Operator helm chart to Dockerhub
148-
- task: :k8s:package-and-publish-operator-chart
148+
- task: publish:nightly:helm:chart
149+
vars: {REPO: redpanda-operator-nightly, CHART: operator, VERSION: "{{ .OPERATOR_CHART_VERSION }}"}
150+
- task: publish:nightly:helm:chart
151+
vars: {REPO: console-unstable, CHART: console, VERSION: "{{ .CONSOLE_CHART_VERSION }}"}
152+
153+
publish:nightly:helm:chart:
154+
desc: "Packages and pushes a helm chart to redpandadata's dockerhub account as an OCI artifact"
155+
label: "publish:helm:chart:{{ .CHART }}"
156+
requires:
157+
vars: [CHART, VERSION, REPO]
158+
vars:
159+
TMP_PATH:
160+
sh: mktemp --directory --tmpdir "helm-package-XXXXXXXXXX"
161+
cmds:
162+
- defer: 'rm -r {{.TMP_PATH}}'
163+
# NB: cp -r/-R is dependent on the implementation (macOS vs Linux).
164+
# cp -R src/. dest/ <- Same behavior, copy contents of src to dest.
165+
# cp -r src/ dest <- Different. macOS == copy contents, linux == copy src folder into dest.
166+
- cp -R charts/{{ .CHART }}/. {{.TMP_PATH}}
167+
# `helm push`, to an OCI repo, uses `name` and `version` from Chart.yaml
168+
# to determine where to push the chart to.
169+
# i.e. `helm push chart.tgz oci://registry-1.docker.io/<org>` -> <org>/<chart.name>:<chart.version>
170+
# name is set with `yq`
171+
# version is set with `helm package`
172+
- yq -i '.name = "{{ .REPO }}"' {{.TMP_PATH}}/Chart.yaml
173+
# dockerhub has a limitation where oci artifacts may not share tags with images [1].
174+
# We suffix versions with `-helm-chart` to work around this.
175+
# [1]: https://forums.docker.com/t/tag-overlap-in-oci-artifacts/131453
176+
- helm package {{.TMP_PATH}} --version "{{ .VERSION }}-helm-chart" --destination {{.BUILD_ROOT}} --dependency-update
177+
- helm registry login registry-1.docker.io -u {{.DOCKERHUB_USER}} --password {{.DOCKERHUB_TOKEN}}
178+
- defer: 'helm registry logout registry-1.docker.io'
179+
# For usage of operator artifact please go to specific reference like the one below
180+
# https://hub.docker.com/layers/redpandadata/redpanda-operator-nightly/v0.0.0-20250104git4a5a076-helm-chart/images/sha256-ffaea8752b6bd00a26589a168830a87d498106e470f11af0f08267bc13fbd078
181+
- helm push '{{.BUILD_ROOT}}/{{ .REPO }}-{{.VERSION}}-helm-chart.tgz' oci://registry-1.docker.io/redpandadata
149182

150183
set-aio-max:
151184
internal: true

taskfiles/k8s.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,3 @@ tasks:
108108
cmds:
109109
- mkdir -p {{.KUTTL_ARTIFACTS_DIR}}
110110
- kuttl test --config "{{.KUTTL_CONFIG_FILE}}" {{.CLI_ARGS}}
111-
112-
package-and-publish-operator-chart:
113-
vars:
114-
TMP_PATH:
115-
sh: mktemp --directory --tmpdir "helm-package-XXXXXXXXXX"
116-
cmds:
117-
- defer: 'rm -r {{.TMP_PATH}}'
118-
# NB: cp -r/-R is dependent on the implementation (macOS vs Linux).
119-
# cp -R src/. dest/ <- Same behavior, copy contents of src to dest.
120-
# cp -r src/ dest <- Different. macOS == copy contents, linux == copy src folder into dest.
121-
- cp -R charts/operator/. {{.TMP_PATH}}
122-
# The Chart.yaml name needs to match with docker hub OCI registry, so that helm push correctly
123-
# finds OCI registry.
124-
# Reference
125-
# https://hub.docker.com/r/redpandadata/redpanda-operator-nightly
126-
- yq -i '.name = "redpanda-operator-nightly"' {{.TMP_PATH}}/Chart.yaml
127-
# The version has suffix -helm-chart to overcome docker hub limitation of the oci artifact types
128-
# Reference
129-
# https://forums.docker.com/t/tag-overlap-in-oci-artifacts/131453
130-
# For usage of operator artifact please go to specific reference like the one below
131-
# https://hub.docker.com/layers/redpandadata/redpanda-operator-nightly/v0.0.0-20250104git4a5a076-helm-chart/images/sha256-ffaea8752b6bd00a26589a168830a87d498106e470f11af0f08267bc13fbd078
132-
- helm package {{.TMP_PATH}} --version "{{.OPERATOR_CHART_VERSION}}-helm-chart" --destination {{.BUILD_ROOT}} --dependency-update
133-
- helm registry login registry-1.docker.io -u {{.DOCKERHUB_USER}} --password {{.DOCKERHUB_TOKEN}}
134-
- defer: 'helm registry logout registry-1.docker.io'
135-
- helm push '{{.BUILD_ROOT}}/redpanda-operator-nightly-{{.OPERATOR_CHART_VERSION}}-helm-chart.tgz' oci://registry-1.docker.io/redpandadata

0 commit comments

Comments
 (0)