Created
July 10, 2020 20:58
-
-
Save jameswnl/da4bfe45f153e61ad77c0047722e144c to your computer and use it in GitHub Desktop.
script to port forwarding to the test-data-generator pod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can run the
watch
command from a different console session to avoid the garbled output from the 2 commands