Skip to content

Commit 91656f0

Browse files
authored
Fix port-forward cleanup to only kill specific process (#405)
Previously, `send-integration-task` and `send-libpng-task` used `pkill -f "kubectl port-forward"` which killed ALL kubectl port-forward processes. This was problematic when other port-forwards were running. Now each target captures the PID of the port-forward it starts and kills only that specific process when done.
1 parent 134e9f6 commit 91656f0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,23 @@ send-integration-task:
132132
echo "Error: CRS namespace not found. Deploy first with 'make deploy'."; \
133133
exit 1; \
134134
fi
135-
kubectl port-forward -n $${BUTTERCUP_NAMESPACE:-crs} service/buttercup-ui 31323:1323 &
136-
@sleep 3
137-
./orchestrator/scripts/task_integration_test.sh
138-
pkill -f "kubectl port-forward" || true
139-
exit 0
135+
@kubectl port-forward -n $${BUTTERCUP_NAMESPACE:-crs} service/buttercup-ui 31323:1323 & \
136+
PORT_FORWARD_PID=$$!; \
137+
sleep 3; \
138+
./orchestrator/scripts/task_integration_test.sh; \
139+
kill $$PORT_FORWARD_PID 2>/dev/null || true
140140

141141
send-libpng-task:
142142
@echo "Running libpng task..."
143143
@if ! kubectl get namespace $${BUTTERCUP_NAMESPACE:-crs} >/dev/null 2>&1; then \
144144
echo "Error: CRS namespace not found. Deploy first with 'make deploy'."; \
145145
exit 1; \
146146
fi
147-
kubectl port-forward -n $${BUTTERCUP_NAMESPACE:-crs} service/buttercup-ui 31323:1323 &
148-
@sleep 3
149-
./orchestrator/scripts/task_crs.sh
150-
pkill -f "kubectl port-forward" || true
151-
exit 0
147+
@kubectl port-forward -n $${BUTTERCUP_NAMESPACE:-crs} service/buttercup-ui 31323:1323 & \
148+
PORT_FORWARD_PID=$$!; \
149+
sleep 3; \
150+
./orchestrator/scripts/task_crs.sh; \
151+
kill $$PORT_FORWARD_PID 2>/dev/null || true
152152

153153
# Development targets
154154
lint:

0 commit comments

Comments
 (0)