salix/Jenkinsfile

61 lines
1.4 KiB
Plaintext
Raw Normal View History

2017-05-12 10:41:35 +00:00
#!/usr/bin/env groovy
2017-05-11 10:07:33 +00:00
def branchName = "${env.BRANCH_NAME}";
2017-10-10 09:09:47 +00:00
def branchProduction = "master"
def branchTest = "test";
2017-05-12 10:41:35 +00:00
2017-11-07 12:54:19 +00:00
env.BRANCH_NAME = branchName;
env.TAG = "${env.BUILD_NUMBER}";
2018-03-13 10:15:39 +00:00
env.salixUser="${env.salixUser}";
env.salixPassword="${env.salixPassword}";
2018-03-13 13:36:00 +00:00
env.salixHost = "${env.productionSalixHost}";
env.salixPort = "${env.productionSalixPort}";
2017-05-11 10:07:33 +00:00
2017-11-09 12:24:23 +00:00
switch (branchName){
case branchTest:
2018-02-23 13:19:28 +00:00
env.NODE_ENV = "test";
2018-03-13 10:15:39 +00:00
env.salixHost = "${env.testSalixHost}";
env.salixPort = "${env.testSalixPort}";
2017-11-09 12:24:23 +00:00
break;
case branchProduction:
2017-11-09 12:44:06 +00:00
env.DOCKER_HOST = "tcp://172.16.255.29:2375";
2017-11-09 12:24:23 +00:00
env.NODE_ENV = "production"
break;
}
2017-05-11 10:07:33 +00:00
2017-10-10 09:09:47 +00:00
node
{
2017-11-07 12:04:14 +00:00
stage ('Print environment variables'){
2018-03-13 10:15:39 +00:00
echo "Branch ${branchName}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}"
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
}
2017-05-11 10:07:33 +00:00
2017-05-12 12:47:15 +00:00
stage ('install modules'){
sh "npm install"
}
2017-11-07 18:21:11 +00:00
stage ('build Project'){
2017-05-11 10:07:33 +00:00
sh "gulp build"
}
2017-11-07 11:19:30 +00:00
stage ("docker")
2017-05-11 10:07:33 +00:00
{
2017-11-08 16:04:08 +00:00
stage ("install modules loopback service")
{
2017-11-08 17:01:15 +00:00
sh "cd ./services/loopback && npm install"
2017-11-08 16:04:08 +00:00
}
2017-11-07 11:23:01 +00:00
stage ("Stopping/Removing Docker")
2017-10-10 09:09:47 +00:00
{
2018-01-17 14:00:32 +00:00
sh "docker-compose down --rmi 'all'"
2017-10-10 09:09:47 +00:00
}
2017-05-12 10:41:35 +00:00
2017-10-10 09:09:47 +00:00
stage ("Generar dockers")
2017-05-11 10:07:33 +00:00
{
2018-01-08 10:07:52 +00:00
sh "docker-compose up -d --build"
2017-10-10 09:09:47 +00:00
}
2017-05-11 10:07:33 +00:00
}
2018-01-08 10:07:52 +00:00
}