Use apt patterns [0] to only try to remove real packages.  Also unify
the way we free up disk space for all workflows.

[0] https://manpages.ubuntu.com/manpages/focal/man7/apt-patterns.7.html

Signed-off-by: Dumitru Ceara <[email protected]>
---
 .ci/linux-util.sh                              |   15 +++++++++++++++
 .github/workflows/ovn-fake-multinode-tests.yml |    9 +++++++--
 .github/workflows/ovn-kubernetes.yml           |   14 +++++---------
 Makefile.am                                    |    1 +
 4 files changed, 28 insertions(+), 11 deletions(-)
 create mode 100755 .ci/linux-util.sh

diff --git a/.ci/linux-util.sh b/.ci/linux-util.sh
new file mode 100755
index 0000000000..2cb87b70ef
--- /dev/null
+++ b/.ci/linux-util.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+function free_up_disk_space_ubuntu()
+{
+    local pkgs='azure-cli aspnetcore-* dotnet-* ghc-* firefox*
+                google-chrome-stable google-cloud-sdk libmono-* llvm-*
+                microsoft-edge-stable mono-* msbuild mysql-server-core-*
+                php-* php7* powershell* temurin-* zulu-*'
+
+    # Use apt patterns to only select real packages that match the names
+    # in the list above.
+    local pkgs=$(echo $pkgs | sed 's/[^ ]* */~n&/g')
+
+    sudo apt update && sudo apt-get --auto-remove -y purge $pkgs
+}
diff --git a/.github/workflows/ovn-fake-multinode-tests.yml 
b/.github/workflows/ovn-fake-multinode-tests.yml
index 75c5ca8188..f1e77baf68 100644
--- a/.github/workflows/ovn-fake-multinode-tests.yml
+++ b/.github/workflows/ovn-fake-multinode-tests.yml
@@ -99,14 +99,19 @@ jobs:
       XDG_RUNTIME_DIR: ''
 
     steps:
+    - name: Check out ovn
+      uses: actions/checkout@v3
+
     - name: install required dependencies
       run:  |
         sudo apt update || true
         sudo apt install -y ${{ env.dependencies }}
 
     - name: Free up disk space
-      run: sudo eatmydata apt-get remove --auto-remove -y aspnetcore-* 
dotnet-* libmono-* mono-* msbuild php-* php7* ghc-* zulu-*
-
+      run: |
+        . .ci/linux-util.sh
+        free_up_disk_space_ubuntu
+  
     - uses: actions/download-artifact@v3
       with:
         name: test-main-image
diff --git a/.github/workflows/ovn-kubernetes.yml 
b/.github/workflows/ovn-kubernetes.yml
index 69ab0566d2..d9a91874ff 100644
--- a/.github/workflows/ovn-kubernetes.yml
+++ b/.github/workflows/ovn-kubernetes.yml
@@ -95,18 +95,14 @@ jobs:
       KIND_IPV6_SUPPORT: "${{ matrix.ipfamily == 'IPv6' || matrix.ipfamily == 
'dualstack' }}"
     steps:
 
-    - name: Free up disk space
-      run: |
-        sudo eatmydata apt-get purge --auto-remove -y \
-          azure-cli aspnetcore-* dotnet-* ghc-* firefox \
-          google-chrome-stable google-cloud-sdk \
-          llvm-* microsoft-edge-stable mono-* \
-          msbuild mysql-server-core-* php-* php7* \
-          powershell temurin-* zulu-*
-
     - name: Check out ovn
       uses: actions/checkout@v3
 
+    - name: Free up disk space
+      run: |
+        . .ci/linux-util.sh
+        free_up_disk_space_ubuntu
+
     - name: Check out ovn-kubernetes
       uses: actions/checkout@v3
       with:
diff --git a/Makefile.am b/Makefile.am
index b58d4a5018..06045760a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,6 +90,7 @@ EXTRA_DIST = \
        .ci/dpdk-build.sh \
        .ci/dpdk-prepare.sh \
        .ci/linux-build.sh \
+       .ci/linux-util.sh \
        .ci/osx-build.sh \
        .ci/osx-prepare.sh \
        .ci/ovn-kubernetes/Dockerfile \

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to