2017-05-12 10:41:35 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
2018-06-11 07:35:21 +00:00
|
|
|
env.COMPOSER_HTTP_TIMEOUT = 300;
|
2017-05-11 10:07:33 +00:00
|
|
|
|
2018-06-11 07:35:21 +00:00
|
|
|
switch (env.BRANCH_NAME) {
|
2018-05-10 15:50:42 +00:00
|
|
|
case 'test':
|
|
|
|
env.NODE_ENV = 'test';
|
|
|
|
env.salixHost = env.testSalixHost;
|
|
|
|
env.salixPort = env.testSalixPort;
|
2017-11-09 12:24:23 +00:00
|
|
|
break;
|
2018-05-10 15:50:42 +00:00
|
|
|
case 'master':
|
|
|
|
env.NODE_ENV = 'production'
|
|
|
|
env.salixHost = env.productionSalixHost;
|
|
|
|
env.salixPort = env.productionSalixPort;
|
|
|
|
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2375';
|
2017-11-09 12:24:23 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-05-11 10:07:33 +00:00
|
|
|
|
2018-04-06 16:14:49 +00:00
|
|
|
node {
|
2018-10-24 12:40:18 +00:00
|
|
|
//env.NODEJS_HOME = "${tool 'node-8.12.0'}"
|
|
|
|
// on linux / mac
|
|
|
|
//env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
2018-10-24 12:10:41 +00:00
|
|
|
|
|
|
|
stages {
|
|
|
|
stage ('Print environment variables') {
|
|
|
|
echo "Branch ${env.BRANCH_NAME}, build number ${env.BUILD_NUMBER}, environment ${env.NODE_ENV}"
|
|
|
|
}
|
|
|
|
stage ('Checkout') {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
stage ('Install Node dependencies') {
|
2018-10-24 12:40:18 +00:00
|
|
|
nodejs('node-8.12.0') {
|
|
|
|
sh "npm install --only=prod"
|
|
|
|
sh "npm install --only=dev"
|
|
|
|
sh "gulp install"
|
|
|
|
}
|
2018-10-24 12:10:41 +00:00
|
|
|
}
|
|
|
|
stage ('Build project') {
|
2018-10-24 12:40:18 +00:00
|
|
|
nodejs('node-8.12.0') {
|
|
|
|
sh "gulp build"
|
|
|
|
}
|
2018-10-24 12:10:41 +00:00
|
|
|
}
|
|
|
|
stage ('Generating new dockers') {
|
|
|
|
sh "docker build -t vn-loopback:latest ./services/loopback/"
|
|
|
|
sh "docker-compose up -d --build"
|
|
|
|
sh "docker image prune -f"
|
|
|
|
}
|
2017-05-11 10:07:33 +00:00
|
|
|
}
|
2018-01-08 10:07:52 +00:00
|
|
|
}
|