From a964f82e630cf42ab04f00e46f5d8f024308e8f7 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 17 Nov 2023 03:31:30 +0000 Subject: [PATCH] Enhancement (ci): Add support for `INSTALL_COUNT` (#167) Co-authored-by: leo --- build.sh | 6 ++++++ test/build-hlds-cstrike.env | 1 + test/build-srcds-hl2mp.env | 1 + test/update-hlds-cstrike.env | 1 + test/update-srcds-hl2mp.env | 1 + update/Dockerfile | 3 +++ 6 files changed, 13 insertions(+) diff --git a/build.sh b/build.sh index 10fb8241..e550f410 100755 --- a/build.sh +++ b/build.sh @@ -28,6 +28,8 @@ usage() { echo " FIX_APPMANIFEST Whether to apply appmanifest fixes on builds. Applies only to PIPELINE=build and APPID=90" echo " Type: bool, optional" echo " Possible values: 'true', 'false'" + echo " INSTALL_COUNT Number of install attempts" + echo " Type: int, optional" echo " LATEST Whether to tag the successfully built game image with the :latest tag. Applies only to PIPELINE=build" echo " Type: bool, optional" echo " Possible values: 'true', 'false'" @@ -118,6 +120,7 @@ if [ "$PIPELINE" = 'build' ]; then GAME=${GAME:?err} MOD=${MOD:-} FIX_APPMANIFEST=${FIX_APPMANIFEST:-} + INSTALL_COUNT=${INSTALL_COUNT:-} LATEST=${LATEST:-} CACHE=${CACHE:-} NO_TEST=${NO_TEST:-} @@ -128,6 +131,7 @@ elif [ "$PIPELINE" = 'update' ]; then APPID=${APPID:?err} GAME=${GAME:?err} GAME_UPDATE_COUNT=${GAME_UPDATE_COUNT:?err} + INSTALL_COUNT=${INSTALL_COUNT:-} NO_PULL=${NO_PULL:-} NO_TEST=${NO_TEST:-} NO_PUSH=${NO_PUSH:-} @@ -218,6 +222,7 @@ if [ "$PIPELINE" = 'build' ]; then --build-arg MOD="$MOD" \ --build-arg FIX_APPMANIFEST="$FIX_APPMANIFEST" \ --build-arg CLIENT_APPID="$CLIENT_APPID" \ + --build-arg INSTALL_COUNT="$INSTALL_COUNT" \ --build-arg STEAM_LOGIN="$STEAM_LOGIN" \ --build-arg CACHE_KEY="$GAME_VERSION" \ -t "$GAME_IMAGE" \ @@ -247,6 +252,7 @@ elif [ "$PIPELINE" = 'update' ]; then --secret id=STEAM_USERNAME,env=STEAM_USERNAME \ --secret id=STEAM_PASSWORD,env=STEAM_PASSWORD \ --build-arg GAME_IMAGE="$GAME_IMAGE_LATEST" \ + --build-arg INSTALL_COUNT="$INSTALL_COUNT" \ --build-arg STEAM_LOGIN="$STEAM_LOGIN" \ --build-arg CACHE_KEY="$GAME_VERSION" \ -t "$GAME_IMAGE" \ diff --git a/test/build-hlds-cstrike.env b/test/build-hlds-cstrike.env index 9f1cb2a2..9a35b1ce 100644 --- a/test/build-hlds-cstrike.env +++ b/test/build-hlds-cstrike.env @@ -10,6 +10,7 @@ CLIENT_APPID=10 GAME=cstrike MOD=cstrike FIX_APPMANIFEST=true +INSTALL_COUNT= LATEST=true CACHE= NO_TEST= diff --git a/test/build-srcds-hl2mp.env b/test/build-srcds-hl2mp.env index ae14b8de..bb6a9bbc 100644 --- a/test/build-srcds-hl2mp.env +++ b/test/build-srcds-hl2mp.env @@ -10,6 +10,7 @@ CLIENT_APPID=320 GAME=hl2mp MOD= FIX_APPMANIFEST= +INSTALL_COUNT= LATEST=true CACHE= NO_TEST= diff --git a/test/update-hlds-cstrike.env b/test/update-hlds-cstrike.env index 6df571de..b3b73400 100644 --- a/test/update-hlds-cstrike.env +++ b/test/update-hlds-cstrike.env @@ -8,6 +8,7 @@ GAME_VERSION=1127 APPID=90 GAME=cstrike GAME_UPDATE_COUNT=1 +INSTALL_COUNT= NO_PULL=true NO_TEST= NO_PUSH=true diff --git a/test/update-srcds-hl2mp.env b/test/update-srcds-hl2mp.env index 47ebd6e5..eabb52c9 100644 --- a/test/update-srcds-hl2mp.env +++ b/test/update-srcds-hl2mp.env @@ -8,6 +8,7 @@ GAME_VERSION=6630498 APPID=232370 GAME=hl2mp GAME_UPDATE_COUNT=1 +INSTALL_COUNT= NO_PULL=true NO_TEST= NO_PUSH=true diff --git a/update/Dockerfile b/update/Dockerfile index 99c65e4a..44707d2e 100644 --- a/update/Dockerfile +++ b/update/Dockerfile @@ -14,6 +14,9 @@ RUN --mount=type=secret,id=STEAM_USERNAME \ --mount=type=secret,id=STEAM_PASSWORD \ STEAM_USERNAME=$( cat /run/secrets/STEAM_USERNAME ); \ STEAM_PASSWORD=$( cat /run/secrets/STEAM_PASSWORD ); \ + if [ -z "$INSTALL_COUNT" ]; then \ + INSTALL_COUNT=1; \ + fi; \ echo "[UPDATE] SERVER_DIR: $SERVER_DIR"; \ echo "[UPDATE] APPID: $APPID"; \ echo "[UPDATE] MOD: $MOD"; \