[buildbot] ci: generalize container test step

LEDE Commits lede-commits at lists.infradead.org
Thu Nov 16 03:48:28 PST 2023


ynezz pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/b9790bcd45e8ec1d000fd2bc48fb6948eb2ba5cc

commit b9790bcd45e8ec1d000fd2bc48fb6948eb2ba5cc
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Tue Nov 14 14:49:37 2023 +0100

    ci: generalize container test step
    
    Generalize container test step by using include feature of matrix
    strategy and defining additional values for container command test and
    config verification.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 .github/workflows/build-push.yml | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml
index f4e4259..07945bf 100644
--- a/.github/workflows/build-push.yml
+++ b/.github/workflows/build-push.yml
@@ -54,9 +54,12 @@ jobs:
     strategy:
       fail-fast: ${{ github.event_name == 'pull_request' }}
       matrix:
-        container_flavor:
-          - master
-          - worker
+        include:
+          - container_flavor: master
+            container_verify_string: "buildmaster configured in /master"
+          - container_flavor: worker
+            container_test_command: "--env BUILDWORKER_NAME=X --env BUILDWORKER_PASSWORD=Y"
+            container_verify_string: "worker configured in /builder"
 
     steps:
       - name: Checkout
@@ -76,21 +79,12 @@ jobs:
             BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
             OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}
 
-      - name: Test master Docker container
-        if: matrix.container_flavor == 'master'
+      - name: Test ${{ matrix.container_flavor }} Docker container
         run: |
-          docker run --detach --name test-master local/master
+          docker run --detach ${{ matrix.container_test_command }} --name test-${{ matrix.container_flavor }} local/${{ matrix.container_flavor }}
           sleep 5
-          docker logs test-master | tee master.log
-          grep "buildmaster configured in /master" master.log
-
-      - name: Test worker Docker container
-        if: matrix.container_flavor == 'worker'
-        run: |
-          docker run --detach --env BUILDWORKER_NAME=X --env BUILDWORKER_PASSWORD=Y --name test-worker local/worker
-          sleep 5
-          docker logs test-worker | tee worker.log
-          grep "worker configured in /builder" worker.log
+          docker logs test-${{ matrix.container_flavor }} | tee ${{ matrix.container_flavor }}.log
+          grep "${{ matrix.container_verify_string }}" ${{ matrix.container_flavor }}.log
 
       - name: Docker meta
         id: meta




More information about the lede-commits mailing list