We don't use them, and their presence may cause transient failures
sometimes, e.g.:

```
Reading package lists...
E: Failed to fetch https://packages.microsoft.com/[...]  403  Forbidden [IP: 
...]
E: The repository 'https://packages.microsoft.com/[...]' is no longer signed.
Error: Process completed with exit code 100.
```

Signed-off-by: Ihar Hrachyshka <[email protected]>
---
 .ci/linux-util.sh                              |  2 +-
 .github/actions/prepare-apt/action.yaml        | 14 ++++++++++++++
 .github/workflows/containers.yml               |  2 +-
 .github/workflows/ovn-fake-multinode-tests.yml | 14 ++++++++++----
 .github/workflows/ovn-kubernetes.yml           |  4 +++-
 .github/workflows/ovn-upgrade-tests.yml        | 11 ++++++-----
 .github/workflows/test.yml                     | 16 +++++++++-------
 Makefile.am                                    |  1 +
 8 files changed, 45 insertions(+), 19 deletions(-)
 create mode 100644 .github/actions/prepare-apt/action.yaml

diff --git a/.ci/linux-util.sh b/.ci/linux-util.sh
index b5bd1f8c9..e0f338e69 100755
--- a/.ci/linux-util.sh
+++ b/.ci/linux-util.sh
@@ -11,7 +11,7 @@ function free_up_disk_space_ubuntu()
     # in the list above.
     local pkgs=$(echo $pkgs | sed 's/[^ ]* */~n&/g')
 
-    sudo apt update && sudo apt-get --auto-remove -y purge $pkgs
+    sudo apt-get --auto-remove -y purge $pkgs
 
     local paths='/usr/local/lib/android/ /usr/share/dotnet/ /opt/ghc/
                  /usr/local/share/boost/'
diff --git a/.github/actions/prepare-apt/action.yaml 
b/.github/actions/prepare-apt/action.yaml
new file mode 100644
index 000000000..91aa4dda7
--- /dev/null
+++ b/.github/actions/prepare-apt/action.yaml
@@ -0,0 +1,14 @@
+name: 'Prepare APT'
+description: 'Remove problematic repos and update APT cache'
+
+runs:
+  using: 'composite'
+  steps:
+    - name: Prepare APT
+      shell: bash
+      run: |
+        # Remove Microsoft repos that are pre-configured on GitHub runners.
+        # They can cause transient 403 errors and we don't need them.
+        sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list \
+                   /etc/apt/sources.list.d/azure-cli.list || true
+        sudo apt update
diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml
index 2779cff55..f5ed03db4 100644
--- a/.github/workflows/containers.yml
+++ b/.github/workflows/containers.yml
@@ -24,7 +24,7 @@ jobs:
       - uses: actions/checkout@v4
 
       - name: Update APT cache
-        run: sudo apt update
+        uses: ./.github/actions/prepare-apt
 
       - name: Install dependencies
         run: sudo apt install -y ${{ env.DEPENDENCIES }}
diff --git a/.github/workflows/ovn-fake-multinode-tests.yml 
b/.github/workflows/ovn-fake-multinode-tests.yml
index 89f9cd550..d3a75ddaf 100644
--- a/.github/workflows/ovn-fake-multinode-tests.yml
+++ b/.github/workflows/ovn-fake-multinode-tests.yml
@@ -51,10 +51,11 @@ jobs:
         repository: ${{ matrix.cfg.repo }}
         ref: ${{ matrix.cfg.branch }}
 
+    - name: Update APT cache
+      uses: ./.github/actions/prepare-apt
+
     - name: Install dependencies
-      run: |
-        sudo apt update || true
-        sudo apt-get install -y podman
+      run: sudo apt-get install -y podman
 
     - name: Fix /etc/hosts file
       run: |
@@ -116,9 +117,11 @@ jobs:
     - name: Check out ovn
       uses: actions/checkout@v4
 
+    - name: Update APT cache
+      uses: ./.github/actions/prepare-apt
+
     - name: install required dependencies
       run:  |
