# 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 . # # 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 python3-pip python3-bcrypt # - 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') - ls -l /opt/download - mkdir -p /opt/artefacts - (cd /opt/artefacts ; for file in /opt/download/khanat-server_static-debian_amd64_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) - mkdir -p /opt/ext - cp $WORKDIR/server/debian/common/servercontainer_init_* /opt/ - cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/ - cp $WORKDIR/server/debian/common/* /opt/ext - 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 - mkdir -p /var/run/mysqld - /opt/servercontainer_init_create_account.sh - /opt/servercontainer_init_mysql.sh - /opt/servercontainer_init_apache.sh - /opt/servercontainer_init_configure_envi.sh - source /home/gameserver/.bashrc # - 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" # - 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_auto.sh - /opt/ext/servercontainer_update_auto.sh # Install pymanager - pip3 install /opt/artefacts/dist/pymanager-1.0.0.tar.gz # Clean - rm -f /opt/servercontainer* # Create image - option="" - echo "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" > /home/gameserver/version.txt - for dir in /home/* ; do if [ $dir != '/home/gameserver' ] ; then option="$option --exclude=$dir" ; fi ; done - echo "option '$option'" #- find /home/gameserver -type d -exec du -sh {} \; - find /opt -type d -exec du -sh {} \; - 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.* artifacts: name: "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" paths: - khanat-debian-server.tar.gz expire_in: 2 week