Compare commits

..
Author SHA1 Message Date
Sebi dfa7976c4e fix(deps): update module github.com/twmb/franz-go/pkg/kmsg to v1.15.3
renovate/stability-days Updates have met minimum release age requirement
ci / lint (push) Skipped
ci / build (pull_request) Successful in 3m58s
ci / image (pull_request) Successful in 28s
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 2m36s
ci / test (pull_request) Successful in 8m11s
2026-12-05 18:13:46 +00:00
Sebi 18eb750ccb Merge pull request 'ci: push the image with crane (plain-HTTP in-cluster registry)' (#185) from ci/image-push-crane into main
ci / lint (push) Successful in 2m29s
ci / build (push) Successful in 6m24s
ci / test (push) Successful in 6m22s
ci / image (push) Successful in 49s
Reviewed-on: #185
2026-12-05 17:17:42 +00:00
Sebastian UnterschützandClaude Opus 5.5 266dec50de ci: push the image with crane (plain-HTTP in-cluster registry)
ci / test (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 1m5s
ci / lint (push) Skipped
ci / test (pull_request) Successful in 7m15s
ci / build (push) Skipped
ci / build (pull_request) Successful in 2m25s
ci / image (pull_request) Successful in 28s
On main and tags GITHUB_SERVER_URL is http://gitea-http.gitea.svc...,
and the runner's Docker daemon refused to push there: "server gave HTTP
response to HTTPS client". crane pushes the saved image with --insecure
for http:// servers and tags the channels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 18:02:53 +01:00
Sebi 220bc5f3d8 Merge pull request 'ci: caches, prebuilt linters, image from the built binaries' (#184) from ci/optimize-pipelines into main
ci / lint (push) Successful in 8m30s
ci / test (push) Successful in 16m28s
ci / build (push) Successful in 20m30s
ci / image (push) Failing after 29s
Reviewed-on: #184
2026-12-05 16:16:10 +00:00
Sebastian UnterschützandClaude Opus 5.5 d224ddcee2 ci: build the image with BuildKit (docker-cli-buildx)
ci / lint (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m34s
ci / build (pull_request) Successful in 16m13s
ci / image (pull_request) Successful in 28s
ci / test (push) Skipped
ci / test (pull_request) Successful in 8m45s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 15:09:51 +01:00
Sebastian UnterschützandClaude Opus 5.5 b5864632bb ci: caches, prebuilt linters, image from the built binaries
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 4m38s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
ci / test (pull_request) Canceled after 5m37s
- Go module/build cache, golangci-lint cache and npm cache in the runners'
  S3 cache for lint, test and build; only main saves (one entry per
  commit), PRs and tags restore; release restores the build cache
- golangci-lint from the release tarball (sha256-checked) instead of
  compiling it with go install on every run
- shellcheck from its static release binary instead of apt-get on every run
- the image job packs the build job's amd64 binaries (Dockerfile.ci,
  distroless, same entrypoint) with the runner's Docker daemon instead of
  Kaniko rebuilding frontend and Go from the git context; Dockerfile stays
  for local/make builds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 15:04:32 +01:00
6 changed files with 156 additions and 48 deletions

No files matched your search

+131 -43
View File
@@ -13,7 +13,10 @@ concurrency:
env:
GOLANGCI_LINT_VERSION: v2.15.0
SQLC_VERSION: v1.31.1
# sha256 of golangci-lint-<version>-linux-amd64.tar.gz from the release's checksums.txt
GOLANGCI_LINT_SHA256: 9b7fe6a6bf6334b98decf8d86b11415ea7889afdabdd1959fdce23af2a9ebcea
HELM_VERSION: v3.19.0
SHELLCHECK_VERSION: v0.12.0
jobs:
lint:
@@ -29,8 +32,24 @@ jobs:
curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz
echo /usr/local/go/bin >> "$GITHUB_PATH"
echo "$HOME/go/bin" >> "$GITHUB_PATH"
echo "GO_VERSION=$v" >> "$GITHUB_ENV"
# Module, build and npm caches live in the runners' S3 cache. Only main
# saves them (one entry per commit, expired by the bucket after 7 days);
# pull requests and tags restore the newest one from main.
- name: Restore caches
uses: actions/cache/restore@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/golangci-lint
~/.npm
key: lint-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
restore-keys: |
lint-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-
lint-go${{ env.GO_VERSION }}-
- name: Build frontend
run: npm ci --no-audit --no-fund && npm run build
run: npm ci --no-audit --no-fund --prefer-offline && npm run build
- name: Generated code is up to date
run: |
go tool templ generate
@@ -42,10 +61,15 @@ jobs:
run: test -z "$(gofmt -l internal cmd tools deploy)" || { gofmt -l internal cmd tools deploy; exit 1; }
- name: go vet
run: go vet ./...
# The release binary instead of `go install`, which compiled the linter
# from source on every run.
- name: golangci-lint
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
"$(go env GOPATH)/bin/golangci-lint" run ./...
v="${GOLANGCI_LINT_VERSION#v}"
curl -fsSLo /tmp/golangci-lint.tar.gz "https://github.com/golangci/golangci-lint/releases/download/${GOLANGCI_LINT_VERSION}/golangci-lint-${v}-linux-amd64.tar.gz"
echo "${GOLANGCI_LINT_SHA256} /tmp/golangci-lint.tar.gz" | sha256sum -c -
tar -xzf /tmp/golangci-lint.tar.gz -C /usr/local/bin --strip-components=1 "golangci-lint-${v}-linux-amd64/golangci-lint"
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
@@ -65,8 +89,20 @@ jobs:
# Debian and Raspberry Pi OS; the test renders and checks it.
- name: shellcheck
run: |
command -v shellcheck >/dev/null || { apt-get update -qq && apt-get install -y -qq shellcheck; }
# Static release binary instead of apt-get update + install on every run.
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" \
| tar -xJ -C /usr/local/bin --strip-components=1 "shellcheck-${SHELLCHECK_VERSION}/shellcheck"
go test -count=1 -run 'TestScript|TestInstall' -v ./deploy/agent/ | grep -v '^=== RUN'
- name: Save caches
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/golangci-lint
~/.npm
key: lint-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
test:
runs-on: ubuntu-latest
@@ -126,8 +162,20 @@ jobs:
curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz
echo /usr/local/go/bin >> "$GITHUB_PATH"
echo "$HOME/go/bin" >> "$GITHUB_PATH"
echo "GO_VERSION=$v" >> "$GITHUB_ENV"
- name: Restore caches
uses: actions/cache/restore@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: test-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
restore-keys: |
test-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-
test-go${{ env.GO_VERSION }}-
- name: Build frontend
run: npm ci --no-audit --no-fund && npm run build
run: npm ci --no-audit --no-fund --prefer-offline && npm run build
- name: Prepare database
# The same roles and databases as the local environment: the
# application role must not be a superuser, or row-level security
@@ -136,6 +184,15 @@ jobs:
- name: Test
# Integration tests share one database, so packages run one at a time.
run: go test -p 1 -count=1 ./...
- name: Save caches
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: test-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
build:
# Nothing is built or pushed from code that fails lint or tests; the
@@ -155,8 +212,20 @@ jobs:
curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz
echo /usr/local/go/bin >> "$GITHUB_PATH"
echo "$HOME/go/bin" >> "$GITHUB_PATH"
echo "GO_VERSION=$v" >> "$GITHUB_ENV"
- name: Restore caches
uses: actions/cache/restore@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: build-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
restore-keys: |
build-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-
build-go${{ env.GO_VERSION }}-
- name: Build frontend
run: npm ci --no-audit --no-fund && npm run build
run: npm ci --no-audit --no-fund --prefer-offline && npm run build
- name: Build binaries
id: binaries
run: |
@@ -199,38 +268,59 @@ jobs:
./image -name statuspage -repo "$host/$owner/uptimesebi-statuspage" -port 8082/tcp \
-env UPTIME_STATUSPAGE_CACHE_DIR=/var/lib/uptimesebi $variant $flags
done
- name: Save caches
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: build-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
# The image job packs the amd64 binaries instead of compiling everything again.
- name: Hand the binaries to the image job
uses: actions/upload-artifact@v4
with:
name: image-context
path: |
Dockerfile.ci
dist/linux_amd64/
retention-days: 1
image:
# Kaniko runs rootless from docker:cli, the same way as the other
# repositories on this instance: the default job image has no docker
# CLI, and Kaniko's own image lacks what the runner needs to keep a job
# container alive. Images are pushed only from main and tags, and only
# once the PACKAGE_TOKEN secret (write:package) exists.
# Builds Dockerfile.ci (the build job's amd64 binaries on distroless)
# with the runner's Docker daemon and pushes with crane instead of Kaniko rebuilding frontend
# and Go from the git context. Images are pushed only from main and tags,
# and only once the PACKAGE_TOKEN secret (write:package) exists.
# The build job's version, so the API reports the release its agent
# images are tagged with.
needs: build
runs-on: ubuntu-latest
# Node for the artifact action; the Docker CLI is added below.
container:
image: docker:cli@sha256:34507eb5069d8be82c95dd3b6987d4250fd5fee49b82e2509b7d7a7030740d6d
image: node:24-alpine
defaults:
run:
shell: sh
steps:
- uses: actions/download-artifact@v4
with:
name: image-context
path: ctx
- name: Build (and push from main and tags)
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
VERSION: ${{ needs.build.outputs.version }}
run: |
set -eu
apk add --no-cache docker-cli docker-cli-buildx crane >/dev/null
REGISTRY="${GITHUB_SERVER_URL#*://}"
IMAGE="$(printf '%s/%s' "$REGISTRY" "$GITHUB_REPOSITORY" | tr 'A-Z' 'a-z')"
SHORT="$(printf '%s' "$GITHUB_SHA" | cut -c1-12)"
TAG="$VERSION"
PUSH="--no-push"
DEST="--destination ${IMAGE}:${TAG#v}"
TAGS="${IMAGE}:${TAG#v}"
# Channels: edge follows main, beta the newest prerelease, latest
# and stable the newest release, X.Y its newest patch.
CHANNELS=""
case "$GITHUB_REF" in
refs/heads/main) CHANNELS="edge" ;;
refs/tags/v*-beta.*) CHANNELS="beta" ;;
@@ -238,33 +328,31 @@ jobs:
MINOR="$(printf '%s' "${TAG#v}" | cut -d. -f1-2)"
CHANNELS="latest stable $MINOR" ;;
esac
for c in $CHANNELS; do TAGS="$TAGS ${IMAGE}:$c"; done
set --
for t in $TAGS; do set -- "$@" -t "$t"; done
docker build --platform linux/amd64 -f ctx/Dockerfile.ci "$@" ctx
case "$GITHUB_REF" in
refs/heads/main|refs/tags/v*)
if [ -n "${PACKAGE_TOKEN:-}" ]; then
PUSH=""
for c in $CHANNELS; do DEST="$DEST --destination ${IMAGE}:$c"; done
else
echo "PACKAGE_TOKEN is not set; building without pushing."
fi ;;
if [ -z "${PACKAGE_TOKEN:-}" ]; then
echo "PACKAGE_TOKEN is not set; built without pushing."
exit 0
fi
# crane instead of docker push: on main and tags GITHUB_SERVER_URL is
# the in-cluster plain-HTTP address, which the runner's Docker
# daemon refuses ("server gave HTTP response to HTTPS client").
INSECURE=""
case "$GITHUB_SERVER_URL" in http://*) INSECURE="--insecure" ;; esac
printf '%s' "$PACKAGE_TOKEN" | crane auth login "$REGISTRY" -u "$GITHUB_ACTOR" --password-stdin $INSECURE
FIRST=""
for t in $TAGS; do
if [ -z "$FIRST" ]; then
docker save "$t" -o /tmp/image.tar
crane push $INSECURE /tmp/image.tar "$t"
FIRST="$t"
else
crane tag $INSECURE "$FIRST" "${t##*:}"
fi
done ;;
*) echo "Pull request: built without pushing." ;;
esac
case "$GITHUB_SERVER_URL" in https://*) PULL=https ;; *) PULL=http ;; esac
# Pull requests are built from their head, which Gitea exposes as
# refs/pull/<n>/head.
REF="$GITHUB_REF"
case "$REF" in refs/pull/*/merge) REF="${REF%/merge}/head" ;; esac
AUTH="$(printf '%s:%s' "$GITHUB_ACTOR" "${PACKAGE_TOKEN:-none}" | base64 | tr -d '\n')"
CFG="$(printf '{"auths":{"%s":{"auth":"%s"}}}' "$REGISTRY" "$AUTH")"
docker run --rm \
-e GIT_PULL_METHOD="$PULL" \
-e GIT_USERNAME="x-access-token" \
-e GIT_PASSWORD="$GITEA_TOKEN" \
-e CFG="$CFG" \
--entrypoint /busybox/sh \
gcr.io/kaniko-project/executor:v1.23.2-debug \
-c 'mkdir -p /kaniko/.docker && printf %s "$CFG" > /kaniko/.docker/config.json && exec /kaniko/executor "$@"' _ \
--context "git://${REGISTRY}/${GITHUB_REPOSITORY}.git#${REF}" \
--dockerfile Dockerfile \
--build-arg VERSION="$TAG" \
--build-arg COMMIT="$SHORT" \
$DEST $PUSH \
--compressed-caching=false
+14 -1
View File
@@ -20,6 +20,19 @@ jobs:
v="$(awk '/^go /{print $2}' go.mod)"
curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz
echo /usr/local/go/bin >> "$GITHUB_PATH"
echo "GO_VERSION=$v" >> "$GITHUB_ENV"
# Read-only: the ci workflow's build job saves these caches on main.
- name: Restore caches
uses: actions/cache/restore@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.npm
key: build-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-${{ github.sha }}
restore-keys: |
build-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'package-lock.json') }}-
build-go${{ env.GO_VERSION }}-
- name: Check tag
run: |
go run ./tools/release check "$GITHUB_REF_NAME"
@@ -32,7 +45,7 @@ jobs:
exit 1
fi
- name: Build frontend
run: npm ci --no-audit --no-fund && npm run build
run: npm ci --no-audit --no-fund --prefer-offline && 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
+7
View File
@@ -0,0 +1,7 @@
# CI image: packs the binaries the build job already compiled (dist/linux_amd64)
# instead of building frontend and Go a second time. `make image` and local
# builds keep using Dockerfile, which builds everything from source.
FROM gcr.io/distroless/static-debian12:nonroot@sha256:afa5c872c891853ca7fcf1f12c3edb23f7eeef36189728842dd51042ff57f7ab
COPY dist/linux_amd64/ /usr/local/bin/
USER nonroot
ENTRYPOINT ["/usr/local/bin/api"]
+1 -1
View File
@@ -6,7 +6,7 @@ image:
# and <repository>-statuspage with the same tag.
repository: git.zb-server.de/zb-server/uptimesebi
# Defaults to the chart's appVersion.
tag: "@sha256:ee741792e112a1d3aafda2d87600931e1169107c91a2807af9c625c7e8e00d1c"
tag: ""
pullPolicy: IfNotPresent
imagePullSecrets: []
+1 -1
View File
@@ -27,7 +27,7 @@ require (
github.com/rabbitmq/amqp091-go v1.17.0
github.com/redis/go-redis/v9 v9.23.0
github.com/twmb/franz-go v1.22.3
github.com/twmb/franz-go/pkg/kmsg v1.15.1
github.com/twmb/franz-go/pkg/kmsg v1.15.3
github.com/yuin/goldmark v1.8.7
go.mongodb.org/mongo-driver/v2 v2.5.0
go.uber.org/zap v1.28.0
+2 -2
View File
@@ -307,8 +307,8 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/twmb/franz-go v1.22.3 h1:RHe35s34pKefMLyL+ZYJ6mQVtfFZz4zHDHVkTyACur0=
github.com/twmb/franz-go v1.22.3/go.mod h1:OhbFLkvp6GLcN5daC7I4Q2z0W/rFP16HG+gTbe9CDC4=
github.com/twmb/franz-go/pkg/kmsg v1.15.1 h1:3sj7ekbH33t73nsBcHS0wtp/PyMIViHLNItZrE8V9zM=
github.com/twmb/franz-go/pkg/kmsg v1.15.1/go.mod h1:sGkGxKexpRLBThFHJLjjywcyfkK09qB/g+X+wFWZQ/A=
github.com/twmb/franz-go/pkg/kmsg v1.15.3 h1:fMxHkXdd2WvlwHQ08lpL+roFh0CY+Qd22Ksieur76Nc=
github.com/twmb/franz-go/pkg/kmsg v1.15.3/go.mod h1:sGkGxKexpRLBThFHJLjjywcyfkK09qB/g+X+wFWZQ/A=
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=