Skip to content

Commit

Permalink
Feature (ci): Add srcds/cs2 support
Browse files Browse the repository at this point in the history
- Bumps the base image in `build/Dockerfile` to `startersclan/steamcmd:git-20231109.0.0`
- The binary is now at `game/bin/linuxsteamrt64/cs2` in `srcds/cs2`
- The`version` cvar is not available in `srcds/cs2` and `status` does not produce anything useful but only appears to do so after the map is fully loaded. Thus a test of the game will be run, but not a test for its version
- The `exit` cvar is not available in `srcds/cs2`, `quit` is now used
  • Loading branch information
joeltimothyoh committed Nov 10, 2023
1 parent 28892d7 commit 7d6061c
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .generate/Generate-GameImageRepositoryReadme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ $gameList = @(
EngineFullName = 'Source'
RegistryNamespace = 'sourceservers'
Game = @(
@{
Name = 'cs2'
FullName = 'Counter-Strike 2'
}
@{
Name = 'csgo'
FullName = 'Counter-Strike: Global Offensive'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ jobs:
strategy:
matrix:
ENGINE: [srcds]
GAME: [csgo, cstrike, dod, hl2mp, left4dead, left4dead2, tf]
GAME: [cs2, csgo, cstrike, dod, hl2mp, left4dead, left4dead2, tf]
include:
- ENGINE: srcds
GAME: cs2
GAME_FULLNAME: 'Counter-Strike 2'
- ENGINE: srcds
GAME: csgo
GAME_FULLNAME: 'Counter-Strike: Global Offensive'
Expand Down
26 changes: 16 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,25 @@ if [ ! "$NO_TEST" = 'true' ]; then
date
time docker run -t --rm "$GAME_IMAGE" 'printenv && ls -al'
date
time docker run -t --rm "$GAME_IMAGE" "$GAME_BIN -game $GAME +version +exit" | tee "$TEST_DIR/test"
if [ "$APPID" = 730 ]; then
time docker run -t --rm "$GAME_IMAGE" "game/bin/linuxsteamrt64/cs2 -dedicated +status +quit"
else
time docker run -t --rm "$GAME_IMAGE" "$GAME_BIN -game $GAME +version +exit" | tee "$TEST_DIR/test"
fi
date

# Verify game version of the game image matches the value of GAME_VERSION
echo 'Verifying game image game version'
GAME_IMAGE_VERSION_LINES=$( cat "$TEST_DIR/test" | grep -iE '\bexe\b|version' | sed 's/[^0-9]//g' )
if ! echo "$GAME_IMAGE_VERSION_LINES" | grep -E "^$GAME_VERSION" > /dev/null; then
echo "Game version does not match GAME_VERSION=$GAME_VERSION"
echo 'GAME_IMAGE_VERSION_LINES:'
echo "$GAME_IMAGE_VERSION_LINES"
exit 1
if [ ! "$APPID" = 730 ]; then
# Verify game version of the game image matches the value of GAME_VERSION
echo 'Verifying game image game version'
GAME_IMAGE_VERSION_LINES=$( cat "$TEST_DIR/test" | grep -iE '\bexe\b|version' | sed 's/[^0-9]//g' )
if ! echo "$GAME_IMAGE_VERSION_LINES" | grep -E "^$GAME_VERSION" > /dev/null; then
echo "Game version does not match GAME_VERSION=$GAME_VERSION"
echo 'GAME_IMAGE_VERSION_LINES:'
echo "$GAME_IMAGE_VERSION_LINES"
exit 1
fi
rm -f "$TEST_DIR/test"
fi
rm -f "$TEST_DIR/test"
fi

# Push the game image
Expand Down
49 changes: 35 additions & 14 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Builds a clean image containing the latest version of the specified game.

FROM startersclan/steamcmd:git-20190605.0.0
FROM startersclan/steamcmd:git-20231109.0.0

ARG SERVER_DIR=/server
ARG APPMANIFEST_AR_URL=https://github.com/startersclan/hlds-appmanifest/archive/refs/tags/v2.0.0.tar.gz
Expand Down Expand Up @@ -75,18 +75,32 @@ RUN --mount=type=secret,id=STEAM_USERNAME \
fi; \
done; \
echo "[BUILD] Performing cleanup"; \
cd "$STEAMCMD_DIR" && rm -rf \
linux64 \
package \
public \
siteserverui \
steam \
linux32/libtier0_s.so \
linux32/libvstdlib_s.so \
linux32/steamclient.so \
linux32/steamconsole.so \
update_hosts_cached.vdf; \
rm -rf /root/.steam; \
if [ "$APPID" = 730 ]; then \
cd "$STEAMCMD_DIR" && rm -rf \
package \
public \
siteserverui \
steamcmd.sh \
steam \
linux32/libtier0_s.so \
linux32/libvstdlib_s.so \
linux32/steamconsole.so \
update_hosts_cached.vdf; \
rm -rf /root/.steam; \
else \
cd "$STEAMCMD_DIR" && rm -rf \
linux64 \
package \
public \
siteserverui \
steam \
linux32/libtier0_s.so \
linux32/libvstdlib_s.so \
linux32/steamclient.so \
linux32/steamconsole.so \
update_hosts_cached.vdf; \
rm -rf /root/.steam; \
fi; \
if [ "$APPID" = 90 ]; then \
# Retain `/root/Steam/appcache` to prevent `steamcmd` from re-downloading `hlds` game entirely on game updates
rm -rf $( find /root/Steam -mindepth 1 -maxdepth 1 | grep -v '^/root/Steam/appcache' ); \
Expand All @@ -98,7 +112,14 @@ RUN --mount=type=secret,id=STEAM_USERNAME \
RUN echo "[BUILD] Applying game fixes"; \
# Create steam_appid.txt containing the game's appid to prevent crashes on first run
echo "[BUILD] CLIENT_APPID: $CLIENT_APPID"; \
echo "$CLIENT_APPID" > "$SERVER_DIR/steam_appid.txt"
echo "$CLIENT_APPID" > "$SERVER_DIR/steam_appid.txt"; \
# Create necessary symlinks for srcds/cs2
if [ "$APPID" = 730 ]; then \
mkdir -p /root/.steam/sdk64; \
mkdir -p /root/.steam/sdk32; \
ln -sfn "/$STEAMCMD_DIR/linux64/steamclient.so" /root/.steam/sdk64/steamclient.so; \
ln -sfn "/$STEAMCMD_DIR/linux32/steamclient.so" /root/.steam/sdk32/steamclient.so; \
fi;

# For directly running the hlds_linux / srcds_linux binary
ENV LD_LIBRARY_PATH .:bin:$LD_LIBRARY_PATH
Expand Down
35 changes: 35 additions & 0 deletions docs/image/readme/srcds-cs2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
| `master` | `build` | `update` |
|:-:|:-:|:-:|
[![pipeline-github-master-badge][]][pipeline-github-master-link] | [![pipeline-travis-build-badge][]][pipeline-travis-build-link] [![pipeline-azurepipelines-build-badge][]][pipeline-azurepipelines-build-link] [![pipeline-circleci-build-badge][]][pipeline-circleci-build-link] [![pipeline-gitlab-build-badge][]][pipeline-gitlab-build-link] | [![pipeline-travis-update-badge][]][pipeline-travis-update-link] [![pipeline-azurepipelines-update-badge][]][pipeline-azurepipelines-update-link] [![pipeline-circleci-update-badge][]][pipeline-circleci-update-link] [![pipeline-gitlab-update-badge][]][pipeline-gitlab-update-link]

[pipeline-github-master-badge]: https://img.shields.io/github/actions/workflow/status/startersclan/docker-sourceservers/ci-master-pr.yml?branch=master&label=&logo=github&style=flat-square
[pipeline-github-master-link]: https://github.com/startersclan/docker-sourceservers/actions?query=branch%3Amaster

[pipeline-travis-build-badge]: https://img.shields.io/travis/com/startersclan/docker-sourceservers/build.svg?label=&logo=travis&style=flat-square
[pipeline-travis-build-link]: https://app.travis-ci.com/startersclan/docker-sourceservers/builds
[pipeline-travis-update-badge]: https://img.shields.io/travis/com/startersclan/docker-sourceservers/update.svg?label=&logo=travis&style=flat-square
[pipeline-travis-update-link]: https://app.travis-ci.com/startersclan/docker-sourceservers/builds

[pipeline-azurepipelines-build-badge]: https://img.shields.io/azure-devops/build/startersclan/docker-sourceservers/2/build.svg?label=&logo=azure-pipelines&style=flat-square
[pipeline-azurepipelines-build-link]: https://dev.azure.com/startersclan/docker-sourceservers/_build?definitionId=2
[pipeline-azurepipelines-update-badge]: https://img.shields.io/azure-devops/build/startersclan/docker-sourceservers/3/update.svg?label=&logo=azure-pipelines&style=flat-square
[pipeline-azurepipelines-update-link]: https://dev.azure.com/startersclan/docker-sourceservers/_build?definitionId=3

[pipeline-circleci-build-badge]: https://img.shields.io/circleci/build/gh/startersclan/docker-sourceservers/build.svg?label=&logo=circleci&style=flat-square
[pipeline-circleci-build-link]: https://app.circleci.com/pipelines/github/startersclan/docker-sourceservers?branch=build
[pipeline-circleci-update-badge]: https://img.shields.io/circleci/build/gh/startersclan/docker-sourceservers/update.svg?label=&logo=circleci&style=flat-square
[pipeline-circleci-update-link]: https://app.circleci.com/pipelines/github/startersclan/docker-sourceservers?branch=update

[pipeline-gitlab-build-badge]: https://img.shields.io/gitlab/pipeline-status/startersclan/docker-sourceservers?branch=build&label=&logo=gitlab&style=flat-square
[pipeline-gitlab-build-link]: https://gitlab.com/startersclan/docker-sourceservers/-/pipelines?page=1&scope=all&ref=build
[pipeline-gitlab-update-badge]: https://img.shields.io/gitlab/pipeline-status/startersclan/docker-sourceservers?branch=update&label=&logo=gitlab&style=flat-square
[pipeline-gitlab-update-link]: https://gitlab.com/startersclan/docker-sourceservers/-/pipelines?page=1&scope=all&ref=update

| Game | Image | Tag `v<tag>` | Size |
|:-:|:-:|:-:|:-:|
| Counter-Strike 2 | [`sourceservers/cs2`][srcds-cs2-dockerhub-link] | [![srcds-cs2-version-badge][]][srcds-cs2-metadata-link] | [![srcds-cs2-size-badge][]][srcds-cs2-metadata-link] | [![srcds-cs2-layers-badge][]][srcds-cs2-metadata-link] |

[srcds-cs2-dockerhub-link]: https://hub.docker.com/r/sourceservers/cs2
[srcds-cs2-version-badge]: https://img.shields.io/docker/v/sourceservers/cs2/latest?label=&style=flat-square
[srcds-cs2-size-badge]: https://img.shields.io/docker/image-size/sourceservers/cs2/latest?label=&style=flat-square
[srcds-cs2-metadata-link]: https://hub.docker.com/r/sourceservers/cs2/tags
131 changes: 131 additions & 0 deletions test/srcds-cs2
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
eLoaded /server/game/bin/linuxsteamrt64/libengine2.so, got 0x56036ca6f2b0

Console initialized.
Steam AppId(730), BreakpadId(2347771)
InitSteamLogin_Internal: Initializing breakpad.
Using breakpad crash handler
Steam Universe is invalid, possibly asking before Steam was successfully initialized.
ResetBreakpadAppId: Universe is 0 (k_EUniverseInvalid)
ResetBreakpadAppId: Setting dedicated server app id: 2347773
Setting breakpad minidump AppID = 2347773
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Loaded libSDL3.so.0, got 0x56036cb6d8a0
Loaded /server/game/bin/linuxsteamrt64/libtier0.so, got 0x56036ca58f80
Visibility enabled.
Loaded /server/game/bin/linuxsteamrt64/libfilesystem_stdio.so, got 0x56036cb6dd60
USRLOCAL path not found!
Loaded /server/game/bin/linuxsteamrt64/liblocalize.so, got 0x56036cb80270
Loaded /server/game/bin/linuxsteamrt64/librendersystemempty.so, got 0x56036cb92360
Loaded /server/game/bin/linuxsteamrt64/libresourcesystem.so, got 0x56036cba4870
Loaded /server/game/bin/linuxsteamrt64/libschemasystem.so, got 0x56036cbb6d80
Trying to set dxlevel (111) which is higher than the card can support (110)!
Loaded /server/game/bin/linuxsteamrt64/libmaterialsystem2.so, got 0x56036cbc8e70
---------------
Path ID: File Path:
ADDONS "/server/game/csgo_addons/"
CONTENT "/server/content/csgo/"
CONTENT "/server/content/csgo_imported/"
CONTENT "/server/content/csgo_core/"
CONTENT "/server/content/core/"
CONTENTADDONS "/server/content/csgo_addons/"
CONTENTROOT "/server/content/"
DEFAULT_WRITE_PATH "/server/game/csgo/pak01.vpk" (vpk) /server/game/csgo/pak01.vpk
DEFAULT_WRITE_PATH "/server/game/csgo/"
EXECUTABLE_PATH "/server/game/bin/linuxsteamrt64/"
GAME "/server/game/csgo/pak01.vpk" (vpk) /server/game/csgo/pak01.vpk
GAME "/server/game/csgo_imported/pak01.vpk" (vpk) /server/game/csgo_imported/pak01.vpk
GAME "/server/game/csgo_core/pak01.vpk" (vpk) /server/game/csgo_core/pak01.vpk
GAME "/server/game/core/pak01.vpk" (vpk) /server/game/core/pak01.vpk
GAME "/server/game/csgo/"
GAME "/server/game/csgo_imported/"
GAME "/server/game/csgo_core/"
GAME "/server/game/core/"
GAMEBIN "/server/game/csgo/bin/linuxsteamrt64/"
GAMEBIN "/server/game/csgo/bin/"
GAMEBIN "/server/game/csgo_imported/bin/linuxsteamrt64/"
GAMEBIN "/server/game/csgo_imported/bin/"
GAMEBIN "/server/game/csgo_core/bin/linuxsteamrt64/"
GAMEBIN "/server/game/csgo_core/bin/"
GAMEBIN "/server/game/core/bin/linuxsteamrt64/"
GAMEBIN "/server/game/core/bin/"
GAMEROOT "/server/game/"
MOD "/server/game/csgo/pak01.vpk" (vpk) /server/game/csgo/pak01.vpk
MOD "/server/game/csgo_imported/pak01.vpk" (vpk) /server/game/csgo_imported/pak01.vpk
MOD "/server/game/csgo_core/pak01.vpk" (vpk) /server/game/csgo_core/pak01.vpk
MOD "/server/game/csgo/"
MOD "/server/game/csgo_imported/"
MOD "/server/game/csgo_core/"
PLATFORM "/server/game/core/pak01.vpk" (vpk) /server/game/core/pak01.vpk
PLATFORM "/server/game/core/"
SHADER_SOURCE "/server/src/shaders/csgo/"
SHADER_SOURCE "/server/src/shaders/csgo_imported/"
SHADER_SOURCE "/server/src/shaders/csgo_core/"
SHADER_SOURCE "/server/src/shaders/core/"
SHADER_SOURCE_MOD "/server/src/shaders/csgo/"
SHADER_SOURCE_ROOT "/server/src/shaders/"
command line arguments:
-dedicated +status +quit
Loaded /server/game/bin/linuxsteamrt64/libmeshsystem.so, got 0x56036cbdb7a0
Loaded /server/game/bin/linuxsteamrt64/libworldrenderer.so, got 0x56036cbed890
Loaded /server/game/bin/linuxsteamrt64/libpulse_system.so, got 0x56036cc001c0
Loaded /server/game/bin/linuxsteamrt64/libvscript.so, got 0x56036cc14b90
Loaded /server/game/bin/linuxsteamrt64/libnetworksystem.so, got 0x56036cc26c80
Loaded /server/game/bin/linuxsteamrt64/libanimationsystem.so, got 0x56036cc3ae70
Loaded /server/game/bin/linuxsteamrt64/libvphysics2.so, got 0x56036cc51160
Loaded /server/game/bin/linuxsteamrt64/libsoundsystem.so, got 0x56036cc63eb0
Loaded /server/game/bin/linuxsteamrt64/libscenesystem.so, got 0x56036cc7a1a0
Loaded /server/game/bin/linuxsteamrt64/libv8system.so, got 0x56036cc8f830
Network System Initialized
Loaded /server/game/bin/linuxsteamrt64/libserver_valve.so, got (nil)
failed to dlopen /server/game/bin/linuxsteamrt64/libserver_valve.so error=/server/game/bin/linuxsteamrt64/libserver_valve.so: cannot open shared object file: No such file or directory
failed to dlopen "/server/game/bin/linuxsteamrt64/libserver_valve.so" error=/server/game/bin/linuxsteamrt64/libserver_valve.so: cannot open shared object file: No such file or directory
Loaded libserver_valve.so, got (nil)
failed to dlopen libserver_valve.so error=libserver_valve.so: cannot open shared object file: No such file or directory
failed to dlopen "libserver_valve.so" error=libserver_valve.so: cannot open shared object file: No such file or directory
Loaded /server/game/csgo/bin/linuxsteamrt64/libserver.so, got 0x56036cca9630
Physics Console Communications is not initialized
Loaded /server/game/bin/linuxsteamrt64/libengine2.so, got 0x56036ca6f2b0
Loaded /server/game/csgo/bin/linuxsteamrt64/libhost.so, got 0x56036ccd9de0
Loaded /server/game/bin/linuxsteamrt64/libscenefilecache.so, got 0x56036cced370
Loaded /server/game/bin/linuxsteamrt64/libparticles.so, got 0x56036ccff460
Loaded /server/game/csgo/bin/linuxsteamrt64/libmatchmaking.so, got 0x56036cd12e10
No .vcds loaded or no scenes/scenes.vrman
GameTypes: missing mapgroupsSP entry for game type/mode (custom/custom).
GameTypes: missing mapgroupsSP entry for game type/mode (cooperative/cooperative).
GameTypes: missing mapgroupsSP entry for game type/mode (cooperative/coopmission).
Event System loaded 93 events from file: vpk:/server/game/core/pak01.vpk:resource/core.gameevents.
Event System loaded 50 events from file: vpk:/server/game/csgo/pak01.vpk:resource/game.gameevents.
Event System loaded 152 events from file: vpk:/server/game/csgo/pak01.vpk:./resource/mod.gameevents.
CEntitySystem::BuildEntityNetworking (parallel build of server) took 15.034 msecs for 218 out of 297 classes
[STARTUP] {0.828} server module init ok
CHostStateMgr::QueueNewRequest( Idle (console), 1 )
Source2Init OK
HostStateRequest::Start(HSR_IDLE): loop(console) id(1) addons() desc(Idle (console))
SwitchToLoop console requested: id [1] addons []
Host activate: Idle (console)
Server: Inactive
Client: Disconnected
----- Status -----
@ Current : console
CHostStateMgr::QueueNewRequest( Quitting, 2 )
HostStateRequest::Start(HSR_QUIT)
Host activate: Quitting
Dispatching EventAppShutdown_t {
Requested non-existent write path USRLOCAL!
Requested non-existent write path USRLOCAL!
Error writing user config file 'cfg/cs2_user_keys_0_slot0.vcfg'
Requested non-existent write path USRLOCAL!
Requested non-existent write path USRLOCAL!
Error writing user config file 'cfg/cs2_user_convars_0_slot0.vcfg'
} Dispatched EventAppShutdown_t
Requested non-existent write path USRLOCAL!
MainLoop returning
Source2Shutdown
ShutdownSource2Logging
CNetworkSystem::Shutdown()
CNetworkSystem::CloseAllSockets()
Forgot to remove resource type manager for type vpost!
Forgot to remove resource type manager for type vpcf!
Forgot to remove resource type manager for type vsnap!
38 changes: 26 additions & 12 deletions update/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,32 @@ RUN --mount=type=secret,id=STEAM_USERNAME \
i=$(( i+1 )); \
done; \
echo "[UPDATE] Performing cleanup"; \
cd "$STEAMCMD_DIR" && rm -rf \
linux64 \
package \
public \
siteserverui \
steam \
linux32/libtier0_s.so \
linux32/libvstdlib_s.so \
linux32/steamclient.so \
linux32/steamconsole.so \
update_hosts_cached.vdf; \
rm -rf /root/.steam; \
if [ "$APPID" = 730 ]; then \
cd "$STEAMCMD_DIR" && rm -rf \
package \
public \
siteserverui \
steamcmd.sh \
steam \
linux32/libtier0_s.so \
linux32/libvstdlib_s.so \
linux32/steamconsole.so \
update_hosts_cached.vdf; \
rm -rf /root/.steam; \
else \
cd "$STEAMCMD_DIR" && rm -rf \
linux64 \
package \
public \
siteserverui \
steam \
linux32/libtier0_s.so \
linux32/libvstdlib_s.so \
linux32/steamclient.so \
linux32/steamconsole.so \
update_hosts_cached.vdf; \
rm -rf /root/.steam; \
fi; \
if [ "$APPID" = 90 ]; then \
# Retain `/root/Steam/appcache` to prevent `steamcmd` from re-downloading `hlds` game entirely on game updates
rm -rf $( find /root/Steam -mindepth 1 -maxdepth 1 | grep -v '^/root/Steam/appcache' ); \
Expand Down

0 comments on commit 7d6061c

Please sign in to comment.