fix(k8s): handle existing workspace on pod restart
Apply same fix from master branch: - Check if workspace exists before cloning - Fetch and reset if .git directory exists - Clean and clone fresh if not Prevents CrashLoopBackOff on pod restarts.
This commit is contained in:
@@ -22,10 +22,20 @@ spec:
|
|||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
apk add --no-cache git
|
apk add --no-cache git
|
||||||
git clone --depth 1 --branch master \
|
# Clean workspace if it exists (handles pod restarts)
|
||||||
http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git \
|
if [ -d /workspace/.git ]; then
|
||||||
/workspace
|
echo "Workspace exists, pulling latest changes..."
|
||||||
echo "Clone complete."
|
cd /workspace
|
||||||
|
git fetch origin master
|
||||||
|
git reset --hard origin/master
|
||||||
|
else
|
||||||
|
echo "Cloning fresh repository..."
|
||||||
|
rm -rf /workspace/*
|
||||||
|
git clone --depth 1 --branch master \
|
||||||
|
http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git \
|
||||||
|
/workspace
|
||||||
|
fi
|
||||||
|
echo "Clone/update complete."
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: workspace
|
- name: workspace
|
||||||
mountPath: /workspace
|
mountPath: /workspace
|
||||||
|
|||||||
Reference in New Issue
Block a user