From 9290c192c2b17713adcefef33b3236b4b7290ccc Mon Sep 17 00:00:00 2001 From: Tobias K <6317548+theCalcaholic@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:38:05 +0100 Subject: [PATCH] build-sd-images.yml: Fix qemu-static support for ubuntu-latest runner Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com> --- .github/workflows/build-sd-images.yml | 45 ++++++++++++++------------- build/build-SD-armbian.sh | 1 + 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-sd-images.yml b/.github/workflows/build-sd-images.yml index 0c2f27f90..a7bcc864c 100644 --- a/.github/workflows/build-sd-images.yml +++ b/.github/workflows/build-sd-images.yml @@ -23,7 +23,7 @@ on: jobs: build: - runs-on: [ubuntu-latest, x64] + runs-on: ubuntu-20.04 env: VERSION: "${{ inputs.git_ref }}" LOG_GUEST: "\\033[1;34mGUEST::\\033[0m" @@ -38,11 +38,16 @@ jobs: artifact_file: ${{ env.ARTIFACT_FILE }} artifact_name: ${{ github.run_id }}-${{ inputs.board_id }}-image steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 # - name: Set up QEMU -# uses: docker/setup-qemu-action@v3 - - name: Setup qemu-user-static - run: | - sudo apt-get update +# run: | +# sudo apt-get update +# sudo apt-get install -y binfmt-support +# curl -L -o /tmp/qemu.sh 'https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh' +# bash /tmp/qemu.sh --debian +# sudo systemctl disable apparmor +# docker run --rm --privileged tonistiigi/binfmt:latest --install all # docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes # sudo mkdir -p /etc/binfmt # for conf in qemu-{aarch64,arm}-static.conf @@ -64,7 +69,7 @@ jobs: continue-on-error: true run: | set -ex - export IMG="NextCloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img" + 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 }}" @@ -82,7 +87,7 @@ jobs: echo -e "${LOG_CICD} Cleanup armbian build leftovers..." sudo rm -rf armbian/ tmp/ output/ - export IMG="NextCloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img" + 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 }}" @@ -104,7 +109,7 @@ jobs: run: | set -ex echo -e "${LOG_CICD} Protected? ${{ github.ref_protected }}" - export IMG="NextCloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img" + 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 @@ -130,7 +135,7 @@ jobs: test: needs: build - runs-on: [ubuntu-latest, x64] + runs-on: ubuntu-20.04 env: VERSION: "${{ inputs.git_ref }}" ARTIFACT_ID: ${{ needs.build.outputs.artifact_name }} @@ -144,22 +149,20 @@ jobs: run: shell: bash steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 # - name: Set up QEMU -# uses: docker/setup-qemu-action@v3 - - name: Apt update - run: | - sudo apt-get update -# sudo apt-get -y --no-install-recommends install qemu-user-static -# - name: Apply workaround for sudo bug (https://github.com/multiarch/qemu-user-static/issues/17) # run: | # sudo apt-get update -# sudo apt-get -y --no-install-recommends install binfmt-support qemu-user-static +# 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 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 + # 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 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/build/build-SD-armbian.sh b/build/build-SD-armbian.sh index 4a10d5ece..0f738a332 100755 --- a/build/build-SD-armbian.sh +++ b/build/build-SD-armbian.sh @@ -32,6 +32,7 @@ prepare_dirs # tmp cache output # get latest armbian [[ -d armbian ]] || { git clone --depth 100 https://github.com/armbian/build armbian + ( cd armbian && git checkout c47c9372bf6970d6ca8c32bc5f7ec2a1416ab5bd; ) } #( cd armbian && git pull --ff-only --tags && git checkout v23.02 ) #sed -i -e '/export rootfs_size=/s/du -sm/du --apparent-size -sm/' armbian/lib/functions/image/partitioning.sh