Le serveur gitlab sera inaccessible le mercredi 19 février 2020 de 13h à 14h pour une intervention de maintenance programmée.

...
 
Commits (14)
---
variables:
LANG: 'en_US.UTF-8'
LC_ALL: 'en_US.UTF-8'
LANGUAGE: 'en_US.UTF-8'
POSTGRES_DB: re2o
POSTGRES_USER: re2o
POSTGRES_PASSWORD: re2o
services:
- postgres:latest
image: debian:stretch
stages:
- build
- tests
- lint
build:
stage: build
script:
- apt-get -qq update
- DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales
- sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8
- ./install_re2o.sh ci-setup
- cat re2o/settings_local.py
lint:
stage: lint
variables:
LANG: 'en_US.UTF-8'
LC_ALL: 'en_US.UTF-8'
LANGUAGE: 'en_US.UTF-8'
script:
- apt-get -qq update
- DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales python3-django python3-pylint-django
- DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales
- sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8
- ./install_re2o.sh ci-setup
- pylint3 --load-plugins pylint_django cotisations machines re2o logs topologie preferences search users || if [ $? -ne 1 ]; then exit 0; else exit 1; fi
tests:
stage: tests
script:
- apt-get -qq update
- DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales
- sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8
- ./install_re2o.sh ci-setup
- python3 manage.py test
......@@ -107,8 +107,8 @@ install_database() {
echo "Installing MySQL client: Done"
mysql_command="CREATE DATABASE $db_name collate='utf8_general_ci';
CREATE USER '$username'@'localhost' IDENTIFIED BY '$password';
GRANT ALL PRIVILEGES ON $db_name.* TO '$username'@'localhost';
CREATE USER '$username' IDENTIFIED BY '$password';
GRANT ALL PRIVILEGES ON $db_name.* TO '$username';
FLUSH PRIVILEGES;"
if [ "$local_setup" == 1 ]; then
......@@ -134,7 +134,7 @@ install_database() {
if [ "$local_setup" == 1 ]; then
echo "Setting up local PostgreSQL server ..."
apt-get -y install postgresql
apt-get -y install postgresql sudo
sudo -u postgres psql --command="$pgsql_command1"
sudo -u postgres psql --command="$pgsql_command2"
sudo -u postgres psql --command="$pgsql_command3"
......@@ -176,7 +176,7 @@ install_ldap() {
if [ "$local_setup" == 1 ]; then
echo "Installing slapd package ..."
apt-get -y install slapd
DEBIAN_FRONTEND=noninteractive apt-get -y install slapd
echo "Installing slapd package: Done"
echo "Hashing the LDAP password ..."
......@@ -491,7 +491,7 @@ interactive_guide() {
# Use of default values for local setup
sql_name="re2o"
sql_login="re2o"
sql_host="localhost"
sql_host="127.0.0.1"
fi
# Prompt to enter the database password
......@@ -766,6 +766,8 @@ main_function() {
echo " LDAP"
echo " * <local_domain> the domain extension to use for the LDAP structure"
echo " in LDAP notation"
echo " * {ci-setup} ------ Automatic setup with default values, this command is"
echo " used for building the gitlab CI."
echo ""
else
subcmd="$1"
......@@ -835,6 +837,19 @@ main_function() {
fi
;;
ci-setup )
install_requirements
df -h
install_ldap 1 re2o "dc=example,dc=net"
df -h
write_settings_file 2 postgres re2o re2o re2o \
"cn=admin,dc=example,dc=net" 2 re2o localhost "dc=example,dc=net" \
"mailserver.example.net" 25 "example.net" "re2o.example.net"
update_django
create_superuser
install_webserver 1 2 "re2o.example.net"
;;
* )
echo "Unknown subcommand: $subcmd"
echo "Use 'install_re2o help' to display some help"
......