salix/Jenkinsfile

45 lines
1.2 KiB
Groovy

#!/usr/bin/env groovy
// TODO: We are using latest tag until image rotation it's implemented
env.TAG = 'latest' /* env.BUILD_NUMBER */;
env.salixUser = env.salixUser;
env.salixPassword = env.salixPassword;
env.COMPOSER_HTTP_TIMEOUT = 300;
switch (env.BRANCH_NAME) {
case 'test':
env.NODE_ENV = 'test';
env.salixHost = env.testSalixHost;
env.salixPort = env.testSalixPort;
break;
case 'master':
env.NODE_ENV = 'production'
env.salixHost = env.productionSalixHost;
env.salixPort = env.productionSalixPort;
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2375';
break;
}
node {
stage ('Print environment variables') {
echo "Branch ${env.BRANCH_NAME}, tag ${env.TAG}, environament ${env.NODE_ENV}"
}
stage ('Checkout') {
checkout scm
}
stage ('Install Node dependencies') {
sh "npm install"
sh "gulp install"
}
stage ('Build project') {
sh "gulp build"
}
stage ('Removing old dockers') {
sh "docker-compose down --rmi 'all'"
}
stage ('Generating new dockers') {
sh "doker build -t vn-loopback:latest ./services/loopback/"
sh "docker-compose up -d --build"
}
}