jenkins
This commit is contained in:
parent
65e7b97ec0
commit
5fc446c05f
|
@ -1,8 +1,6 @@
|
||||||
#!/usr/bin/env groovy
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
def branchName = "${env.BRANCH_NAME}";
|
def branchName = "${env.BRANCH_NAME}";
|
||||||
def branchProduction = "master"
|
|
||||||
def branchTest = "test";
|
|
||||||
|
|
||||||
env.BRANCH_NAME = branchName;
|
env.BRANCH_NAME = branchName;
|
||||||
env.TAG = "${env.BUILD_NUMBER}";
|
env.TAG = "${env.BUILD_NUMBER}";
|
||||||
|
@ -11,49 +9,44 @@ env.salixPassword="${env.salixPassword}";
|
||||||
env.salixHost = "${env.productionSalixHost}";
|
env.salixHost = "${env.productionSalixHost}";
|
||||||
env.salixPort = "${env.productionSalixPort}";
|
env.salixPort = "${env.productionSalixPort}";
|
||||||
|
|
||||||
switch (branchName){
|
switch (branchName) {
|
||||||
case branchTest:
|
case "test":
|
||||||
env.NODE_ENV = "test";
|
env.NODE_ENV = "test";
|
||||||
env.salixHost = "${env.testSalixHost}";
|
env.salixHost = "${env.testSalixHost}";
|
||||||
env.salixPort = "${env.testSalixPort}";
|
env.salixPort = "${env.testSalixPort}";
|
||||||
break;
|
break;
|
||||||
case branchProduction:
|
case "master":
|
||||||
env.DOCKER_HOST = "tcp://172.16.255.29:2375";
|
|
||||||
env.NODE_ENV = "production"
|
env.NODE_ENV = "production"
|
||||||
|
env.DOCKER_HOST = "tcp://172.16.255.29:2375";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
node
|
node {
|
||||||
{
|
stage ('Print environment variables') {
|
||||||
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}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}"
|
||||||
}
|
}
|
||||||
stage ('Checkout') {
|
stage ('Checkout') {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ('install modules'){
|
stage ('install modules') {
|
||||||
sh "npm install"
|
sh "npm install"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ('build Project'){
|
stage ('build Project') {
|
||||||
sh "gulp build"
|
sh "gulp build"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ("docker")
|
stage ("docker") {
|
||||||
{
|
stage ("install modules loopback service") {
|
||||||
stage ("install modules loopback service")
|
|
||||||
{
|
|
||||||
sh "cd ./services/loopback && npm install"
|
sh "cd ./services/loopback && npm install"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ("Stopping/Removing Docker")
|
stage ("Stopping/Removing Docker") {
|
||||||
{
|
|
||||||
sh "docker-compose down --rmi 'all'"
|
sh "docker-compose down --rmi 'all'"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ("Generar dockers")
|
stage ("Generar dockers") {
|
||||||
{
|
|
||||||
sh "docker-compose up -d --build"
|
sh "docker-compose up -d --build"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue