mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-04 22:37:55 +00:00
Adds a Kubernetes backend. A `name:kubernetes://image` label runs the job as one pod through the Kubernetes API, with services as containers of the same pod. Step env is exported by a script sent over exec stdin, keeping it out of the pod spec and process arguments, and service env goes into a per-job Secret. Docker actions and container options are rejected. See `docs/kubernetes.md`. Operators shape job pods with `kubernetes.pod_template`, with per-label `pod_templates` merged in `runs-on` order and a `$services` entry for service containers. The idle cleanup removes pods and Secrets a runner left behind. The client calls the Kubernetes API directly and runs step commands over `coder/websocket` (same dependency used in gitea) instead of pulling in the heavyweight `kubernetes/client-go`. Includes an e2e test against k3s. Replaces: https://gitea.com/gitea/runner/pulls/1000 Fixes: https://gitea.com/gitea/runner/issues/31 Assisted-by: Claude Code:claude-opus-5-5 Co-authored-by: Zettat123 <[email protected]> Co-authored-by: bircni <[email protected]> Reviewed-on: https://gitea.com/gitea/runner/pulls/1260 Reviewed-by: Lunny Xiao <[email protected]> Reviewed-by: Zettat123 <[email protected]> Co-authored-by: silverwind <[email protected]>
21 lines
615 B
YAML
21 lines
615 B
YAML
name: kubernetes
|
|
on: push
|
|
jobs:
|
|
pod:
|
|
runs-on: e2e-kubernetes
|
|
services:
|
|
web:
|
|
image: ${{ vars.E2E_SERVICE_IMAGE }}
|
|
env:
|
|
NGINX_ENTRYPOINT_QUIET_LOGS: 1
|
|
options: --health-cmd "wget -q -O /dev/null http://localhost/" --health-interval 1s
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: |
|
|
test -f .gitea/workflows/kubernetes.yml
|
|
echo "FROM_ENV=exported" >> "$GITHUB_ENV"
|
|
- run: |
|
|
test "$FROM_ENV" = exported
|
|
test -n "$KUBERNETES_SERVICE_HOST" -a -n "${{ runner.arch }}"
|
|
curl -fsS -o /dev/null http://web/
|