From 04a0b789e99935ab26d270c1a4b9291d56a6927d Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 14:09:09 +0200 Subject: [PATCH 01/13] reduce timeout for debugging --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 5990dec0c..0275a38e2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -169,7 +169,7 @@ jobs: - name: Wait for server to start run: | - TIMEOUT_SECONDS=660 + TIMEOUT_SECONDS=120 START_TIME=$(date +%s) while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do From 69c90083e9c2b7f723a304c1e0f993699d867f56 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 14:17:03 +0200 Subject: [PATCH 02/13] add debug echo --- scripts/start.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/start.sh b/scripts/start.sh index c57b9d09b..a61b07a01 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -44,6 +44,7 @@ fi # Check if the architecture is arm64 if [ "$architecture" == "arm64" ]; then # create an arm64 version of ./PalServer.sh + echo "Copying palserver.sh" cp ./PalServer.sh ./PalServer-arm64.sh pagesize=$(getconf PAGESIZE) From 00e514f368c0a9f74623d532a41d0aeeb1aad6fe Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 14:27:03 +0200 Subject: [PATCH 03/13] show all executed --- scripts/start.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/start.sh b/scripts/start.sh index a61b07a01..9951fad53 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,4 +1,6 @@ #!/bin/bash + +set -x # shellcheck source=scripts/helper_functions.sh source "/home/steam/server/helper_functions.sh" @@ -44,7 +46,6 @@ fi # Check if the architecture is arm64 if [ "$architecture" == "arm64" ]; then # create an arm64 version of ./PalServer.sh - echo "Copying palserver.sh" cp ./PalServer.sh ./PalServer-arm64.sh pagesize=$(getconf PAGESIZE) From a90cbeb13c63ebea5791acf79464540bbd12c326 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 14:38:36 +0200 Subject: [PATCH 04/13] update arm base image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e3f6c413b..d9d9abeff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN wget -q https://github.com/gorcon/rcon-cli/archive/refs/tags/v${RCON_VERSION FROM cm2network/steamcmd:root as base-amd64 # Ignoring --platform=arm64 as this is required for the multi-arch build to continue to work on amd64 hosts # hadolint ignore=DL3029 -FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-05-26 as base-arm64 +FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-06-16 as base-arm64 ARG TARGETARCH # Ignoring the lack of a tag here because the tag is defined in the above FROM lines From 5b968d178cae9a4eec310f67451300ed68435285 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 21:35:10 +0200 Subject: [PATCH 05/13] change qemu image to later version --- .github/workflows/unit-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 339ef4060..1d977a8e8 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -141,6 +141,9 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 + with: + image: tonistiigi/binfmt:qemu-v8.1.5 + platforms: arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -169,7 +172,7 @@ jobs: - name: Wait for server to start run: | - TIMEOUT_SECONDS=120 + TIMEOUT_SECONDS=660 START_TIME=$(date +%s) while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do From 6b1527fc1c07e04871968eee09547ba681c36599 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 21:52:27 +0200 Subject: [PATCH 06/13] remove platform --- .github/workflows/unit-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 1d977a8e8..17db5f053 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -143,7 +143,6 @@ jobs: uses: docker/setup-qemu-action@v3 with: image: tonistiigi/binfmt:qemu-v8.1.5 - platforms: arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From a5a5beeff70cc7ef22d51462e44a3e1e7fb5e2ed Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 22:13:50 +0200 Subject: [PATCH 07/13] run unit tests on self-hosted runner --- .github/workflows/unit-test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 17db5f053..f720fa54a 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -134,15 +134,15 @@ jobs: unit-test-arm64: name: Docker - Test (arm64) - runs-on: ubuntu-latest + runs-on: [self-hosted, ARM64] steps: - name: Checkout uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - image: tonistiigi/binfmt:qemu-v8.1.5 + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + # with: + # image: tonistiigi/binfmt:qemu-v8.1.5 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From cf2e146bd9a0a242b5bf49f50c0bd2520ec74dde Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 22:27:59 +0200 Subject: [PATCH 08/13] remove show executed --- scripts/start.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 9951fad53..c57b9d09b 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,4 @@ #!/bin/bash - -set -x # shellcheck source=scripts/helper_functions.sh source "/home/steam/server/helper_functions.sh" From 5fe855e3be4d12d22c741f8bc7aacf883a5d9bda Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 22:29:58 +0200 Subject: [PATCH 09/13] revert palworld folder name --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index f720fa54a..537e59124 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -163,7 +163,7 @@ jobs: -p 8211:8211/udp \ -p 27015:27015/udp \ -p 25575:25575/tcp \ - -v ./palworld-${{ github.run_id }}:/palworld/ \ + -v ./palworld:/palworld/ \ --env-file .env.example \ --restart unless-stopped \ --stop-timeout 30 \ From 932e1d246f746c6d9cb58cec9ec39aa5523103fe Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 22:42:27 +0200 Subject: [PATCH 10/13] add cleanup --- .github/workflows/unit-test.yml | 40 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 537e59124..a460b41a0 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -158,12 +158,12 @@ jobs: - name: Run server run: | docker run -d \ - --name palworld-server \ + --name palworld-server-${{ github.run_id }} \ --platform linux/arm64 \ -p 8211:8211/udp \ -p 27015:27015/udp \ -p 25575:25575/tcp \ - -v ./palworld:/palworld/ \ + -v ./palworld-${{ github.run_id }}:/palworld/ \ --env-file .env.example \ --restart unless-stopped \ --stop-timeout 30 \ @@ -174,14 +174,14 @@ jobs: TIMEOUT_SECONDS=660 START_TIME=$(date +%s) - while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do + while ! docker logs palworld-server-${{ github.run_id }} 2>&1 | grep -q "Setting breakpad minidump AppID"; do CURRENT_TIME=$(date +%s) ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds." printf "\e[0;32m%s\e[0m\n" "*****Container LOGS*****" - docker logs palworld-server + docker logs palworld-server-${{ github.run_id }} exit 1 fi @@ -192,13 +192,13 @@ jobs: - name: Test if rcon.yaml is valid run: | printf "\e[0;32m%s\e[0m\n" "*****RCON.YAML*****" - docker exec palworld-server cat /home/steam/server/rcon.yaml + docker exec palworld-server-${{ github.run_id }} cat /home/steam/server/rcon.yaml - RCON_PORT=$(docker exec palworld-server env | grep RCON_PORT | cut -d'=' -f2) - ADMIN_PASSWORD=$(docker exec palworld-server env | grep ADMIN_PASSWORD | cut -d'=' -f2) + RCON_PORT=$(docker exec palworld-server-${{ github.run_id }} env | grep RCON_PORT | cut -d'=' -f2) + ADMIN_PASSWORD=$(docker exec palworld-server-${{ github.run_id }} env | grep ADMIN_PASSWORD | cut -d'=' -f2) - YAML_PORT=$(docker exec palworld-server cat /home/steam/server/rcon.yaml | grep "^ address:" | awk '{print $2}' | cut -d ':' -f2 | tr -d '"') - YAML_PASSWORD=$(docker exec palworld-server cat /home/steam/server/rcon.yaml | grep "^ password:" | awk '{print $2}' | tr -d '"') + YAML_PORT=$(docker exec palworld-server-${{ github.run_id }} cat /home/steam/server/rcon.yaml | grep "^ address:" | awk '{print $2}' | cut -d ':' -f2 | tr -d '"') + YAML_PASSWORD=$(docker exec palworld-server-${{ github.run_id }} cat /home/steam/server/rcon.yaml | grep "^ password:" | awk '{print $2}' | tr -d '"') if [ ! $RCON_PORT == $YAML_PORT ]; then echo "Error: $RCON_PORT in .env.example does not match $YAML_PORT in rcon.yaml." @@ -213,18 +213,18 @@ jobs: run: | sleep 100 - if ! docker exec palworld-server rcon-cli Info | grep -q "Welcome to Pal Server"; then + if ! docker exec palworld-server-${{ github.run_id }} rcon-cli Info | grep -q "Welcome to Pal Server"; then echo "Server may not have started successfully." exit 4 fi - OUTPUT=$(docker exec palworld-server rcon-cli "Broadcast test" 2>&1) + OUTPUT=$(docker exec palworld-server-${{ github.run_id }} rcon-cli "Broadcast test" 2>&1) if [[ $OUTPUT != *"Broadcasted: test"* ]]; then echo "Error: Unexpected output - $OUTPUT" exit 5 fi - OUTPUT=$(docker exec palworld-server rcon-cli save 2>&1) + OUTPUT=$(docker exec palworld-server-${{ github.run_id }} rcon-cli save 2>&1) if [[ $OUTPUT != *"Complete Save"* ]]; then echo "Error: Unexpected output - $OUTPUT" exit 6 @@ -238,25 +238,29 @@ jobs: - name: Test the backup script run: | - docker exec palworld-server backup - if [ ! -f ./palworld/backups/palworld-save-*.tar.gz ]; then + docker exec palworld-server-${{ github.run_id }} backup + if [ ! -f ./palworld-${{ github.run_id }}/backups/palworld-save-*.tar.gz ]; then echo "Backup file not found. Backup command may have failed." exit 10 fi - name: Test if PalWorldSettings.ini is valid run: | - if [ ! -f ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then + if [ ! -f ./palworld-${{ github.run_id }}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then echo "Error: PalWorldSettings.ini file is missing." exit 11 fi - if ! grep -q "\[\/Script\/Pal.PalGameWorldSettings\]" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then + if ! grep -q "\[\/Script\/Pal.PalGameWorldSettings\]" ./palworld-${{ github.run_id }}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then echo "Error: PalWorldSettings.ini is missing the required section [/Script/Pal.PalGameWorldSettings]." exit 12 fi - if ! grep -q "^OptionSettings=\(.*\)" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then + if ! grep -q "^OptionSettings=\(.*\)" ./palworld-${{ github.run_id }}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section." exit 13 - fi + + - name: Stop server + run: | + docker stop palworld-server-${{ github.run_id }} + docker rm palworld-server-${{ github.run_id }} From 0e82bc7e4d3907e450e6917bff74e723e842cf4f Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 18 Jun 2024 22:43:58 +0200 Subject: [PATCH 11/13] fix linting error --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a460b41a0..c07f755f2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -259,7 +259,7 @@ jobs: if ! grep -q "^OptionSettings=\(.*\)" ./palworld-${{ github.run_id }}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section." exit 13 - + - name: Stop server run: | docker stop palworld-server-${{ github.run_id }} From bc9a74a4196999af00cf12d7885bb639cc2e7a7b Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Wed, 19 Jun 2024 11:52:17 +0200 Subject: [PATCH 12/13] fix if statement --- .github/workflows/unit-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c07f755f2..4c5de25dc 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -259,6 +259,7 @@ jobs: if ! grep -q "^OptionSettings=\(.*\)" ./palworld-${{ github.run_id }}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section." exit 13 + fi - name: Stop server run: | From 301f1cb857e8a6be4618f2ba196f247e7845ffe6 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Wed, 19 Jun 2024 11:58:34 +0200 Subject: [PATCH 13/13] always cleanup server --- .github/workflows/unit-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 4c5de25dc..a8de3bf3e 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -262,6 +262,7 @@ jobs: fi - name: Stop server + if: always() run: | docker stop palworld-server-${{ github.run_id }} docker rm palworld-server-${{ github.run_id }}