mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: properly wait for external browser tunnels to terminate
We currently wait for browser tunnels of Saucelabs and Browserstack to terminate by repeatedly checking with `ps -p`. This is not reliable and can break if the host system is not removing forcibly killed child processes from the process table. This is valid since the tunnels are launched as child processes and we ideally wait for those to terminate using the `wait` command.
This commit is contained in:
committed by
Jeremy Elbourn
parent
10cd71a0ed
commit
21594d33e8
@@ -68,3 +68,7 @@ browserstack-tunnel/BrowserStackLocal -k ${BROWSER_STACK_ACCESS_KEY} ${ARGS} 2>&
|
||||
|
||||
# Wait for the tunnel to be ready and create the readyfile with the Browserstack PID
|
||||
create_ready_file ${!} &
|
||||
|
||||
# Wait for all sub processes to finish. This ensures that no zombie
|
||||
# processes are left over.
|
||||
wait
|
||||
|
||||
@@ -19,10 +19,5 @@ tunnelProcessId=$(cat ${tunnelReadyFile})
|
||||
# we cannot use killall because CircleCI base container images don't have it installed.
|
||||
kill ${tunnelProcessId}
|
||||
|
||||
while (ps -p ${tunnelProcessId} &> /dev/null); do
|
||||
printf "."
|
||||
sleep .5
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Browserstack tunnel has been shut down"
|
||||
echo "Browserstack tunnel interrupt signal has been sent."
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
# proper exit code.
|
||||
set -e
|
||||
|
||||
# Path to the project directory.
|
||||
projectDir="$(dirname ${0})/../.."
|
||||
|
||||
# Go to project directory.
|
||||
cd $(dirname ${0})/../..
|
||||
cd ${projectDir}
|
||||
|
||||
# Decode access token and make it accessible for child processes.
|
||||
export BROWSER_STACK_ACCESS_KEY=`echo ${BROWSER_STACK_ACCESS_KEY} | rev`
|
||||
|
||||
# Start tunnel and wait for it being ready.
|
||||
./scripts/browserstack/start-tunnel.sh
|
||||
./scripts/browserstack/start-tunnel.sh &
|
||||
./scripts/browserstack/wait-tunnel.sh
|
||||
|
||||
# Setup the test platform environment variable that will be read
|
||||
@@ -24,3 +27,6 @@ yarn gulp ci:test
|
||||
# Kill the Browserstack tunnel. This is necessary in order to avoid rate-limit
|
||||
# errors that cause the unit tests to be flaky.
|
||||
./scripts/browserstack/stop-tunnel.sh
|
||||
|
||||
# Wait for all sub processes to terminate properly.
|
||||
wait
|
||||
|
||||
@@ -11,7 +11,7 @@ cd $(dirname ${0})/../..
|
||||
export SAUCE_ACCESS_KEY=`echo ${SAUCE_ACCESS_KEY} | rev`
|
||||
|
||||
# Start tunnel and wait for it being ready.
|
||||
./scripts/saucelabs/start-tunnel.sh
|
||||
./scripts/saucelabs/start-tunnel.sh &
|
||||
./scripts/saucelabs/wait-tunnel.sh
|
||||
|
||||
# Setup the test platform environment variable that will be read
|
||||
@@ -24,3 +24,6 @@ yarn gulp ci:test
|
||||
# Kill the Saucelabs tunnel. This is necessary in order to avoid rate-limit
|
||||
# errors that cause the unit tests to be flaky.
|
||||
./scripts/saucelabs/stop-tunnel.sh
|
||||
|
||||
# Wait for all sub processes to terminate properly.
|
||||
wait
|
||||
|
||||
@@ -35,4 +35,4 @@ fi
|
||||
|
||||
echo "Starting Sauce Connect in the background. Passed arguments: ${sauceArgs}"
|
||||
|
||||
sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs} &
|
||||
sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs}
|
||||
|
||||
@@ -19,10 +19,5 @@ tunnelProcessId=$(cat ${tunnelPidFile})
|
||||
# we cannot use killall because CircleCI base container images don't have it installed.
|
||||
kill ${tunnelProcessId}
|
||||
|
||||
while (ps -p ${tunnelProcessId} &> /dev/null); do
|
||||
printf "."
|
||||
sleep .5
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Sauce Connect tunnel has been shut down"
|
||||
echo "Sauce Connect tunnel interrupt signal has been sent."
|
||||
|
||||
Reference in New Issue
Block a user