Просмотр исходного кода

fix: support legacy game servers on older Ubuntu/Debian runners (#4903)

* fix(workflows): support legacy game servers on older Ubuntu/Debian runners

Multiple game servers have glibc compatibility requirements that prevent
them from running on Ubuntu 24.04:

- bfv, bf1942: Require Ubuntu <= 22.04 or Debian <= 12 (glibc 2.31)
- btl, onset: Require Ubuntu <= 20.04 or Debian <= 11 (glibc 2.31)

Changes:
- Add runner field to details-check matrix generation
- Map legacy servers to appropriate ubuntu-XX.04 LTS runners
- Modern servers continue on ubuntu-latest (24.04)
- Update details-check.yml to use dynamic runner from matrix

This ensures all server tests pass in CI without breaking modern server
testing on current GitHub Actions runners.

* fix(workflows): run details-check on PRs and normalize ref resolution

Details Check was not running for PR #4903 because the workflow only
triggered on push to develop/workflow_dispatch. Also, pull_request refs
(refs/pull/*) are not valid raw-content refs for GitHub downloads.

Changes:
- Trigger Details Check on pull_request to develop
- Add LGSM_REF env resolved to PR head SHA or branch ref name
- Use LGSM_REF for linuxgsm.sh download and LGSM_GITHUBBRANCH usage
- Use LGSM_REF in matrix generation when fetching serverlist.csv

This ensures legacy server jobs (bfv, bf1942, btl, onset) are included
and executed during PR validation.

* fix(workflows): run update-check on PRs and normalize ref resolution

Apply the same PR-safe workflow behavior used in details-check:
- Trigger update-check on pull_request to develop
- Resolve LGSM_REF to PR head SHA or branch ref name
- Use LGSM_REF for linuxgsm.sh download and LGSM_GITHUBBRANCH calls

This ensures update-check validates PR changes instead of only running on
develop pushes.

* fix(check_deps): avoid false Debian version check on Ubuntu

Ubuntu reports ID_LIKE=debian, which caused Debian upper-version checks to
run on Ubuntu and incorrectly fail legacy titles on Ubuntu 22.04.x.

Use distroid==debian for Debian limits in legacy compatibility guards so:
- bf1942/bfv pass on Ubuntu 22.04.x as intended
- btl/onset limits still apply correctly
- Debian limits still apply on Debian only

* fix(workflows): add PR trigger to version-check; replace archived action in docker trigger

version-check.yml:
- Add pull_request trigger targeting develop so version format is
  validated on PRs before merge

trigger-docker-build.yml:
- Replace archived convictional/trigger-workflow-and-wait@v1.6.5 with
  native gh CLI approach (trigger + watch run ID)
- Uses GH_TOKEN env var with PERSONAL_ACCESS_TOKEN secret
- gh workflow run dispatches the workflow; gh run watch polls for
  completion and exits non-zero on failure, preserving job dependencies

* fix(workflows): use timestamp filter to reliably identify triggered run ID

Using --limit 1 to find the run ID is a race condition if another run
of the same workflow starts concurrently. Capture a timestamp before
dispatching and pass --created >=${before} to gh run list so we
always select the run we just triggered.

* remove pr check
Daniel Gibbs 1 месяц назад
Родитель
Сommit
2b16232396

+ 18 - 1
.github/workflows/details-check-generate-matrix.sh

@@ -1,6 +1,7 @@
 #!/bin/bash
 
-curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
+ref="${LGSM_REF:-${GITHUB_REF#refs/heads/}}"
+curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${ref}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
 
 echo -n "{" > "shortnamearray.json"
 echo -n "\"include\":[" >> "shortnamearray.json"
@@ -14,10 +15,26 @@ while read -r line; do
 	export gamename
 	distro=$(echo "$line" | awk -F, '{ print $4 }')
 	export distro
+	# Legacy servers that require older Ubuntu/Debian versions due to glibc compatibility
+	case "${shortname}" in
+		bfv|bf1942)
+			# Requires Ubuntu <= 22.04 or Debian <= 12 (glibc 2.31 compatible)
+			runner="ubuntu-22.04"
+			;;
+		btl|onset)
+			# Requires Ubuntu <= 20.04 or Debian <= 11 (glibc 2.31 compatible)
+			runner="ubuntu-20.04"
+			;;
+		*)
+			runner="ubuntu-latest"
+			;;
+	esac
 	{
 		echo -n "{";
 		echo -n "\"shortname\":";
 		echo -n "\"${shortname}\"";
+		echo -n ",\"runner\":";
+		echo -n "\"${runner}\"";
 		echo -n "},";
 	} >> "shortnamearray.json"
 done < <(tail -n +2 serverlist.csv)

+ 12 - 8
.github/workflows/details-check.yml

@@ -17,6 +17,8 @@ jobs:
   create-matrix:
     if: github.repository_owner == 'GameServerManagers'
     runs-on: ubuntu-latest
+    env:
+      LGSM_REF: ${{ github.event.pull_request.head.sha || github.ref_name }}
     outputs:
       matrix: ${{ steps.set-matrix.outputs.matrix }}
     steps:
@@ -37,14 +39,16 @@ jobs:
     if: github.repository_owner == 'GameServerManagers'
     needs: create-matrix
     continue-on-error: true
-    runs-on: ubuntu-latest
+    runs-on: ${{ matrix.runner }}
+    env:
+      LGSM_REF: ${{ github.event.pull_request.head.sha || github.ref_name }}
 
     strategy:
       matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
 
     steps:
       - name: Download linuxgsm.sh
-        run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh"; chmod +x linuxgsm.sh
+        run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_REF}/linuxgsm.sh"; chmod +x linuxgsm.sh
 
       - name: Install dependencies
         run: sudo apt-get install libxml2-utils jq
@@ -53,10 +57,10 @@ jobs:
         run: mkdir -p serverfiles
 
       - name: Grab server
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./linuxgsm.sh ${{ matrix.shortname }}server
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./linuxgsm.sh ${{ matrix.shortname }}server
 
       - name: Enable developer mode
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server developer
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server developer
 
       - name: Generate servercfgname
         id: sets-servercfgname
@@ -73,7 +77,7 @@ jobs:
           fi
 
       - name: Pre-load LinuxGSM
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server details
 
       - name: Display config
         run: |
@@ -87,10 +91,10 @@ jobs:
         run: grep "startparameters" lgsm/config-default/config-lgsm/${{ matrix.shortname }}server/_default.cfg
 
       - name: Details
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server details
 
       - name: Detect details
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server parse-game-details
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server parse-game-details
 
       - name: Query Raw
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server query-raw
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server query-raw

+ 32 - 12
.github/workflows/trigger-docker-build.yml

@@ -15,12 +15,22 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Trigger Workflow and Wait (linuxgsm)
-        uses: convictional/trigger-workflow-and-wait@v1.6.5
-        with:
-          owner: GameServerManagers
-          repo: docker-linuxgsm
-          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
-          workflow_file_name: action-docker-publish.yml
+        env:
+          GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+        run: |
+          before=$(date -u +%Y-%m-%dT%H:%M:%SZ)
+          gh workflow run action-docker-publish.yml --repo GameServerManagers/docker-linuxgsm
+          sleep 10
+          run_id=$(gh run list \
+            --workflow action-docker-publish.yml \
+            --repo GameServerManagers/docker-linuxgsm \
+            --created ">=${before}" \
+            --limit 1 \
+            --json databaseId \
+            --jq '.[0].databaseId')
+          gh run watch "${run_id}" \
+            --repo GameServerManagers/docker-linuxgsm \
+            --exit-status
 
   trigger_build_docker-gameserver:
     if: github.repository_owner == 'GameServerManagers'
@@ -29,9 +39,19 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Trigger Workflow and Wait (gameserver)
-        uses: convictional/trigger-workflow-and-wait@v1.6.5
-        with:
-          owner: GameServerManagers
-          repo: docker-gameserver
-          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
-          workflow_file_name: action-docker-publish.yml
+        env:
+          GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+        run: |
+          before=$(date -u +%Y-%m-%dT%H:%M:%SZ)
+          gh workflow run action-docker-publish.yml --repo GameServerManagers/docker-gameserver
+          sleep 10
+          run_id=$(gh run list \
+            --workflow action-docker-publish.yml \
+            --repo GameServerManagers/docker-gameserver \
+            --created ">=${before}" \
+            --limit 1 \
+            --json databaseId \
+            --jq '.[0].databaseId')
+          gh run watch "${run_id}" \
+            --repo GameServerManagers/docker-gameserver \
+            --exit-status

+ 9 - 7
.github/workflows/update-check.yml

@@ -16,6 +16,8 @@ jobs:
   update-check:
     if: github.repository_owner == 'GameServerManagers'
     runs-on: ubuntu-latest
+    env:
+      LGSM_REF: ${{ github.event.pull_request.head.sha || github.ref_name }}
 
     strategy:
       fail-fast: false
@@ -24,30 +26,30 @@ jobs:
 
     steps:
       - name: Download linuxgsm.sh
-        run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh"; chmod +x linuxgsm.sh
+        run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_REF}/linuxgsm.sh"; chmod +x linuxgsm.sh
 
       - name: Install dependencies
         run: sudo dpkg --add-architecture i386; sudo apt-get update;
 
       - name: Grab server
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./linuxgsm.sh ${{ matrix.shortname }}server
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./linuxgsm.sh ${{ matrix.shortname }}server
 
       - name: Enable developer mode
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server developer
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server developer
 
       - name: Insert steamuser
         if: matrix.shortname == 'jk2'
         run: echo -e "steamuser=\"${{ secrets.STEAMCMD_USER }}\"\nsteampass='${{ secrets.STEAMCMD_PASS }}'" > lgsm/config-lgsm/${{ matrix.shortname }}server/common.cfg
 
       - name: Install server
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server auto-install
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server auto-install
 
       - name: Check Update server
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server check-update
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server check-update
 
       - name: Update server
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server update
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server update
 
       - name: Force Update server
         if: matrix.shortname == 'css'
-        run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server force-update
+        run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server force-update

+ 3 - 3
lgsm/modules/check_deps.sh

@@ -362,7 +362,7 @@ if [ -n "${distrosupport}" ]; then
 fi
 
 # These titles are only supported up to Ubuntu 22.04 (Jammy) and Debian 12 (Bookworm).
-if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}" "gt" "22.04"; } || { [ "${distroidlike}" == "debian" ] && dpkg --compare-versions "${distroversion}" "gt" "12"; }; then
+if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}" "gt" "22.04"; } || { [ "${distroid}" == "debian" ] && dpkg --compare-versions "${distroversion}" "gt" "12"; }; then
 	if [ "${shortname}" == "bf1942" ] || [ "${shortname}" == "bfv" ]; then
 		fn_print_failure_nl "${gamename} is not supported on ${distroname} (requires Ubuntu <= 22.04 or Debian <= 12)."
 		fn_script_log_fail "${gamename} is not supported on ${distroname}."
@@ -370,8 +370,8 @@ if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}"
 	fi
 fi
 
-# These titles are only supported up to Ubuntu 20.04 and Debian 11 (and Debian-like derivatives).
-if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}" "gt" "20.04"; } || { [ "${distroidlike}" == "debian" ] && dpkg --compare-versions "${distroversion}" "gt" "11"; }; then
+# These titles are only supported up to Ubuntu 20.04 and Debian 11.
+if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}" "gt" "20.04"; } || { [ "${distroid}" == "debian" ] && dpkg --compare-versions "${distroversion}" "gt" "11"; }; then
 	if [ "${shortname}" == "onset" ] || [ "${shortname}" == "btl" ]; then
 		fn_print_failure_nl "${gamename} is not supported on ${distroname} (requires Ubuntu <= 20.04 or Debian <= 11)."
 		fn_script_log_fail "${gamename} is not supported on ${distroname}."