]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
github/actions: Introduce a timeout to avoid apt races
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 22 Feb 2023 14:43:45 +0000 (20:13 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 27 Feb 2023 16:46:45 +0000 (09:46 -0700)
There are chances that apt-get operations are run on the same VM by
different runners both competing to get apt locks. Introduce timeout of
3 seconds, in case the lock is already taken by another instance of
a runner.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit ddcd79dede4265d891247004432f9c4e845a5a4a)

.github/actions/setup-libcgroup/action.yml

index 29d3f85ebf4c14282819920295c2f9c7d2df065f..83d63dbd2ed08a3afeffbffc7129587f496540b3 100644 (file)
@@ -11,9 +11,13 @@ description: "Install dependencies, git clone, bootstrap, configure, and make li
 runs:
   using: "composite"
   steps:
-  - run: sudo apt-get update
+  - run: |
+      while sudo fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1; do sleep 3; done
+      sudo apt-get update
     shell: bash
-  - run: sudo apt-get install libpam-dev lcov python3-pip python3-dev cmake bison flex byacc g++ autoconf automake libtool libsystemd-dev -y
+  - run: |
+      while sudo fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1; do sleep 3; done
+      sudo apt-get install libpam-dev lcov python3-pip python3-dev cmake bison flex byacc g++ autoconf automake libtool libsystemd-dev -y
     shell: bash
   - run: sudo pip install cython
     shell: bash