-        sudo apt update || true
         sudo apt install -y ${{ env.dependencies }}
         sudo apt install -y linux-modules-extra-$(uname -r)
 
@@ -132,6 +135,9 @@ jobs:
         . .ci/linux-util.sh
         disable_apparmor
 
+    - name: Update APT cache
+      uses: ./.github/actions/prepare-apt
+
     - name: Free up disk space
       run: |
         . .ci/linux-util.sh
diff --git a/.github/workflows/ovn-kubernetes.yml 
b/.github/workflows/ovn-kubernetes.yml
index 857d12ada..dc77ee75e 100644
--- a/.github/workflows/ovn-kubernetes.yml
+++ b/.github/workflows/ovn-kubernetes.yml
@@ -136,10 +136,12 @@ jobs:
         . .ci/linux-util.sh
         fix_etc_hosts
 
+    - name: Update APT cache
+      uses: ./.github/actions/prepare-apt
+
     - name: Install VRF kernel module
       run: |
         set -x
-        sudo apt update
         sudo apt-get install linux-modules-extra-$(uname -r) -y
         sudo modprobe vrf
 
diff --git a/.github/workflows/ovn-upgrade-tests.yml 
b/.github/workflows/ovn-upgrade-tests.yml
index 1edbf27e9..718d779cb 100644
--- a/.github/workflows/ovn-upgrade-tests.yml
+++ b/.github/workflows/ovn-upgrade-tests.yml
@@ -38,16 +38,17 @@ jobs:
       TESTSUITE: "upgrade-test"
 
     steps:
-    - name: system-level-dependencies
-      run: |
-        sudo apt update
-        sudo apt -y install linux-modules-extra-$(uname -r)
-
     - name: checkout
       uses: actions/checkout@v4
       with:
         submodules: recursive
 
+    - name: Update APT cache
+      uses: ./.github/actions/prepare-apt
+
+    - name: system-level-dependencies
+      run: sudo apt -y install linux-modules-extra-$(uname -r)
+
     - name: Fix /etc/hosts file
       run: |
         . .ci/linux-util.sh
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9fbea311f..879607c53 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -35,7 +35,7 @@ jobs:
       - uses: actions/checkout@v4
 
       - name: Update APT cache
-        run: sudo apt update
+        uses: ./.github/actions/prepare-apt
 
       - name: Install dependencies
         run: sudo apt install -y ${{ env.DEPENDENCIES }}
@@ -138,12 +138,6 @@ jobs:
         - { runner: ubuntu-24.04-arm, compiler: gcc, testsuite: system-test, 
test_range: "201-", unstable: unstable }
 
     steps:
-    - name: system-level-dependencies
-      if: ${{ startsWith(matrix.cfg.testsuite, 'system-test') }}
-      run: |
-        sudo apt update
-        sudo apt -y install linux-modules-extra-$(uname -r)
-
     - name: checkout
       if: github.event_name == 'push' || github.event_name == 'pull_request'
       uses: actions/checkout@v4
@@ -155,6 +149,14 @@ jobs:
       if: github.event_name == 'schedule'
       uses: actions/checkout@v4
 
+    - name: Update APT cache
+      if: ${{ startsWith(matrix.cfg.testsuite, 'system-test') }}
+      uses: ./.github/actions/prepare-apt
+
+    - name: system-level-dependencies
+      if: ${{ startsWith(matrix.cfg.testsuite, 'system-test') }}
+      run: sudo apt -y install linux-modules-extra-$(uname -r)
+
     # Weekly runs test using the tip of the most recent stable OVS branch
     # instead of the submodule.
     - name: checkout OVS
diff --git a/Makefile.am b/Makefile.am
index 50c0fbcd2..754ef34f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,6 +95,7 @@ EXTRA_DIST = \
        .ci/osx-prepare.sh \
        .ci/ovn-kubernetes/prepare.sh \
        .ci/ovn-kubernetes/custom.patch \
+       .github/actions/prepare-apt/action.yaml \
        .github/workflows/containers.yml \
        .github/workflows/test.yml \
        .github/workflows/ovn-kubernetes.yml \
-- 
2.52.0

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

Reply via email to