NOC online · 24/7Longview, TX · +1 323 412 0665
KinetikatechServers · Security · Websites
LT

Šis išsamus vadovas prieinamas angliškai.

English version

Self-Hosted Open Source Infrastructure

Building an Autonomous CI/CD Pipeline Using Self-Hosted Gitea Actions and Hardened Runner Nodes

Gitea Actions brings GitHub Actions-compatible CI/CD to self-hosted Git. The risk is that workflow jobs run arbitrary code on your infrastructure. Hardened runners isolate jobs, restrict network access, and prevent credential leakage. This guide builds a secure pipeline.

Pagrindiniai punktai

  • Use ephemeral runners. Each job gets a fresh environment, preventing state leakage between runs.
  • Isolate runner nodes. Run runners on dedicated hosts or VMs, not on production servers.
  • Restrict network access. Runners should reach only the registry and Git server, not the broader network.
  • Manage secrets carefully. Use Gitea's secret management and never print secrets in logs.
  • Pin action versions. Use commit SHAs instead of tags to prevent supply-chain attacks.
  • Limit job permissions. Grant the minimum token scopes needed for each workflow.
  • Monitor runner health. Track job duration, failure rates, and resource usage.
  • Clean up after jobs. Remove containers, caches, and temporary files after each run.

Architecture

Gitea hosts the repository and orchestrates workflows. Runner nodes poll for jobs, execute them in isolated containers, and report results. Network policies restrict runner access, and secret management prevents credential exposure.

Production configuration

Hardened workflow yaml
name: build
on: [push]
jobs:
  build:
    runs-on: self-hosted
    permissions:
      contents: read
    steps:
    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
    - name: Build
      run: |
        set -euo pipefail
        docker build -t app:$GITHUB_SHA .
    - name: Scan
      run: trivy image app:$GITHUB_SHA
Runner isolation with Docker bash
# run runner in a container with restricted network
docker run -d --name gitea-runner \
  --network runner-net \
  --read-only \
  --tmpfs /tmp \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  gitea/act_runner:latest

# firewall rules for runner network
iptables -A FORWARD -s 10.0.1.0/24 -d 10.0.0.5 -p tcp --dport 3000 -j ACCEPT
iptables -A FORWARD -s 10.0.1.0/24 -j DROP
Verify runner security bash
gitea-runner --version
# check runner logs for secret leaks
grep -r 'GITEA_TOKEN\|SECRET' /var/log/gitea-runner/ || echo 'no leaks'
# audit workflow permissions
grep -r 'permissions:' .gitea/workflows/

Edge cases from production

  • Docker socket access gives runners root on the host; use rootless Docker or a separate daemon.
  • Ephemeral runners need fast provisioning; pre-pull images to reduce startup time.
  • Secrets in workflow files are visible to anyone with read access; use Gitea's secret store.
  • Runner nodes accumulate disk from caches; schedule cleanup jobs.

Dažniausiai užduodami klausimai

Is Gitea Actions compatible with GitHub Actions?

Most workflows port directly, but some GitHub-specific features are not supported.

How do I scale runners?

Add more runner nodes and use labels to route jobs to appropriate hardware.

Can I use Kubernetes runners?

Yes, Gitea supports Kubernetes-based runners for dynamic scaling.

How do I prevent secret leaks?

Use Gitea's secret management, mask secrets in logs, and audit workflows regularly.

What is the main risk?

Arbitrary code execution on your infrastructure; isolate runners and restrict network access.

Kaip Kinetikatech padeda su self-hosted open source infrastructure

Pasiūlymas paprastas: Running sovereign collaboration, storage, and identity stacks on hardware you control. Patikėkite tai mūsų paslaugai Serverių administravimas ir Svetainės priežiūra ir turėsite visišką aprėptį: rimtą vertinimą, švarų įgyvendinimą, nepertraukiamą stebėjimą.

Pasikalbėkite su inžinieriumi

Serverio problema? Svetainė nukauta? Lėtas įkrovimas?

Kritincidentai sprendžiami per 30 minučių — 24 valandas per dieną, 7 dienas per savaitę.

Kreiptis skubios pagalbos support@kinetikatech.com