generated from gCubeCI/Pipeline-Docker-Template
small changes
This commit is contained in:
parent
eacc8c2d97
commit
b0e4dd25be
|
@ -270,16 +270,9 @@ pipeline {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//launch ansible deploy
|
|
||||||
def deploy(String service, String version, String host){
|
/* CHECKUP METHODS */
|
||||||
def now = new Date();
|
|
||||||
println("Going to deploy the service "+service+" with version: "+version+" on target: "+host);
|
|
||||||
def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;./deployService.sh $service $version $host;", returnStdout: true);
|
|
||||||
sh("""
|
|
||||||
echo " last exit code \$?";
|
|
||||||
""")
|
|
||||||
println("Deploy ended with status: "+statusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Implement a new method in order to check the input parameters
|
//Implement a new method in order to check the input parameters
|
||||||
def checkup(String service, String version, String host){
|
def checkup(String service, String version, String host){
|
||||||
|
@ -292,16 +285,6 @@ def checkup(String service, String version, String host){
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
//launch ansible deploy
|
|
||||||
def deployRelease(String service, String version, String smartgears){
|
|
||||||
def now = new Date();
|
|
||||||
println("Going to deploy the service "+service+" with version: "+version+" on preproduction ");
|
|
||||||
def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
|
|
||||||
sh("""
|
|
||||||
echo " last exit code \$?";
|
|
||||||
""")
|
|
||||||
println("Deploy ended with status: "+statusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Implement a new method in order to check the input parameters
|
//Implement a new method in order to check the input parameters
|
||||||
def checkupRelease(String service, String version){
|
def checkupRelease(String service, String version){
|
||||||
|
@ -313,6 +296,10 @@ def checkupRelease(String service, String version){
|
||||||
esac
|
esac
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* DEPLOY METHODS*/
|
||||||
|
|
||||||
//parse all csv files found in the local folder and deploy the components defined inside
|
//parse all csv files found in the local folder and deploy the components defined inside
|
||||||
def parseDeployPendingJobs( def deployFolder){
|
def parseDeployPendingJobs( def deployFolder){
|
||||||
println ("searching files in folder ${deployFolder}");
|
println ("searching files in folder ${deployFolder}");
|
||||||
|
@ -347,32 +334,23 @@ def deployJobs(def serviceList){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//Deploy only release components. All the component are passed as: componentName,componentVersion
|
|
||||||
def deployReleaseJobs(def serviceList, String smartgears){
|
//Run ansible deploy
|
||||||
if (serviceList){
|
def deploy(String service, String version, String host){
|
||||||
println("Going to deploy release components");
|
def now = new Date();
|
||||||
for (def record : serviceList) {
|
println("Going to deploy the service "+service+" with version: "+version+" on target: "+host);
|
||||||
service=record.split(",");
|
def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;./deployService.sh $service $version $host;", returnStdout: true);
|
||||||
stage(service[0]){
|
sh("""
|
||||||
println("Processing RELEASE deploy: service "+service[ 0 ]+" with version "+service[ 1 ]+" and SG "+smartgears)
|
echo " last exit code \$?";
|
||||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
""")
|
||||||
checkupRelease(service[0], service[ 1 ]);
|
println("Deploy ended with status: "+statusCode);
|
||||||
if (smartgears)
|
|
||||||
deployRelease(service[0], service[ 1 ], smartgears);
|
|
||||||
else
|
|
||||||
deployRelease(service[0], service[ 1 ], '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else{
|
/* DEPLOY RELEASE METHODS*/
|
||||||
println("Release components not found. Skip this stage");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// collects all the components defined inside one or more yaml categories matching categoryList and invoke the deploy
|
||||||
// collects all the components defined inside one or more yaml categories matching categoryList
|
|
||||||
def deployRelease(def categoryList, def yaml){
|
def deployRelease(def categoryList, def yaml){
|
||||||
def releaseList = []
|
def releaseList = []
|
||||||
def portlets = []
|
def portlets = []
|
||||||
|
@ -403,3 +381,41 @@ def deployRelease(def categoryList, def yaml){
|
||||||
}
|
}
|
||||||
deployReleaseJobs(releaseList, smartgears);
|
deployReleaseJobs(releaseList, smartgears);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Deploy only release components, starting from a servicelist. All the component are passed as: componentName,componentVersion
|
||||||
|
def deployReleaseJobs(def serviceList, String smartgears){
|
||||||
|
if (serviceList){
|
||||||
|
println("Going to deploy release components");
|
||||||
|
for (def record : serviceList) {
|
||||||
|
service=record.split(",");
|
||||||
|
stage(service[0]){
|
||||||
|
println("Processing RELEASE deploy: service "+service[ 0 ]+" with version "+service[ 1 ]+" and SG "+smartgears)
|
||||||
|
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||||
|
checkupRelease(service[0], service[ 1 ]);
|
||||||
|
if (smartgears)
|
||||||
|
deployReleaseJob(service[0], service[ 1 ], smartgears);
|
||||||
|
else
|
||||||
|
deployReleaseJob(service[0], service[ 1 ], '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
println("Release components not found. Skip this stage");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Run ansible deploy related to a single service
|
||||||
|
def deployReleaseJob(String service, String version, String smartgears){
|
||||||
|
def now = new Date();
|
||||||
|
println("Going to deploy the service "+service+" with version: "+version+" on preproduction ");
|
||||||
|
def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
|
||||||
|
sh("""
|
||||||
|
echo " last exit code \$?";
|
||||||
|
""")
|
||||||
|
println("Deploy ended with status: "+statusCode);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue