khanat-server-docker-NeL/.gitlab-ci.yml

111 lines
6.4 KiB
YAML
Raw Normal View History

2018-04-05 20:21:35 +00:00
# Configuration for Continous Integration
#
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Example to execute locally:
# gitlab-runner exec docker --kubernetes-memory-limit="10g" --kubernetes-service-memory-limit="10g" --kubernetes-memory-request="10g" --kubernetes-helper-memory-limit="10g" 'Linux server build'
# gitlab-runner exec docker --timeout=3600 'Linux server build'
stages:
- build
Linux server build:
stage: build
tags:
- Docker
image: amd64/debian:9
script:
- export -p WORKDIR=$PWD
- apt-get update
- apt-get dist-upgrade -y
- apt-get install -y bash-completion bsd-mailx cron curl debootstrap fakechroot fakeroot git jq less logrotate lzma nano net-tools openssh-server p7zip p7zip-full schroot sudo unzip vim wget xdelta
# - apt-get install -y libcurl4-openssl libfreetype6 libx11 libgl1-mesa libxxf86vm libxrandr libxrender libopenal libxml2 libpng libjpeg62-turbo libxmu libgif libssl liblzma zlib1g libssh2-1 libboost-all libopenal libgl1-mesa libtool libxml2
- apt-get install -y libxml2 libpng16-16 libjpeg62-turbo libxmu6 libgif7 libssl1.1 liblzma5 zlib1g libssh2-1 libtool libxml2
- DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server
- apt-get install -y apache2 apache2-utils libapache2-mod-php mcrypt php php-gd php-imagick php-mcrypt php-mysql python3 rrdtool screen
- DEBIAN_FRONTEND=noninteractive apt-get install -y phpmyadmin
- mkdir -p /opt/download
- export -p DIR_ARTEFACTS="/opt/download"
- (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/khanat-opennel-code' $CI_COMMIT_REF_NAME 'develop' 'master')
- (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/opennel-pymanager' $CI_COMMIT_REF_NAME 'develop' 'master')
2018-04-19 14:28:03 +00:00
- ls -l /opt/download
2018-06-28 09:32:39 +00:00
- mkdir -p /opt/artefacts
- (cd /opt/artefacts ; for file in /opt/download/khanat-server-debian_strech*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- (cd /opt/artefacts ; for file in /opt/download/khanat-client_static-debian_amd64_strech*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- (cd /opt/artefacts ; for file in /opt/download/khanat-*pymanager*.zip ; do echo "extract $file"; unzip -q -o $file; done)
2018-04-05 20:21:35 +00:00
- mkdir -p /opt/ext
- cp $WORKDIR/server/debian/common/servercontainer_init_* /opt/
- cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/
2018-04-06 20:17:22 +00:00
- cp $WORKDIR/server/debian/common/* /opt/ext
2018-04-05 20:21:35 +00:00
- cp $WORKDIR/server/debian/common/khaganat.cfg /opt/ext
- mkdir -p /opt/rootweb
- cp $WORKDIR/server/common/rootweb/* /opt/rootweb/
- echo -e 'export KHANAT_CLIENT_VERSION="1"\nexport UIDGAMESERVER=1000\nexport GIDGAMESERVER=1000\nexport DIRCLIENT="Khanat_Linux64"\nexport PACKAGECLIENT="smokey_linux64"' > /opt/khanat_config.sh
2018-04-05 20:21:35 +00:00
- mkdir -p /var/run/mysqld
- /opt/servercontainer_init_create_account.sh
2018-04-05 20:21:35 +00:00
- /opt/servercontainer_init_mysql.sh
- /opt/servercontainer_init_apache.sh
- /opt/servercontainer_init_configure_envi.sh
# - source /home/gameserver/.bashrc # doesn't work, why ?
- export -p KHANAT_HOME=/home/gameserver
- export -p KHANAT_PATH=/home/gameserver/khanat
- export -p PATH=$PATH:/usr/local/bin
- export -p PATCH_CLIENT_SYSTEM=$KHANAT_HOME/khanat/patch_service
- export -p DIRCLIENT="Khanat_Linux64"
2018-04-05 20:21:35 +00:00
- export -p PACKAGECLIENT="smokey_linux64"
- export -p PREPARE_CLIENT_DIR="khanat/prepare_client/$DIRCLIENT"
- export -p CLIENT_DIR="khanat/client_service"
- export -p HOME_PREPARE_CLIENT="$KHANAT_HOME/$PREPARE_CLIENT_DIR"
- export -p HOME_CLIENT="$KHANAT_HOME/$CLIENT_DIR"
- echo "KHANAT_PATH $KHANAT_PATH"
- mkdir -p $KHANAT_PATH
- mkdir -p /home/gameserver/ext
- ln -s /opt/artefacts/code/web /home/gameserver/ext/khanatweb
- ln -s /opt/artefacts/code/ryzom /home/gameserver/ext/ryzom-ressources
- (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git)
#- ln -s /opt/download/khanat-ressources /home/gameserver/ext/khanat-ressources
- (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git)
#- ln -s /opt/download/khanat-client-data /home/gameserver/ext/khanat-client-data
- for file in /opt/artefacts/code/build/bin/* ; do ln -s $file /usr/local/bin ; done
- for file in /opt/artefacts/code/build/lib/* ; do ln -s $file /usr/local/lib ; done
- ldconfig
#- /opt/ext/servercontainer_configure_link.sh
#- /opt/ext/servercontainer_configure_mysql.sh
#- /opt/ext/servercontainer_configure_apache.sh
#- /opt/ext/servercontainer_configure_world.sh
#- su -c '/opt/ext/servercontainer_configure_khanat.sh' gameserver
#- su -c '/opt/ext/servercontainer_configure_patch.sh' gameserver
#- su -c '/opt/ext/servercontainer_configure_launcher.sh' gameserver
#- su -c 'touch /home/gameserver/khanat/step_configure.ok' gameserver
- /opt/ext/servercontainer_configure_auto.sh
2018-04-05 20:21:35 +00:00
# Clean
- rm -f /opt/servercontainer*
# Create image
2018-04-06 20:47:55 +00:00
- option=""
- echo "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" > /home/gameserver/version.txt
2018-04-06 22:25:47 +00:00
- for dir in /home/* ; do if [ $dir != '/home/gameserver' ] ; then option="$option --exclude=$dir" ; fi ; done
2018-04-06 20:47:55 +00:00
- echo "option '$option'"
- find /home/gameserver -type d -exec du -sh {} \;
2018-07-05 19:52:39 +00:00
- tar --numeric-owner --exclude=.git --exclude=.dockerenv --exclude=/proc --exclude=/sys --exclude=/builds --exclude=/opt/download --exclude=khanat-debian-server.tar.gz $option -czf khanat-debian-server.tar.gz /
- ls -lh khanat-debian-server.*
2018-04-05 20:21:35 +00:00
artifacts:
name: "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch"
paths:
2018-07-06 22:26:53 +00:00
- khanat-debian-server.tar.gz
expire_in: 2 week
2018-04-05 20:21:35 +00:00