Feature/autobuild branch specific (#5)

docker ci will create tag depending on source branch
This commit is contained in:
jusito 2020-09-27 21:32:03 +02:00 committed by GitHub
parent 0415e30719
commit f516b8df91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 20 deletions

View File

@ -1,4 +1,6 @@
FROM jusito/docker-ttt:gmod_debian
ARG SUFFIX=""
FROM jusito/docker-ttt:gmod_debian${SUFFIX}
ENV SERVER_GAMEMODE="terrortown"

View File

@ -1,4 +1,6 @@
FROM jusito/docker-ttt:lgsm_debian
ARG SUFFIX=""
FROM jusito/docker-ttt:lgsm_debian${SUFFIX}
# Const \\ Overwrite Env \\ Configs optional
ENV CSS_PATH="/home/steam/addons/css" \

View File

@ -12,14 +12,15 @@ CFG_PATH="${SERVER_PATH}/garrysmod/cfg/gmodserver.cfg"
function configReplace() {
source="$1"
target="$2"
target="\"$(echo "$target" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')\""
count=$(grep -Poc "($source).+" "${CFG_PATH}")
echo "[initConfig.sh]Request for replacing $source to $target, source is found $count times"
if [ "$count" == "1" ]; then
sed -Ei "s/${source}.*/${source} ${target}/g" "${CFG_PATH}"
sed -Ei "/${source}.*/d" "${CFG_PATH}"
echo "$target" >> "${CFG_PATH}"
elif [ "$count" == "0" ]; then
echo "" >> "${CFG_PATH}"

View File

@ -1,17 +1,19 @@
#!/bin/sh
#set -o errexit
set -o errexit
#set -o pipefail
#set -o nounset
set -o nounset
#docker build -t "$DOCKER_REPO:lgsm_debian" "lgsm/"
imageSuffix=""
if [ "$SOURCE_BRANCH" != "master" ]; then
imageSuffix="-$(echo "$SOURCE_BRANCH" | sed 's/\//-/g')"
fi
#docker build -t "$DOCKER_REPO:lgsm_debian${imageSuffix}" "lgsm/"
cd ..
docker build -t "$DOCKER_REPO:gmod_debian" "gmod/"
docker build -t "$DOCKER_REPO:gmod_ttt_debian" "TTT/"
docker tag "$DOCKER_REPO:gmod_ttt_debian" "$DOCKER_REPO:latest"
docker push "$DOCKER_REPO:gmod_debian"
docker push "$DOCKER_REPO:gmod_ttt_debian"
docker push "$DOCKER_REPO:latest"
bash test/testBuild.sh "$imageSuffix" true
docker push "$DOCKER_REPO:gmod_debian${imageSuffix}"
docker push "$DOCKER_REPO:gmod_ttt_debian${imageSuffix}"
docker push "$DOCKER_REPO:latest${imageSuffix}"

View File

@ -1,5 +1,8 @@
#!/bin/bash
readonly SUFFIX="$1"
readonly SKIP_LGSM="$2"
if [ "${DEBUGGING}" = "true" ]; then
set -o xtrace
else
@ -12,11 +15,16 @@ set -o pipefail
echo "[testBuild][INFO]build"
docker rmi "jusito/docker-ttt:lgsm_debian" || true
docker build --no-cache -t "jusito/docker-ttt:lgsm_debian" "lgsm/"
if [ "$SKIP_LGSM" = true ]; then
docker rmi "jusito/docker-ttt:lgsm_debian${SUFFIX}" || true
docker build --no-cache -t "jusito/docker-ttt:lgsm_debian${SUFFIX}" "lgsm/"
fi
docker rmi "jusito/docker-ttt:gmod_debian" || true
docker build --no-cache -t "jusito/docker-ttt:gmod_debian" "gmod/"
docker rmi "jusito/docker-ttt:gmod_debian${SUFFIX}" || true
docker build --no-cache -t "jusito/docker-ttt:gmod_debian${SUFFIX}" "gmod/"
docker rmi "jusito/docker-ttt:gmod_ttt_debian" || true
docker build --no-cache -t "jusito/docker-ttt:gmod_ttt_debian" "TTT/"
docker rmi "jusito/docker-ttt:gmod_ttt_debian${SUFFIX}" || true
docker build --no-cache -t "jusito/docker-ttt:gmod_ttt_debian${SUFFIX}" "TTT/"
docker rmi "$DOCKER_REPO:latest${SUFFIX}" || true
docker tag "$DOCKER_REPO:gmod_ttt_debian${SUFFIX}" "$DOCKER_REPO:latest${SUFFIX}"