feat(deploy): Helm chart
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Canceled after 5m11s
ci / test (pull_request) Canceled after 5m11s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Canceled after 5m11s
ci / test (pull_request) Canceled after 5m11s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
deploy/helm/uptimesebi runs the console and API (Deployment, Service, PodDisruptionBudget, Ingress) and optionally an in-cluster checker and status page servers. PostgreSQL and Redis are your own: by URL, from an existing secret, or Redis through Sentinel; Redis is not bundled. For trying it out, a single TimescaleDB can be bundled; its volume and password survive an uninstall and are picked up again by a reinstall. Migrations run as a pre-install/pre-upgrade hook with its own short-lived copy of the secrets; with the bundled database, which does not exist before the install, as an init container (runs serialize on the migration lock). Pods run as 65532 with a read-only root filesystem, no capabilities and RuntimeDefault seccomp; checkers get the safe ping sysctl. Missing settings fail rendering with a message. CI lints and renders the chart in several configurations; releases package it with the release version, sign it with the checksums and push it to the Gitea Helm registry. Closes #35 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
ac0d212a01
commit
a9de8b8d75
15 files changed
+1053
-2
No files matched your search
@@ -13,6 +13,7 @@ concurrency:
|
||||
env:
|
||||
GOLANGCI_LINT_VERSION: v2.15.0
|
||||
SQLC_VERSION: v1.31.1
|
||||
HELM_VERSION: v3.19.0
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -45,6 +46,19 @@ jobs:
|
||||
run: |
|
||||
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
|
||||
"$(go env GOPATH)/bin/golangci-lint" run ./...
|
||||
- name: Helm chart
|
||||
run: |
|
||||
curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" | tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
|
||||
chart=deploy/helm/uptimesebi
|
||||
base="--set publicURL=https://uptime.example.com --set redis.url=redis://redis:6379/0 --set secretKeys.value=k1:test"
|
||||
helm lint --strict "$chart" $base --set database.url=postgres://u:p@db/uptime
|
||||
# Every combination renders; missing settings fail with a message.
|
||||
helm template t "$chart" $base --set database.url=postgres://u:p@db/uptime >/dev/null
|
||||
helm template t "$chart" $base --set database.bundled.enabled=true --set ingress.enabled=true --set ingress.tls.enabled=true \
|
||||
--set checker.enabled=true --set checker.token=usa_x --set statuspage.enabled=true --set statuspage.token=usa_y \
|
||||
--set 'statuspage.hosts={status.example.com}' --set statuspage.ingress.enabled=true \
|
||||
--set redis.sentinel.master=m --set 'redis.sentinel.addrs={s1:26379}' --set redis.sentinel.password=p >/dev/null
|
||||
if helm template t "$chart" $base >/dev/null 2>&1; then echo "rendered without a database" >&2; exit 1; fi
|
||||
# The install script the API serves must stay POSIX sh for Alpine,
|
||||
# Debian and Raspberry Pi OS; the test renders and checks it.
|
||||
- name: shellcheck
|
||||
|
||||
@@ -33,6 +33,11 @@ jobs:
|
||||
fi
|
||||
- name: Build frontend
|
||||
run: npm ci --no-audit --no-fund && npm run build
|
||||
- name: Package Helm chart
|
||||
run: |
|
||||
curl -fsSL "https://get.helm.sh/helm-v3.19.0-linux-amd64.tar.gz" | tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
|
||||
# Chart and app version follow the release; image tags drop the v.
|
||||
helm package deploy/helm/uptimesebi --version "${GITHUB_REF_NAME#v}" --app-version "${GITHUB_REF_NAME#v}" -d dist
|
||||
- name: Build binaries
|
||||
run: |
|
||||
set -eu
|
||||
@@ -48,7 +53,7 @@ jobs:
|
||||
tar -C dist -czf "dist/$dir.tar.gz" "$dir"
|
||||
done
|
||||
go run ./tools/release sbom "$GITHUB_REF_NAME" dist/uptimesebi_*_linux_amd64/{api,checker,statuspage} > dist/sbom.spdx.json
|
||||
(cd dist && sha256sum ./*.tar.gz ./sbom.spdx.json | sed 's| \./| |' > SHA256SUMS)
|
||||
(cd dist && sha256sum ./*.tar.gz ./*.tgz ./sbom.spdx.json | sed 's| \./| |' > SHA256SUMS)
|
||||
cat dist/SHA256SUMS
|
||||
- name: Sign checksums
|
||||
env:
|
||||
@@ -73,8 +78,20 @@ jobs:
|
||||
go run ./tools/release notes -json "$GITHUB_REF_NAME" > release.json
|
||||
id="$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
--data-binary @release.json "$api/releases" | grep -o '"id":[0-9]*' | head -n1 | cut -d: -f2)"
|
||||
for f in dist/*.tar.gz dist/sbom.spdx.json dist/SHA256SUMS dist/SHA256SUMS.minisig; do
|
||||
for f in dist/*.tar.gz dist/*.tgz dist/sbom.spdx.json dist/SHA256SUMS dist/SHA256SUMS.minisig; do
|
||||
[ -f "$f" ] || continue
|
||||
curl -fsS -o /dev/null -X POST -H "Authorization: token $TOKEN" \
|
||||
-F "attachment=@$f" "$api/releases/$id/assets?name=$(basename "$f")"
|
||||
done
|
||||
# helm repo add uptimesebi <server>/api/packages/<owner>/helm
|
||||
- name: Publish Helm chart
|
||||
env:
|
||||
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$PACKAGE_TOKEN" ]; then
|
||||
echo "::warning::PACKAGE_TOKEN is not set; the chart is only attached to the release."
|
||||
exit 0
|
||||
fi
|
||||
owner="$(printf '%s' "${GITHUB_REPOSITORY%/*}" | tr 'A-Z' 'a-z')"
|
||||
curl -fsS --user "$GITHUB_ACTOR:$PACKAGE_TOKEN" -X POST --upload-file dist/uptimesebi-*.tgz \
|
||||
"$GITHUB_SERVER_URL/api/packages/$owner/helm/api/charts"
|
||||
Reference in new issue
Block a user