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}";
|
|
|
|
def buildNumber = "${env.BUILD_NUMBER}";
|
2017-10-10 09:09:47 +00:00
|
|
|
def branchProduction = "master"
|
|
|
|
def branchTest = "test";
|
|
|
|
def dockerHost = "${env.DOCKER_HOST}";
|
2017-05-12 10:41:35 +00:00
|
|
|
|
2017-05-11 10:07:33 +00:00
|
|
|
|
2017-10-10 09:09:47 +00:00
|
|
|
if (branchName == branchProduction)
|
|
|
|
dockerHost = "tcp://172.16.255.29:2375";
|
2017-05-11 10:07:33 +00:00
|
|
|
|
2017-10-10 09:09:47 +00:00
|
|
|
node
|
|
|
|
{
|
2017-05-11 10:07:33 +00:00
|
|
|
stage ('Checkout') {
|
|
|
|
checkout scm
|
|
|
|
|
2017-05-12 12:47:15 +00:00
|
|
|
stage ('install modules'){
|
|
|
|
sh "npm install"
|
|
|
|
}
|
|
|
|
|
2017-05-11 10:07:33 +00:00
|
|
|
stage ('build Project Salix'){
|
|
|
|
sh "gulp build"
|
|
|
|
}
|
|
|
|
|
2017-10-10 09:09:47 +00:00
|
|
|
|
|
|
|
stage ("docker ${element}")
|
2017-05-11 10:07:33 +00:00
|
|
|
{
|
2017-10-10 09:09:47 +00:00
|
|
|
stage ("Stopping ${prefixDocker}-${element} actual")
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
def returnDocker = sh (script: "docker stop ${prefixDocker}-${element}", returnStdout: true).trim();
|
|
|
|
echo "${returnDocker}";
|
|
|
|
returnDocker = sh (script: "docker rm ${prefixDocker}-${element}", returnStdout: false).trim();
|
|
|
|
//echo "${returnDocker}";
|
|
|
|
returnDocker = sh (script: "docker rmi ${prefixDocker}-${element}:${buildNumber-3}", returnStdout: true).trim();
|
|
|
|
echo "borran ${prefixDocker}-${element}:${buildNumber-3}";
|
|
|
|
//echo "${returnDocker}";
|
|
|
|
}catch(Exception _){
|
|
|
|
echo "Error Stage Stopping"
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
{
|
2017-10-10 09:09:47 +00:00
|
|
|
stage ("build dockers")
|
2017-05-11 10:07:33 +00:00
|
|
|
{
|
2017-10-10 09:09:47 +00:00
|
|
|
sh "docker-compose build "
|
2017-05-11 10:07:33 +00:00
|
|
|
}
|
2017-10-10 09:09:47 +00:00
|
|
|
|
|
|
|
stage ("up dockers")
|
|
|
|
{
|
|
|
|
sh "docker-compose up -d"
|
2017-05-11 10:07:33 +00:00
|
|
|
}
|
2017-10-10 09:09:47 +00:00
|
|
|
}
|
2017-05-11 10:07:33 +00:00
|
|
|
}
|
|
|
|
}
|