Jenkinsfile

This commit is contained in:
Juan 2018-05-10 17:50:42 +02:00
parent 40f3c57da9
commit 92a5679ff6
1 changed files with 17 additions and 17 deletions

34
Jenkinsfile vendored
View File

@ -1,30 +1,30 @@
#!/usr/bin/env groovy
def branchName = "${env.BRANCH_NAME}";
def branchName = env.BRANCH_NAME;
// TODO: We are using latest tag until image rotation it's implemented
env.TAG = "latest" /* "${env.BUILD_NUMBER}" */;
env.TAG = 'latest' /* env.BUILD_NUMBER */;
env.BRANCH_NAME = branchName;
env.salixUser="${env.salixUser}";
env.salixPassword="${env.salixPassword}";
env.salixUser = env.salixUser;
env.salixPassword = env.salixPassword;
switch (branchName) {
case "test":
env.NODE_ENV = "test";
env.salixHost = "${env.testSalixHost}";
env.salixPort = "${env.testSalixPort}";
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";
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 ${branchName}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}"
echo "Branch ${branchName}, tag ${env.TAG}, environament ${env.NODE_ENV}"
}
stage ('Checkout') {
checkout scm
@ -35,13 +35,13 @@ node {
stage ('Build project') {
sh "gulp build"
}
stage ("Install services Node dependencies") {
stage ('Install services Node dependencies') {
sh "cd ./services/loopback && npm install"
}
stage ("Removing old dockers") {
stage ('Removing old dockers') {
sh "docker-compose down --rmi 'all'"
}
stage ("Generating new dockers") {
stage ('Generating new dockers') {
sh "docker-compose up -d --build"
}
}