mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
Squashed commit of the following: commit 86eadd3ec42b7bce0dc5716d65798af95d0d8cbc Author: technofab <admin@technofab.de> Date: Fri May 2 17:10:33 2025 +0200 docs(README): fix built with nix badge commit f50057da69e89974f17bc37b5e140b2ef9f817f6 Author: technofab <admin@technofab.de> Date: Fri May 2 16:09:00 2025 +0200 ci: change back rule so docs only get deployed on main commit ce02b043f4bd83c36285e5620e71701fc3bcc998 Author: technofab <admin@technofab.de> Date: Fri May 2 16:08:10 2025 +0200 docs: write docs and improve formatter etc. commit e996b23cf877d8021759b782aa5996f5e2bf12ac Author: technofab <admin@technofab.de> Date: Fri May 2 16:07:56 2025 +0200 docs: update README commit 650f97b5608c32cf6cf66cc3fdd0965dc42e4860 Author: technofab <admin@technofab.de> Date: Wed Apr 23 21:05:14 2025 +0200 docs: add favicon commit 67e1bfecbcaf0b8f7dad2eecfaccf774cc560874 Author: technofab <admin@technofab.de> Date: Wed Apr 23 20:53:44 2025 +0200 docs: initial setup
38 lines
1.1 KiB
Markdown
38 lines
1.1 KiB
Markdown
# Kubernetes Runner Setup
|
|
|
|
Using the GitLab Kubernetes runner allows your CI jobs to run as pods in a Kubernetes cluster.
|
|
Nix GitLab CI can be integrated with this setup, and using advanced configuration options like
|
|
`pod_spec` makes it easy to add runner specific caching.
|
|
|
|
Using this Runner configuration ...
|
|
|
|
```toml
|
|
[[runners.kubernetes.pod_spec]]
|
|
name = "nix-ci-cache-secrets"
|
|
patch = '''
|
|
containers:
|
|
- name: build
|
|
envFrom:
|
|
- secretRef:
|
|
name: nix-ci-cache-env
|
|
'''
|
|
```
|
|
|
|
... and a secret containing ...
|
|
|
|
```yaml
|
|
NIX_CI_RUNNER_CACHE_STRATEGY: attic
|
|
ATTIC_SERVER: <in-cluster-url> # example: http://atticd.<ns>.svc.cluster.local:8080
|
|
ATTIC_CACHE: ci # name however you want, just needs to exist
|
|
ATTIC_TOKEN: <token>
|
|
```
|
|
|
|
... makes your jobs automatically cache their Nix store paths to the in-cluster
|
|
attic when running with this runner.
|
|
|
|
Other runners could use cachix or no cache, you get the idea ;P
|
|
|
|
!!! note
|
|
|
|
This of course works with any executor where you can set environment
|
|
variables. This is just an example how to do it in Kubernetes easily.
|