Skip to content

Commit adde092

Browse files
rbrennerclaude
andcommitted
ci(build): add Deploy API to k3s step after image push
The CI was building and pushing to the registry but imagePullPolicy:Never on the deployment meant the node never pulled the new image. Add a deploy step that exports the freshly built image from buildah OCI storage into k3s containerd via ctr import, then does kubectl rollout restart so the deployment picks up the new image immediately after every successful build. Co-Authored-By: Claude <noreply@anthropic.com> AI-Generated: true
1 parent 7164c3a commit adde092

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.gitea/workflows/build.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,25 @@ jobs:
6565
buildah inspect git.itsa.house/homelab/openmemory-api:${SHORT_SHA} | jq -r '.OCIv1.config.Entrypoint'
6666
echo "VALIDATED: openmemory-api:${SHORT_SHA}"
6767
68+
- name: Deploy API to k3s
69+
run: |
70+
IMAGE="git.itsa.house/homelab/openmemory-api:latest"
71+
SOCKET="/run/k3s/containerd/containerd.sock"
72+
CTR="/usr/local/bin/ctr"
73+
# Export from buildah OCI storage and import into k3s containerd
74+
TMPTAR=$(mktemp /tmp/openmemory-api-XXXXXX.tar)
75+
buildah push "$IMAGE" "oci-archive:${TMPTAR}"
76+
sudo "$CTR" -n k8s.io -a "$SOCKET" images import "$TMPTAR"
77+
rm -f "$TMPTAR"
78+
echo "IMPORTED: openmemory-api into k3s containerd (k8s.io namespace)"
79+
# Tag so crictl/k3s can find it by the original reference
80+
DIGEST=$(sudo "$CTR" -n k8s.io -a "$SOCKET" images ls name=="$IMAGE" 2>/dev/null | awk 'NR==2{print $3}')
81+
echo "Image digest in containerd: $DIGEST"
82+
# Rollout restart to pick up new image
83+
kubectl rollout restart deployment/openmemory-api -n openmemory
84+
kubectl rollout status deployment/openmemory-api -n openmemory --timeout=120s
85+
echo "DEPLOYED: openmemory-api:${SHORT_SHA}"
86+
6887
- name: Notify success
6988
if: success()
7089
env:

0 commit comments

Comments
 (0)