salix/Jenkinsfile

45 lines
1.2 KiB
Plaintext
Raw Normal View History

2017-05-12 10:41:35 +00:00
#!/usr/bin/env groovy
2018-04-27 11:31:12 +00:00
// TODO: We are using latest tag until image rotation it's implemented
2018-05-10 15:50:42 +00:00
env.TAG = 'latest' /* env.BUILD_NUMBER */;
env.salixUser = env.salixUser;
env.salixPassword = env.salixPassword;
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 {
stage ('Print environment variables') {
echo "Branch ${env.BRANCH_NAME}, tag ${env.TAG}, environament ${env.NODE_ENV}"
2017-11-07 12:04:14 +00:00
}
2017-05-11 10:07:33 +00:00
stage ('Checkout') {
checkout scm
2017-11-07 08:15:44 +00:00
}
2018-06-11 10:51:32 +00:00
stage ('Install Node dependencies') {
2017-05-12 12:47:15 +00:00
sh "npm install"
2018-06-11 10:31:11 +00:00
sh "gulp install"
2017-05-12 12:47:15 +00:00
}
2018-04-27 11:31:12 +00:00
stage ('Build project') {
2017-05-11 10:07:33 +00:00
sh "gulp build"
}
2018-05-10 15:50:42 +00:00
stage ('Removing old dockers') {
2018-05-10 15:41:03 +00:00
sh "docker-compose down --rmi 'all'"
}
2018-05-10 15:50:42 +00:00
stage ('Generating new dockers') {
2018-06-11 10:31:11 +00:00
sh "doker build -t vn-loopback:latest ./services/loopback/"
2018-04-27 11:31:12 +00:00
sh "docker-compose up -d --build"
2017-05-11 10:07:33 +00:00
}
2018-01-08 10:07:52 +00:00
}