Skip to content

Commit 681722f

Browse files
authored
add --rm, remove cleanup func, and attach to block
1 parent 1f9a180 commit 681722f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

scripts/run_console_local.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ run_ocp_console_image (){
3131
endpoint=$(kubectl config view -o json | jq '{myctx: .["current-context"], ctxs: .contexts[], clusters: .clusters[]}' | jq 'select(.myctx == .ctxs.name)' | jq 'select(.ctxs.context.cluster == .clusters.name)' | jq '.clusters.cluster.server' -r)
3232

3333
echo -e "Using $endpoint"
34-
$POD_MANAGER run -dit $args \
34+
$POD_MANAGER run -dit --rm $args \
3535
-e BRIDGE_USER_AUTH="disabled" \
3636
-e BRIDGE_K8S_MODE="off-cluster" \
3737
-e BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT=$endpoint \
@@ -42,30 +42,23 @@ run_ocp_console_image (){
4242
}
4343

4444
verify_ocp_console_image (){
45-
while true; do
4645
if [ "$($POD_MANAGER ps -q -f label=io.openshift.build.source-location=https://github.com/openshift/console)" ];
4746
then
47+
container_id="$($POD_MANAGER ps -q -f label=io.openshift.build.source-location=https://github.com/openshift/console)"
4848
echo -e "${GREEN}The OLM is accessible via web console at:${RESET}"
4949
echo -e "${GREEN}http://localhost:9000/${RESET}"
50-
echo -e "${GREEN}Press Ctrl-C to quit${RESET}"; sleep 10;
50+
echo -e "${GREEN}Press Ctrl-C to quit${RESET}";
51+
$POD_MANAGER attach $container_id
5152
else
5253
echo -e "${RED}Unable to run the console locally. May this port is in usage already.${RESET}"
5354
echo -e "${RED}Check if the OLM is not accessible via web console at: http://localhost:9000/${RESET}"
5455
exit 1
5556
fi
56-
done
57-
}
58-
59-
function ctrl_c() {
60-
container_id="$($POD_MANAGER ps -q -f label=io.openshift.build.source-location=https://github.com/openshift/console)"
61-
$POD_MANAGER rm -f $container_id
62-
exit 130
6357
}
6458

6559
# Calling the functions
6660
verify_podman_binary
6761
add_host_port_arg
6862
pull_ocp_console_image
6963
run_ocp_console_image
70-
trap ctrl_c INT
7164
verify_ocp_console_image

0 commit comments

Comments
 (0)