From 8538bfe631553ea6c9d097f8ccdb55f2172ce0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Thu, 5 Sep 2024 12:40:58 +0200 Subject: [PATCH] build-sd-images.yml: Fix armbian tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- .github/workflows/build-sd-images.yml | 63 +++++++-------------------- 1 file changed, 16 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build-sd-images.yml b/.github/workflows/build-sd-images.yml index bb518ca54..c44083977 100644 --- a/.github/workflows/build-sd-images.yml +++ b/.github/workflows/build-sd-images.yml @@ -64,29 +64,28 @@ jobs: # update-binfmts --display qemu-aarch64 # update-binfmts --display qemu-arm - name: "Build Armbian" - if: ${{ inputs.board_id != 'raspberrypi' }} id: build-armbian continue-on-error: true run: | set -ex export IMG="NextcloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img" [[ "${{ github.ref_protected }}" == true ]] || export DBG=x - + ./build/build-SD-armbian.sh "${{ inputs.board_id }}" "${{ inputs.board_name }}" - + artifacts=("armbian/output/images/Armbian"*.img) mkdir -p output mv "${artifacts[0]}" "output/$IMG" echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV - name: "Build Armbian (2nd attempt)" - if: ${{ inputs.board_id != 'raspberrypi' && steps.build-armbian.outcome == 'failure' }} + if: ${{ steps.build-armbian.outcome == 'failure' }} id: build-armbian-2nd run: | set -ex echo -e "${LOG_CICD} Cleanup armbian build leftovers..." sudo rm -rf armbian/ tmp/ output/ - + export IMG="NextcloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img" [[ "${{ github.ref_protected }}" == true ]] || export DBG=x @@ -98,34 +97,11 @@ jobs: echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV - name: "Upload Armbian logs" - if: ${{ inputs.board_id != 'raspberrypi' && failure() }} + if: ${{ failure() }} uses: actions/upload-artifact@v3 with: name: ${{ github.run_id }}-${{ inputs.board_id }}-logs path: armbian/output - - name: Build RPI SD Image - if: ${{ inputs.board_id == 'raspberrypi' }} - id: build-rpi - run: | - set -ex - echo -e "${LOG_CICD} Protected? ${{ github.ref_protected }}" - export IMG="NextcloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img" - [[ "${{ github.ref_protected }}" == true ]] || export DBG=x - wget -q https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-aarch64-static -O ./qemu-aarch64-static - ./build/build-SD-rpi.sh - mkdir -p output - mv "tmp/$IMG" ./output/ - - for i in {1..10} - do - sudo losetup | grep "${IMG}" || break; - [[ "$i" -lt 10 ]] || { echo -e "${LOG_CICD} Timeout while waiting for image to unmount"; exit 1; } - sleep 6 - echo -e "${LOG_CICD} Retrying ($i out of 10)" - done - - echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT - echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV - name: upload image to artifact store uses: actions/upload-artifact@v3 with: @@ -135,7 +111,7 @@ jobs: test: needs: build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: VERSION: "${{ inputs.git_ref }}" ARTIFACT_ID: ${{ needs.build.outputs.artifact_name }} @@ -151,18 +127,9 @@ jobs: steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up QEMU + - name: Disable apparmor run: | - sudo apt-get update - sudo apt-get install -y binfmt-support - docker run --rm --privileged tonistiigi/binfmt:latest --install all - docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes -# sudo systemctl disable apparmor - # sudo mkdir -p /etc/binfmt - # for conf in qemu-{aarch64,arm}-static.conf - # do - # sed 's/:F$/:OC/' /usr/lib/binfmt.d/$conf | sudo tee /etc/binfmt/$conf - # done + sudo systemctl disable apparmor - name: Checkout code uses: actions/checkout@v3 with: @@ -249,12 +216,14 @@ jobs: done [[ "$success" == "true" ]] || { - echo -e "${LOG_CICD} Timeout reached." - "${CONTAINER_CMD[@]}" -q systemctl status mysql |& awk "{ print \"${LOG_DIAG} \" \$0 }" - "${CONTAINER_CMD[@]}" -q systemctl status redis |& awk "{ print \"${LOG_DIAG} \" \$0 }" - "${CONTAINER_CMD[@]}" -q systemctl status 'php*-fpm' |& awk "{ print \"${LOG_DIAG} \" \$0 }" - "${CONTAINER_CMD[@]}" -q systemctl status apache2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" - "${CONTAINER_CMD[@]}" -q ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }" + echo -e "${LOG_CICD} ERR: Timeout reached." + "${CONTAINER_CMD[@]}" -q systemctl status mysql |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||: + "${CONTAINER_CMD[@]}" -q systemctl status redis-server |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||: + sudo journalctl --file ./raspbian_root/var/log/journal/"$(sudo cat ./raspbian_root/etc/machine-id)"/system.journal --no-pager -eu redis-server ||: + "${CONTAINER_CMD[@]}" -q journalctl --no-pager -eu redis-server + "${CONTAINER_CMD[@]}" -q systemctl status 'php*-fpm' |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||: + "${CONTAINER_CMD[@]}" -q systemctl status apache2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||: + "${CONTAINER_CMD[@]}" -q ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||: exit 1 }