ci: update manifest tag after successful build

This commit is contained in:
Tanner Wright
2026-05-24 00:04:37 -06:00
parent 142ad1f717
commit 7f9ca156b0
+14 -1
View File
@@ -70,7 +70,7 @@ while true; do
if [ -n "$COMPLETE" ]; then if [ -n "$COMPLETE" ]; then
echo "Build succeeded" echo "Build succeeded"
kubectl delete job ${JOB_NAME} -n gitea-runner --ignore-not-found kubectl delete job ${JOB_NAME} -n gitea-runner --ignore-not-found
exit 0 break
fi fi
if [ "${FAILED:-0}" -ge 1 ]; then if [ "${FAILED:-0}" -ge 1 ]; then
echo "Build failed, logs:" echo "Build failed, logs:"
@@ -80,3 +80,16 @@ while true; do
fi fi
sleep 15 sleep 15
done done
# Update k8s manifests so ArgoCD picks up the new image
APP_DIR=$(echo "${IMAGE}" | tr '_' '-')
K8S_DIR=$(mktemp -d)
git clone --depth=1 "https://${GIT_USERNAME}:${GITEA_TOKEN}@gitea.saltysoup.dev/tanner/k8s.git" "${K8S_DIR}"
sed -i "s|gitea.saltysoup.dev/tanner/${IMAGE}:.*|gitea.saltysoup.dev/tanner/${IMAGE}:${GITHUB_SHA}|g" \
"${K8S_DIR}/apps/${APP_DIR}/deployment.yaml"
git -C "${K8S_DIR}" config user.email "ci@saltysoup.dev"
git -C "${K8S_DIR}" config user.name "CI Bot"
git -C "${K8S_DIR}" add "apps/${APP_DIR}/deployment.yaml"
git -C "${K8S_DIR}" commit -m "ci: ${IMAGE}${GITHUB_SHA:0:8}"
git -C "${K8S_DIR}" push
rm -rf "${K8S_DIR}"