Skip to content

Commit bbed326

Browse files
committed
build-sd-images.yml: Fix test setup
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
1 parent 93f76ec commit bbed326

2 files changed

Lines changed: 41 additions & 7 deletions

File tree

.github/workflows/build-sd-images.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
# update-binfmts --display qemu-arm
6666
- name: "Build Armbian"
6767
id: build-armbian
68+
if: "${{ inputs.board_id != 'rpi5b' }}"
6869
continue-on-error: true
6970
run: |
7071
set -ex
@@ -79,7 +80,7 @@ jobs:
7980
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
8081
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
8182
- name: "Build Armbian (2nd attempt)"
82-
if: ${{ steps.build-armbian.outcome == 'failure' }}
83+
if: ${{ steps.build-armbian.outcome == 'failure' && inputs.board_id != 'rpi5b' }}
8384
id: build-armbian-2nd
8485
run: |
8586
set -ex
@@ -96,13 +97,27 @@ jobs:
9697
mv "${artifacts[0]}" "output/$IMG"
9798
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
9899
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
100+
# - name: "Download test image"
101+
# if: "${{ inputs.board_id == 'rpi5b' }}"
102+
# run: |
103+
# mkdir -p output
104+
# wget -q -O output/Armbian_Test.img https://pack.minecraft.private-cloud.network/NCP_Armbian_Test.img
105+
# echo "ARTIFACT_FILE=Armbian_Test.img" >> $GITHUB_ENV
106+
# echo "artifact_file=Armbian_Test.img" >> $GITHUB_OUTPUT
107+
99108
- name: "Upload Armbian logs"
100109
if: ${{ failure() }}
101110
uses: actions/upload-artifact@v3
102111
with:
103112
name: ${{ github.run_id }}-${{ inputs.board_id }}-logs
104113
path: armbian/output
114+
- name: Set variables
115+
if: "${{ inputs.board_id == 'rpi5b' }}"
116+
run: |
117+
echo "ARTIFACT_FILE=Armbian_Test.img" >> $GITHUB_ENV
118+
echo "artifact_file=Armbian_Test.img" >> $GITHUB_OUTPUT
105119
- name: upload image to artifact store
120+
if: "${{ inputs.board_id != 'rpi5b' }}"
106121
uses: actions/upload-artifact@v3
107122
with:
108123
name: ${{ github.run_id }}-${{ inputs.board_id }}-image
@@ -129,15 +144,30 @@ jobs:
129144
uses: docker/setup-qemu-action@v3
130145
- name: Disable apparmor
131146
run: |
147+
sudo apt-get update
148+
sudo apt-get install -y binfmt-support
149+
curl -L -o /tmp/qemu.sh 'https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh'
150+
bash /tmp/qemu.sh --debian
151+
sudo systemctl disable apparmor
152+
docker run --rm --privileged tonistiigi/binfmt:latest --install all
153+
docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
132154
sudo systemctl disable apparmor
133155
- name: Checkout code
134156
uses: actions/checkout@v3
135157
with:
136158
ref: "${{ env.VERSION }}"
137159
- uses: actions/download-artifact@v3
160+
if: "${{ inputs.board_id != 'rpi5b' }}"
138161
with:
139162
name: ${{ env.ARTIFACT_ID }}
140163
path: output
164+
- name: "Download test image"
165+
if: "${{ inputs.board_id == 'rpi5b' }}"
166+
run: |
167+
mkdir -p output
168+
wget -q -O output/Armbian_Test.img https://pack.minecraft.private-cloud.network/NCP_Armbian_Test.img
169+
echo "ARTIFACT_FILE=Armbian_Test.img" >> $GITHUB_ENV
170+
echo "artifact_file=Armbian_Test.img" >> $GITHUB_OUTPUT
141171
- name: Prepare test
142172
run: |
143173
set -x
@@ -154,6 +184,7 @@ jobs:
154184
sudo chmod +x raspbian_root/usr/bin/qemu-{arm,aarch64}-static
155185
echo 'Mutex posixsem' | sudo tee -a raspbian_root/etc/apache2/mods-available/ssl.conf
156186
echo 'ignore-warnings ARM64-COW-BUG' | sudo tee -a raspbian_root/etc/redis/redis.conf
187+
sudo sed -i 's/NoExecPaths=.*//g' raspbian_root/usr/lib/systemd/system/redis-server.service
157188
sudo mkdir -p raspbian_root/etc/systemd/system/redis-server.service.d
158189
echo '[Service]' | sudo tee raspbian_root/etc/systemd/system/redis-server.service.d/ncp.conf
159190
echo 'PrivateUsers=false' | sudo tee -a raspbian_root/etc/systemd/system/redis-server.service.d/ncp.conf
@@ -282,20 +313,20 @@ jobs:
282313
echo -e "${LOG_DIAG} /etc/os-release:"
283314
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'cat /etc/os-release'
284315
echo -e "${LOG_DIAG} /usr/local/etc/ncp.cfg:"
285-
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'cat /usr/local/etc/ncp.cfg'
316+
"${CONTAINER_CMD[@]}" --pipe -q ncp /bin/bash -c 'cat /usr/local/etc/ncp.cfg'
286317
cat ./raspbian_root/usr/local/etc/ncp.cfg
287-
echo -e "${LOG_DIAG} /home/ncp-app-bridge confi g ncp"
288-
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'sudo -u www-data sudo /home/www/ncp-app-bridge.sh config ncp'
318+
echo -e "${LOG_DIAG} /home/ncp-app-bridge config ncp"
289319
sudo ls -l ./raspbian_root/home/www/ncp-app-bridge.sh
320+
"${CONTAINER_CMD[@]}" --pipe --uid=33 ncp /bin/bash -c 'sudo /home/www/ncp-app-bridge.sh config ncp'
290321
echo -e "{$LOG_DIAG} Geckodriver logs:"
291322
tail -n 20 geckodriver.log >&2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
292323
echo -e "${LOG_CICD} ================"
293324
echo -e "${LOG_DIAG} ncp.log: "
294-
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c "tail -n20 /var/log/ncp.log" |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
325+
"${CONTAINER_CMD[@]}" --pipe ncp /bin/bash -c "tail -n20 /var/log/ncp.log" |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
295326
echo "================"
296327
echo "${LOG_DIAG} Nextcloud log: "
297-
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'ls -l /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
298-
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'cat /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
328+
"${CONTAINER_CMD[@]}" --pipe -q ncp /bin/bash -c 'ls -l /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
329+
"${CONTAINER_CMD[@]}" --pipe -q ncp /bin/bash -c 'cat /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
299330
sudo cat ./raspbian_root/opt/ncdata/data/nextcloud.log |& awk "{ print \"${LOG_DIAG} \" \$0 }"
300331
sleep 12
301332
continue

tests/nextcloud_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import re
2121
import time
2222
from pathlib import Path
23+
from pprint import pprint
2324

2425
from selenium import webdriver
2526
from selenium.webdriver.common.by import By
@@ -286,6 +287,8 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver, skip_release_check:
286287
print(f"{tc.yellow}{divs[1].text} != {ncp_cfg['release']}")
287288
failed = list(map(lambda item: item[0], filter(lambda item: not item[1], expected.items())))
288289
test.check(len(failed) == 0, f"checks failed for admin section: [{', '.join(failed)}]")
290+
if failed:
291+
pprint(expected)
289292
except Exception as e:
290293
test.check(e)
291294
test.new("admin section (2)")

0 commit comments

Comments
 (0)