Publish portable nextcloud-whiteboard chart
Validate, publish and promote nextcloud-whiteboard chart / chart (push) Successful in 34s

This commit is contained in:
2026-10-20 09:31:49 +02:00
commit ee7b0eaf76
9 changed files with 294 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
name: Validate, publish and promote nextcloud-whiteboard chart
on:
push:
pull_request:
jobs:
chart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/setup-helm@v4
with:
version: v4.3.0
- name: Validate chart
run: |
python3 -m venv "${RUNNER_TEMP}/chart-test"
"${RUNNER_TEMP}/chart-test/bin/pip" install PyYAML
PATH="${RUNNER_TEMP}/chart-test/bin:${PATH}" bash chart/test.sh
- name: Select immutable chart version
if: gitea.ref == 'refs/heads/main'
run: printf 'CHART_VERSION=%s\n' "$(./scripts/chart-version.sh)" >> "${GITHUB_ENV}"
- name: Publish chart
if: gitea.ref == 'refs/heads/main'
env:
PACKAGE_USERNAME: ${{ secrets.PACKAGE_USERNAME }}
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
run: |
set -euo pipefail
test -n "${PACKAGE_USERNAME}" && test -n "${PACKAGE_TOKEN}"
mkdir -p .chart-packages
helm package chart/nextcloud-whiteboard --destination .chart-packages --version "${CHART_VERSION}"
curl --fail --silent --show-error --user "${PACKAGE_USERNAME}:${PACKAGE_TOKEN}" \
--request POST --upload-file ".chart-packages/nextcloud-whiteboard-${CHART_VERSION}.tgz" \
https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts
- name: Check current main
id: current-main
if: gitea.ref == 'refs/heads/main'
env:
COMMIT_SHA: ${{ gitea.sha }}
run: |
git fetch --no-tags origin main
if test "$(git rev-parse FETCH_HEAD)" = "${COMMIT_SHA}"; then
echo 'promote=true' >> "${GITEA_OUTPUT}"
else
echo 'promote=false' >> "${GITEA_OUTPUT}"
fi
- uses: actions/checkout@v4
if: steps.current-main.outputs.promote == 'true'
with:
repository: feedc0de/homelab-gitops
ref: main
token: ${{ secrets.GITOPS_TOKEN }}
path: homelab-gitops
- name: Promote chart
if: steps.current-main.outputs.promote == 'true'
working-directory: homelab-gitops
run: |
set -euo pipefail
./scripts/update-chart-version.sh nextcloud-whiteboard "${CHART_VERSION}"
git config user.name feedc0de
git config user.email feedc0de@users.noreply.code.brunner.ninja
git add bootstrap/nextcloud-whiteboard.yaml
if git diff --cached --quiet; then exit 0; fi
git commit -m "Deploy nextcloud-whiteboard chart ${CHART_VERSION}"
for attempt in 1 2 3; do
git push origin HEAD:main && exit 0
test "${attempt}" = 3 && exit 1
git fetch origin main
git rebase origin/main
done
+1
View File
@@ -0,0 +1 @@
.chart-packages/
+26
View File
@@ -0,0 +1,26 @@
# Nextcloud Whiteboard
This repository maintains a portable Helm chart for the Nextcloud Whiteboard integration.
It is used with the upstream Nextcloud Helm release. The application image is
`ghcr.io/nextcloud-releases/whiteboard:v2.0.0`; the chart selects that tested tag through
`Chart.yaml.appVersion`, while GitOps selects only the chart version.
The chart requires a Secret containing the same JWT key configured in Nextcloud.
```sh
helm repo add brunner.ninja https://brunner.ninja/charts
helm repo update brunner.ninja
VALUES_FILE=values.yaml ./install.sh
```
The chart and its templates own the Kubernetes workload contract; set hostnames,
Ingress annotations, resources, and Secret names through values. The live
[homelab configuration](https://code.brunner.ninja/feedc0de/homelab-gitops/src/branch/main/apps/nextcloud)
is an example, not a portable default. Run `bash chart/test.sh` before
publishing.
The Git tag follows the actual upstream release `v2.0.0`. Its first chart
package is `2.0.0`; later chart-only commits append the commit count
and Git hash. CI publishes the package to the indexed
`https://brunner.ninja/charts` repository and promotes only this chart's
Argo CD targetRevision.
+6
View File
@@ -0,0 +1,6 @@
apiVersion: v2
name: nextcloud-whiteboard
description: Nextcloud Whiteboard integration
type: application
version: 0.0.0
appVersion: v2.0.0
@@ -0,0 +1,100 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: nextcloud-whiteboard
app.kubernetes.io/instance: {{ .Values.nextcloudReleaseName }}
spec:
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app.kubernetes.io/name: nextcloud-whiteboard
app.kubernetes.io/instance: {{ .Values.nextcloudReleaseName }}
template:
metadata:
labels:
app.kubernetes.io/name: nextcloud-whiteboard
app.kubernetes.io/instance: {{ .Values.nextcloudReleaseName }}
spec:
automountServiceAccountToken: false
containers:
- name: whiteboard
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
env:
- name: NEXTCLOUD_URL
value: {{ .Values.nextcloudUrl | quote }}
- name: JWT_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.jwtSecret.name }}
key: {{ .Values.jwtSecret.key }}
- name: HOST
value: 0.0.0.0
- name: TLS
value: 'false'
- name: STORAGE_STRATEGY
value: lru
- name: RECORDINGS_DIR
value: /tmp/whiteboard-recordings
ports:
- name: http
containerPort: 3002
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 30
resources:
{{- toYaml .Values.resources | nindent 10 }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
securityContext:
seccompProfile:
type: RuntimeDefault
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
spec:
selector:
app.kubernetes.io/name: nextcloud-whiteboard
app.kubernetes.io/instance: {{ .Values.nextcloudReleaseName }}
ports:
- name: http
port: 3002
targetPort: http
---
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}
annotations:
{{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}
port:
name: http
{{- end }}
+13
View File
@@ -0,0 +1,13 @@
image:
repository: ghcr.io/nextcloud-releases/whiteboard
nextcloudReleaseName: nextcloud
nextcloudUrl: https://nextcloud.example.org
jwtSecret:
name: nextcloud-integrations
key: whiteboard-jwt
resources: {}
ingress:
enabled: false
className: ""
host: whiteboard.example.org
annotations: {}
Executable
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
chart_name=$(basename "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/nextcloud-whiteboard" && pwd)")
chart_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/nextcloud-whiteboard" && pwd)
helm lint "$chart_dir" --strict
python3 - "$chart_dir" "$chart_name" <<'PY'
import subprocess,sys,yaml
chart,name=sys.argv[1:]
with open(chart+'/Chart.yaml') as f: metadata=yaml.safe_load(f)
def render(*args):
output=subprocess.check_output(['helm','template',name,chart,'--namespace','nextcloud',*args],text=True)
return {(x['kind'],x['metadata']['name']):x for x in yaml.safe_load_all(output) if x}
default=render()
enabled=render('--set','ingress.enabled=true','--set','monitoring.enabled=true')
assert ('Service',name) in default
assert ('Ingress',name) not in default
if name!='nextcloud-clamav':
assert ('Ingress',name) in enabled
if name=='nextcloud-notify-push':
assert ('ServiceMonitor',name) in enabled
else:
assert ('Deployment',name) in default
images=[c['image'] for c in default['Deployment',name]['spec']['template']['spec'].get('initContainers',[])+default['Deployment',name]['spec']['template']['spec']['containers']]
assert all(image.endswith(':'+metadata['appVersion']) for image in images)
if name=='nextcloud-clamav':
assert ('PersistentVolumeClaim',name) in default
assert not any(kind=='Secret' for kind,_ in enabled)
PY
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
set -eu
chart_name=$(basename "$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)")
namespace=${NAMESPACE:-nextcloud}
values_file=${VALUES_FILE:-values.yaml}
if [ ! -f "$values_file" ]; then
echo "Values file not found: $values_file" >&2
exit 1
fi
helm repo add brunner.ninja https://brunner.ninja/charts --force-update
helm repo update brunner.ninja
helm upgrade --install "$chart_name" "brunner.ninja/$chart_name" \
--namespace "$namespace" --create-namespace --values "$values_file" \
--wait --timeout 15m
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
repo_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
description=$(git -C "$repo_dir" describe --tags --long --dirty)
case "$description" in
*-dirty) echo 'Refusing to package a dirty tree.' >&2; exit 1 ;;
esac
if [[ "$description" =~ ^(.+)-([0-9]+)-g([0-9a-f]+)$ ]]; then
release_tag=${BASH_REMATCH[1]}
count=${BASH_REMATCH[2]}
hash=${BASH_REMATCH[3]}
else
echo "Unexpected git describe result: $description" >&2
exit 1
fi
case "$release_tag" in
v[0-9]*)
version=${release_tag#v}
;;
[0-9]*_[0-9]*)
date=${release_tag%%_*}
time=${release_tag#*_}
version="${date}.0.0-r${time}"
;;
*)
echo "Unsupported application release tag: $release_tag" >&2
exit 1
;;
esac
if [ "$count" -ne 0 ]; then
version="$version-$count-g$hash"
fi
printf '%s\n' "$version"