Skip to content

Commit 49d5ca9

Browse files
author
Ganeshwara Herawan Hananda
authored
Add apt-wait.sh, which waits for an existing apt process to finish (#83)
Sometimes, our CI job which installs dependencies using `apt` would fail because the machine may perform an initial `apt` update in the background. This PR adds `apt-wait.sh` for waiting for an existing `apt` to finish.
1 parent 3f58c66 commit 49d5ca9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ci/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ py_binary(
7575
name = "test-cache",
7676
srcs = ["test-cache.py"],
7777
main = "test-cache.py"
78-
)
78+
)

ci/apt-wait.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
echo -n 'Waiting for the initial apt-get process to finish...'
4+
init_wait=0
5+
while [[ $init_wait -eq 0 ]]; do
6+
set +e
7+
ps -C apt-get > /dev/null
8+
init_wait=$?
9+
set -e
10+
echo -n '.'
11+
sleep 1
12+
done
13+
echo 'done.'

0 commit comments

Comments
 (0)