Skip to content

Instantly share code, notes, and snippets.

@jameswnl
Created July 10, 2020 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswnl/da4bfe45f153e61ad77c0047722e144c to your computer and use it in GitHub Desktop.
Save jameswnl/da4bfe45f153e61ad77c0047722e144c to your computer and use it in GitHub Desktop.
script to port forwarding to the test-data-generator pod
#!/bin/sh
oc project tower-analytics-$1. # expect either ci or qa
if [ $? -eq 1 ]; then
echo "oc project tower-analytics-$0 failed. Abort"
exit 1
fi
for i in $(oc get pods -o name);
do
echo $i
if [[ "$i" == *"$automation-analytics-test-data-generator-"* ]]; then
oc port-forward $i 8080 & # this forward from local 8080 to target pod's 8080
watch -n 30 curl localhost:8080. # this keeps the forwarding from timing out
fi
done
@jameswnl
Copy link
Author

you can run the watch command from a different console session to avoid the garbled output from the 2 commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment