@@ -19,12 +19,12 @@ jobs:
1919 fetch-depth : 0
2020 persist-credentials : true
2121
22- # ─── 1. Fetch the latest k3s tag matching *-amd64 ───────────────────
22+ # ─── 1. Latest k3s tag ( *-amd64) ───────────────── ───────────────────
2323 - name : Get latest k3s tag
2424 id : k3s
2525 run : |
26- # name= filter scopes the scan to amd64 tags , then paginate via .next so a
27- # high version can't be hidden past page 1 (push-order != version-order).
26+ # name= filter scopes the scan, then paginate via .next so a high
27+ # version can't be hidden past page 1 (push-order != version-order).
2828 latest=$(
2929 url="https://registry.hub.docker.com/v2/repositories/rancher/k3s/tags?page_size=100&name=amd64"
3030 for _ in $(seq 1 20); do
@@ -37,15 +37,21 @@ jobs:
3737 [ -n "$latest" ] || { echo "::error::no k3s tag resolved from registry"; exit 1; }
3838 echo "latest=$latest" >> "$GITHUB_OUTPUT"
3939
40- # ─── 2. Fetch the latest CUDA tag matching *-base-ubuntu24.04 ───────
41- - name : Get latest CUDA tag (newest base-ubuntu LTS)
40+ # ─── 2. Latest NVIDIA device plugin release (baked into the image) ───
41+ - name : Get latest NVIDIA device plugin version
42+ id : nvidia_plugin
43+ run : |
44+ latest=$(curl -fsSL \
45+ "https://api.github.com/repos/NVIDIA/k8s-device-plugin/releases/latest" \
46+ | jq -r '.tag_name')
47+ [ -n "$latest" ] && [ "$latest" != "null" ] || { echo "::error::no device-plugin release resolved"; exit 1; }
48+ echo "latest=$latest" >> "$GITHUB_OUTPUT"
49+
50+ # ─── 3. Latest CUDA base — used ONLY for the `k3d-gpu test` pod image, ─
51+ # not the node base (the node runs on Ubuntu now).
52+ - name : Get latest CUDA tag for the test pod image
4253 id : cuda
4354 run : |
44- # Track the newest CUDA on the newest Ubuntu base NVIDIA publishes. Today
45- # that resolves to base-ubuntu24.04; when NVIDIA ships base-ubuntu26.04 it
46- # is adopted automatically — sort -V ranks higher CUDA first, then higher
47- # Ubuntu. The name= filter + pagination is what fixes the historical
48- # 13.2.1 -> 13.1.2 regression (a higher version sitting past page 1).
4955 latest=$(
5056 url="https://registry.hub.docker.com/v2/repositories/nvidia/cuda/tags?page_size=100&name=base-ubuntu"
5157 for _ in $(seq 1 20); do
@@ -55,86 +61,53 @@ jobs:
5561 url=$(printf '%s' "$resp" | jq -r '.next')
5662 done | grep -E '^[0-9][0-9.]*-base-ubuntu[0-9.]+$' | sort -V | tail -n1
5763 )
58- [ -n "$latest" ] || { echo "::error::no CUDA tag resolved from registry "; exit 1; }
64+ [ -n "$latest" ] || { echo "::error::no CUDA test-image tag resolved"; exit 1; }
5965 echo "latest=$latest" >> "$GITHUB_OUTPUT"
6066
61- # ─── 3. Fetch the latest NVIDIA device plugin version ───────────────
62- - name : Get latest NVIDIA device plugin version
63- id : nvidia_plugin
64- run : |
65- latest=$(curl -fsSL \
66- "https://api.github.com/repos/NVIDIA/k8s-device-plugin/releases/latest" \
67- | jq -r '.tag_name')
68- [ -n "$latest" ] && [ "$latest" != "null" ] || { echo "::error::no device-plugin release resolved"; exit 1; }
69- echo "latest=$latest" >> "$GITHUB_OUTPUT"
70-
71- - name : Read current ARGs
67+ - name : Read current pinned versions
7268 id : current
7369 run : |
74- ct=$(grep '^ARG CUDA_TAG' Dockerfile | cut -d= -f2 | tr -d '"')
75- kt=$(grep '^ARG K3S_TAG' Dockerfile | cut -d= -f2 | tr -d '"')
70+ kt=$(grep '^ARG K3S_TAG' Dockerfile | cut -d= -f2 | tr -d '"')
7671 pp=$(grep -oE 'k8s-device-plugin:v[0-9]+\.[0-9]+\.[0-9]+' share/nvidia-device-plugin.yml | cut -d: -f2)
77- echo "cuda=$ct" >> $GITHUB_OUTPUT
78- echo "k3s=$kt" >> $GITHUB_OUTPUT
79- echo "plugin=$pp" >> $GITHUB_OUTPUT
72+ ti=$(grep -oE 'K3D_GPU_TEST_IMAGE:-nvidia/cuda:[^}]*' scripts/k3d-gpu | sed 's#.*nvidia/cuda:##')
73+ echo "k3s=$kt" >> "$GITHUB_OUTPUT"
74+ echo "plugin=$pp" >> "$GITHUB_OUTPUT"
75+ echo "testcuda=$ti" >> "$GITHUB_OUTPUT"
8076
8177 - name : Determine if update is needed
8278 id : need
8379 run : |
84- if [[ "${{ steps.cuda .outputs.latest }}" != "${{ steps.current.outputs.cuda }}" ] ] || \
85- [[ "${{ steps.k3s .outputs.latest }}" != "${{ steps.current.outputs.k3s }}" ] ] || \
86- [[ "${{ steps.nvidia_plugin .outputs.latest }}" != "${{ steps.current.outputs.plugin }}" ] ]; then
87- echo "update=true" >> $GITHUB_OUTPUT
80+ if [ "${{ steps.k3s .outputs.latest }}" != "${{ steps.current.outputs.k3s }}" ] || \
81+ [ "${{ steps.nvidia_plugin .outputs.latest }}" != "${{ steps.current.outputs.plugin }}" ] || \
82+ [ "${{ steps.cuda .outputs.latest }}" != "${{ steps.current.outputs.testcuda }}" ]; then
83+ echo "update=true" >> " $GITHUB_OUTPUT"
8884 else
89- echo "update=false" >> $GITHUB_OUTPUT
85+ echo "update=false" >> " $GITHUB_OUTPUT"
9086 fi
9187
9288 - name : Abort if nothing to do
9389 if : steps.need.outputs.update == 'false'
9490 run : exit 0
9591
96- - name : Bump Dockerfile ARGs
97- if : steps.need.outputs.update == 'true'
98- run : |
99- sed -i \
100- -e "s|^ARG CUDA_TAG=.*|ARG CUDA_TAG=\"${{ steps.cuda.outputs.latest }}\"|" \
101- -e "s|^ARG K3S_TAG=.*|ARG K3S_TAG=\"${{ steps.k3s.outputs.latest }}\"|" \
102- Dockerfile
103-
104- - name : Bump bundled device-plugin manifest
92+ - name : Bump pinned versions
10593 if : steps.need.outputs.update == 'true'
10694 run : |
107- sed -i \
108- -e "s|k8s-device-plugin:v[0-9]*\.[0-9]*\.[0-9]*|k8s-device-plugin:${{ steps.nvidia_plugin.outputs.latest }}|" \
109- share/nvidia-device-plugin.yml
110-
111- - name : Bump launcher test-image default
112- if : steps.need.outputs.update == 'true'
113- run : |
114- # Keep the k3d-gpu test pod on the same CUDA tag as the cluster image,
115- # so the test image never drifts behind the auto-bumped Dockerfile ARG.
116- sed -i \
117- -e "s|K3D_GPU_TEST_IMAGE:-nvidia/cuda:[^}]*|K3D_GPU_TEST_IMAGE:-nvidia/cuda:${{ steps.cuda.outputs.latest }}|" \
118- scripts/k3d-gpu
95+ sed -i "s|^ARG K3S_TAG=.*|ARG K3S_TAG=\"${{ steps.k3s.outputs.latest }}\"|" Dockerfile
96+ sed -i "s|k8s-device-plugin:v[0-9]*\.[0-9]*\.[0-9]*|k8s-device-plugin:${{ steps.nvidia_plugin.outputs.latest }}|" share/nvidia-device-plugin.yml
97+ sed -i "s|K3D_GPU_TEST_IMAGE:-nvidia/cuda:[^}]*|K3D_GPU_TEST_IMAGE:-nvidia/cuda:${{ steps.cuda.outputs.latest }}|" scripts/k3d-gpu
11998
12099 - name : Update README
121100 if : steps.need.outputs.update == 'true'
122101 run : |
123102 today=$(date -u +'%Y-%m-%d')
124- entry="| $today | ${{ steps.cuda .outputs.latest }} | ${{ steps.k3s .outputs.latest }} |"
103+ entry="| $today | ${{ steps.k3s .outputs.latest }} | ${{ steps.nvidia_plugin .outputs.latest }} |"
125104 awk -v e="$entry" \
126105 -v k3s="${{ steps.k3s.outputs.latest }}" \
127- -v cuda="${{ steps.cuda.outputs.latest }}" \
128- -v nvidia_plugin="${{ steps.nvidia_plugin.outputs.latest }}" '
106+ -v plugin="${{ steps.nvidia_plugin.outputs.latest }}" '
129107 /^## Release History/ { in_rh = 1 }
130108 in_rh && /^\|----------/ { print; print e; in_rh = 0; next }
131109 /^\| `K3S_TAG`/ { sub(/`v[0-9][^`]*-amd64`/, "`" k3s "`"); print; next }
132- /^\| `CUDA_TAG`/ { sub(/`[0-9][^`]*-base-ubuntu[0-9.]*`/, "`" cuda "`"); print; next }
133- /^\| `K3D_GPU_TEST_IMAGE`/ { sub(/nvidia\/cuda:[0-9][^`]*/, "nvidia/cuda:" cuda); print; next }
134- /--image=nvidia\/cuda:[0-9]/ { sub(/nvidia\/cuda:[0-9][^ ]*/, "nvidia/cuda:" cuda); print; next }
135- /kubectl apply -f https:\/\/raw\.githubusercontent\.com\/NVIDIA\/k8s-device-plugin\// {
136- sub(/v[0-9]+\.[0-9]+\.[0-9]+/, nvidia_plugin); print; next
137- }
110+ /k8s-device-plugin\/v[0-9]/ { sub(/v[0-9]+\.[0-9]+\.[0-9]+/, plugin); print; next }
138111 { print }
139112 ' README.md > README.md.new && mv README.md.new README.md
140113
@@ -144,19 +117,9 @@ jobs:
144117 git config user.name "github-actions[bot]"
145118 git config user.email "github-actions[bot]@users.noreply.github.com"
146119 git add Dockerfile README.md share/nvidia-device-plugin.yml scripts/k3d-gpu
147- git commit -m "chore: bump CUDA→${{ steps.cuda.outputs.latest }} & K3s →${{ steps.k3s.outputs.latest }} & device-plugin→${{ steps.nvidia_plugin.outputs.latest }}"
120+ git commit -m "chore: bump k3s →${{ steps.k3s.outputs.latest }} & device-plugin→${{ steps.nvidia_plugin.outputs.latest }}"
148121 git push origin HEAD:main
149122
150- - name : Prepare build tags
151- if : steps.need.outputs.update == 'true'
152- run : |
153- echo "CUDA_TAG=${{ steps.cuda.outputs.latest }}" >> $GITHUB_ENV
154- echo "K3S_TAG=${{ steps.k3s.outputs.latest }}" >> $GITHUB_ENV
155-
156- - name : Set up QEMU
157- if : steps.need.outputs.update == 'true'
158- uses : docker/setup-qemu-action@v3
159-
160123 - name : Set up Docker Buildx
161124 if : steps.need.outputs.update == 'true'
162125 uses : docker/setup-buildx-action@v3
@@ -176,35 +139,62 @@ jobs:
176139 username : ${{ github.actor }}
177140 password : ${{ secrets.GITHUB_TOKEN }}
178141
179- - name : Build and push image to DockerHub and GHCR
142+ # Ubuntu 26.04 is the default (:latest); 24.04 is also published. Each
143+ # carries the baked device plugin, so clusters expose GPUs with no apply.
144+ - name : Build & push — Ubuntu 26.04 (default / latest)
180145 if : steps.need.outputs.update == 'true'
181146 uses : docker/build-push-action@v6
182147 with :
183148 context : .
184149 push : true
185150 platforms : linux/amd64
151+ build-args : |
152+ UBUNTU_TAG=26.04
186153 tags : |
187- cryptoandcoffee/k3d-gpu:${{ env.CUDA_TAG }}-${{ env.K3S_TAG }}
188154 cryptoandcoffee/k3d-gpu:latest
189- ghcr.io/${{ github.repository_owner }}/k3d-gpu:${{ env.CUDA_TAG }}-${{ env.K3S_TAG }}
155+ cryptoandcoffee/k3d-gpu:ubuntu26.04
156+ cryptoandcoffee/k3d-gpu:${{ steps.k3s.outputs.latest }}-ubuntu26.04
190157 ghcr.io/${{ github.repository_owner }}/k3d-gpu:latest
158+ ghcr.io/${{ github.repository_owner }}/k3d-gpu:ubuntu26.04
159+ ghcr.io/${{ github.repository_owner }}/k3d-gpu:${{ steps.k3s.outputs.latest }}-ubuntu26.04
160+
161+ - name : Build & push — Ubuntu 24.04 (variant)
162+ if : steps.need.outputs.update == 'true'
163+ uses : docker/build-push-action@v6
164+ with :
165+ context : .
166+ push : true
167+ platforms : linux/amd64
168+ build-args : |
169+ UBUNTU_TAG=24.04
170+ tags : |
171+ cryptoandcoffee/k3d-gpu:ubuntu24.04
172+ cryptoandcoffee/k3d-gpu:${{ steps.k3s.outputs.latest }}-ubuntu24.04
173+ ghcr.io/${{ github.repository_owner }}/k3d-gpu:ubuntu24.04
174+ ghcr.io/${{ github.repository_owner }}/k3d-gpu:${{ steps.k3s.outputs.latest }}-ubuntu24.04
191175
192176 - name : Create GitHub Release
193177 if : steps.need.outputs.update == 'true'
194178 uses : softprops/action-gh-release@v2
195179 env :
196180 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
197181 with :
198- tag_name : ${{ steps.cuda .outputs.latest }}-${{ steps.k3s .outputs.latest }}
199- release_name : k3d-gpu- ${{ steps.cuda .outputs.latest }}- ${{ steps.k3s .outputs.latest }}
182+ tag_name : ${{ steps.k3s .outputs.latest }}-ndp ${{ steps.nvidia_plugin .outputs.latest }}
183+ name : k3d-gpu ${{ steps.k3s .outputs.latest }} (device-plugin ${{ steps.nvidia_plugin .outputs.latest }})
200184 body : |
201- ## 🚀 New k3d-gpu Release
202- **Docker Hub**
203- - `cryptoandcoffee/k3d-gpu:${{ steps.cuda.outputs.latest }}-${{ steps.k3s.outputs.latest }}`
204- - `cryptoandcoffee/k3d-gpu:latest`
185+ ## 🚀 k3d-gpu release
205186
206- **GitHub Container Registry (GHCR)**
207- - `ghcr.io/${{ github.repository_owner }}/k3d-gpu:${{ steps.cuda.outputs.latest }}-${{ steps.k3s.outputs.latest }}`
208- - `ghcr.io/${{ github.repository_owner }}/k3d-gpu:latest`
187+ Ubuntu node base — **26.04** (default) and **24.04**. k3s
188+ `${{ steps.k3s.outputs.latest }}`, NVIDIA device plugin
189+ `${{ steps.nvidia_plugin.outputs.latest }}` (baked in — GPUs are
190+ exposed on `up` with no `kubectl apply`).
209191
192+ **Docker Hub**
193+ - `cryptoandcoffee/k3d-gpu:latest` (= ubuntu26.04)
194+ - `cryptoandcoffee/k3d-gpu:ubuntu26.04`
195+ - `cryptoandcoffee/k3d-gpu:ubuntu24.04`
210196
197+ **GHCR**
198+ - `ghcr.io/${{ github.repository_owner }}/k3d-gpu:latest`
199+ - `ghcr.io/${{ github.repository_owner }}/k3d-gpu:ubuntu26.04`
200+ - `ghcr.io/${{ github.repository_owner }}/k3d-gpu:ubuntu24.04`
0 commit comments