mount dev sources directly from workspace PVC
This commit is contained in:
34
dev/stop.sh
34
dev/stop.sh
@@ -12,44 +12,12 @@ if [[ ${#instance} -gt 42 || ! $instance =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ ]];
|
||||
fi
|
||||
|
||||
namespace=${DEV_NAMESPACE:-vibes}
|
||||
shared_root=${DEV_SHARED_ROOT:-/data/live}
|
||||
destination="$shared_root/$instance"
|
||||
state_dir="$shared_root/.hello-dev-state"
|
||||
pid_file="$state_dir/$instance.pid"
|
||||
log_file="$state_dir/$instance.log"
|
||||
label="dev.mancave.link/instance=$instance"
|
||||
|
||||
if [[ $shared_root != /* || $shared_root == / ]]; then
|
||||
echo "DEV_SHARED_ROOT must be an absolute directory below /: $shared_root" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ -f $pid_file ]]; then
|
||||
sync_pid=$(<"$pid_file")
|
||||
process_command=""
|
||||
if [[ $sync_pid =~ ^[0-9]+$ && -r /proc/$sync_pid/cmdline ]]; then
|
||||
process_command=$(tr '\0' ' ' <"/proc/$sync_pid/cmdline")
|
||||
fi
|
||||
if [[ $process_command == *"start.sh __sync $instance "* ]]; then
|
||||
kill "$sync_pid"
|
||||
for _ in {1..20}; do
|
||||
kill -0 "$sync_pid" 2>/dev/null || break
|
||||
sleep 0.1
|
||||
done
|
||||
kill -9 "$sync_pid" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
kubectl delete all,ingress,configmap,secret,pvc \
|
||||
kubectl delete deployment,service,ingress \
|
||||
--namespace "$namespace" \
|
||||
--selector "$label" \
|
||||
--ignore-not-found=true \
|
||||
--wait=true
|
||||
|
||||
if [[ -d $destination ]]; then
|
||||
find "$destination" -depth -delete
|
||||
fi
|
||||
rm -f -- "$pid_file" "$log_file"
|
||||
rmdir -- "$state_dir" 2>/dev/null || true
|
||||
|
||||
echo "Development instance '$instance' was permanently removed"
|
||||
|
||||
Reference in New Issue
Block a user