Build the image before every job to allow more
fine-grained dependency pinning. This is especially
useful for stable branches as they might need to stay
on specific distribution or Python version.

Signed-off-by: Ales Musil <amu...@redhat.com>
---
 .cirrus.yml                | 40 ++++++++++++++++++++++++++++-----
 .github/workflows/test.yml | 46 +++++++++++++++++++++++++++++++++++---
 2 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 71e9afbb6..894f953f3 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,9 +1,25 @@
-arm_unit_tests_task:
+compute_engine_instance:
+  image_project: ubuntu-os-cloud
+  image: family/ubuntu-2304-amd64
+  platform: linux
+  memory: 4G
+
+build_image_task:
+  install_dependencies_script:
+    - sudo apt update
+    - sudo apt install -y podman make
+
+  build_container_script:
+    - cd utilities/containers
+    - make ubuntu
+    - podman save -o /tmp/image.tar ovn-org/ovn-tests:ubuntu
+
+  upload_image_script:
+    - curl -s -X POST -T /tmp/image.tar 
http://$CIRRUS_HTTP_CACHE_HOST/${CIRRUS_CHANGE_IN_REPO}
 
-  arm_container:
-    image: ghcr.io/ovn-org/ovn-tests:ubuntu
-    memory: 4G
-    cpu: 2
+arm_unit_tests_task:
+  depends_on:
+    - build_image
 
   env:
     ARCH: aarch64
@@ -11,6 +27,7 @@ arm_unit_tests_task:
     PATH: ${HOME}/bin:${HOME}/.local/bin:${PATH}
     RECHECK: yes
     LANG: C
+    IMAGE_NAME: ovn-org/ovn-tests:ubuntu
     matrix:
       - CC: gcc
         TESTSUITE: test
@@ -35,5 +52,16 @@ arm_unit_tests_task:
 
   name: ARM64 ${CC} ${TESTSUITE} ${TEST_RANGE}
 
+  install_dependencies_script:
+    - sudo apt update
+    - sudo apt install -y podman
+
+  download_cache_script:
+    - curl http://$CIRRUS_HTTP_CACHE_HOST/${CIRRUS_CHANGE_IN_REPO} -o 
/tmp/image.tar
+
+  load_image_script:
+    - podman load -i /tmp/image.tar
+    - rm -rf /tmp/image.tar
+
   build_script:
-    - ./.ci/linux-build.sh
+    - ./.ci/ci.sh --archive-logs
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b3fcb57fc..fdbc8f5f5 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -80,10 +80,38 @@ jobs:
       if: steps.dpdk_cache.outputs.cache-hit != 'true'
       run: ./.ci/dpdk-build.sh
 
+  prepare-container:
+    env:
+      DEPENDENCIES: podman
+    name: Prepare container
+    runs-on: ubuntu-22.04
+
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Update APT cache
+        run: sudo apt update
+
+      - name: Install dependencies
+        run: sudo apt install -y ${{ env.DEPENDENCIES }}
+
+      - name: Build container
+        run: make ubuntu
+        working-directory: utilities/containers
+
+      - name: Export image
+        run: podman save -o /tmp/image.tar ovn-org/ovn-tests
+
+      - name: Cache image
+        id: image_cache
+        uses: actions/cache@v3
+        with:
+          path: /tmp/image.tar
+          key: ${{ github.sha }}
+
   build-linux:
-    needs: build-dpdk
+    needs: [build-dpdk, prepare-container]
     env:
-      IMAGE_NAME:  ghcr.io/ovn-org/ovn-tests:ubuntu
       ARCH:        ${{ matrix.cfg.arch }}
       CC:          ${{ matrix.cfg.compiler }}
       DPDK:        ${{ matrix.cfg.dpdk }}
@@ -152,13 +180,25 @@ jobs:
             sort -V | tail -1)
       working-directory: ovs
 
-    - name: cache
+    - name: cache dpdk
       if: matrix.cfg.dpdk != ''
       uses: actions/cache@v3
       with:
         path: dpdk-dir
         key: ${{ needs.build-dpdk.outputs.dpdk_key }}
 
+    - name: image cache
+      uses: actions/cache@v3
+      with:
+        path: /tmp/image.tar
+        key: ${{ github.sha }}
+
+    - name: load image
+      run: |
+        sudo podman load -i /tmp/image.tar
+        podman load -i /tmp/image.tar
+        rm -rf /tmp/image.tar
+
     - name: build
       if: ${{ startsWith(matrix.cfg.testsuite, 'system-test') }}
       run: sudo -E ./.ci/ci.sh --archive-logs
-- 
2.41.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to