Skip to content

Commit

Permalink
Enhancement (ci): Add support for INSTALL_COUNT
Browse files Browse the repository at this point in the history
  • Loading branch information
joeltimothyoh committed Nov 17, 2023
1 parent 820b036 commit 757748b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
Expand Down Expand Up @@ -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:-}
Expand All @@ -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:-}
Expand Down Expand Up @@ -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" \
Expand Down Expand Up @@ -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" \
Expand Down
1 change: 1 addition & 0 deletions test/build-hlds-cstrike.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CLIENT_APPID=10
GAME=cstrike
MOD=cstrike
FIX_APPMANIFEST=true
INSTALL_COUNT=
LATEST=true
CACHE=
NO_TEST=
Expand Down
1 change: 1 addition & 0 deletions test/build-srcds-hl2mp.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CLIENT_APPID=320
GAME=hl2mp
MOD=
FIX_APPMANIFEST=
INSTALL_COUNT=
LATEST=true
CACHE=
NO_TEST=
Expand Down
1 change: 1 addition & 0 deletions test/update-hlds-cstrike.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/update-srcds-hl2mp.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions update/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down

0 comments on commit 757748b

Please sign in to comment.