Merge branch 'test' into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Juan Ferrer 2019-03-20 13:11:51 +01:00
commit 36c9c11d77
3 changed files with 29 additions and 11 deletions

31
Jenkinsfile vendored
View File

@ -6,11 +6,13 @@ pipeline {
disableConcurrentBuilds()
}
environment {
PROJECT_NAME = 'salix'
REGISTRY = 'registry.verdnatura.es'
DOCKER_HOST_1 = 'vch1.verdnatura.es'
DOCKER_HOST_2 = 'vch2.verdnatura.es'
TAG = "${env.BRANCH_NAME}"
PROJECT_NAME = 'salix'
REGISTRY = 'registry.verdnatura.es'
DOCKER_HOST_1 = 'vch1.verdnatura.es'
DOCKER_HOST_2 = 'vch2.verdnatura.es'
PORT_MASTER = '5002'
PORT_TEST = '5001'
TAG = "${env.BRANCH_NAME}"
}
stages {
stage('Checkout') {
@ -29,10 +31,10 @@ pipeline {
switch (env.BRANCH_NAME) {
case 'master':
env.PORT = 5002
env.PORT = PORT_MASTER
break
case 'test':
env.PORT = 5001
env.PORT = PORT_TEST
break
}
switch (env.BRANCH_NAME) {
@ -126,6 +128,21 @@ pipeline {
}
}
}
stage('Database') {
when { anyOf {
branch 'test'
}}
steps {
configFileProvider([
configFile(fileId: "config.${env.NODE_ENV}.ini",
variable: 'MYSQL_CONFIG')
]) {
sh 'cp "$MYSQL_CONFIG" db/config.$NODE_ENV.ini'
}
sh 'db/import-changes.sh -f $NODE_ENV'
}
}
stage('Cleanup') {
when { anyOf {
branch 'test'

3
db/.gitignore vendored
View File

@ -1,2 +1 @@
config.production.ini
config.test.ini
config.*.ini

View File

@ -48,7 +48,8 @@ if [ -z "$ENV" ]; then
ENV="test"
fi
INI_FILE="config.$ENV.ini"
DIR="$(dirname "${BASH_SOURCE[0]}")"
INI_FILE="$DIR/config.$ENV.ini"
if [ ! -f "$INI_FILE" ]; then
echo "Config file doesn't exists: $INI_FILE"
@ -59,7 +60,8 @@ echo "[INFO] Config file: $INI_FILE"
echo "[INFO] Applying changes"
# Import changes
for file in install/changes/*.sql; do
for file in $DIR/install/changes/*.sql; do
echo "[INFO] -> $file"
mysql --defaults-file="$INI_FILE" < $file
done