Compare commits

..

No commits in common. "master" and "feature/27892" have entirely different histories.

2 changed files with 19 additions and 53 deletions

70
Jenkinsfile vendored
View File

@ -82,7 +82,7 @@ pipeline {
//URL to the YAML file. Used alternatively to RELEASE_JOB
RELEASE_URL= "${params.RELEASE_URL}"
// username of ReleaseManager. Used for limiting the preproduction deployments
RELEASE_MANAGER_USER='giancarlo.panichi'
RELEASE_MANAGER_USER='roberto.cirillo'
// name of Smartgears distribution group, defined in the yaml file ( only for release deployments)
DISTRIBUTION_CATEGORY='Distribution'
// name of Portlets group, defined in the yaml file ( only for release deployments)
@ -203,15 +203,10 @@ pipeline {
echo '\033[31;1;4mNew upstream deploy ongoing\033[0m'
echo "Cron build disabled. Component: ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION}"
ansiColor('xterm') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
}
if (currentBuild.result == "UNSTABLE") {
return;
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}", "${params.TRIGGER_FOO}");
}
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}", "${params.TRIGGER_FOO}");
}
}
}
@ -267,14 +262,14 @@ pipeline {
echo 'The deploy pipeline worked!'
emailext attachLog: true,//attachmentsPattern: "**/${ACTION_DEPLOY_FILE}.csv",
to: 'jenkinsbuilds@d4science.org',
to: 'roberto.cirillo@isti.cnr.it',
subject: "[Jenkins-gCubeDeployer] Deploy report",
body: "${currentBuild.fullDisplayName}. Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}. "
}
failure {
echo 'The deploy pipeline has failed'
emailext attachLog: true,
to: 'jenkinsbuilds@d4science.org',
to: 'roberto.cirillo@isti.cnr.it',
subject: "[Jenkins-gCubeDeployer] deploy ${currentBuild.fullDisplayName} failed",
body: "Something is wrong with ${env.BUILD_URL}"
}
@ -339,13 +334,8 @@ def deployJobs(def serviceList){
println("Processing deploy: "+service[ 0 ])
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
checkup(service[0], service[ 1 ], service[2]);
}
if (currentBuild.result == "UNSTABLE") {
return;
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
deploy(service[0], service[ 1 ], service[2]);
}
}
}
}
@ -355,23 +345,11 @@ def deployJobs(def serviceList){
def deploy(String service, String version, String host, String foo){
def now = new Date();
println("Going to deploy the service "+service+" with version: "+version+" on target: "+host+" with argument: "+foo);
dir("${ANSIBLE_ROOT_FOLDER}/CD/"){
sh("""
git pull;
""")
def statusCode = sh( script: "./deployService.sh $service $version $host $foo;", returnStatus: true);
sh("""
echo " last exit code \$?";
""")
println("Deploy statusCode value: "+statusCode);
if (statusCode != 0){
currentBuild.result = 'FAILURE'
sh("""
exit $statusCode;
""")
}
}
def statusCode = sh( script: "cd ${ANSIBLE_ROOT_FOLDER}/CD;./deployService.sh $service $version $host $foo;", returnStdout: true);
sh("""
echo " last exit code \$?";
""")
println("Deploy ended with status: "+statusCode);
}
@ -444,21 +422,9 @@ def deployReleaseJobs(def serviceList, String smartgears, boolean isPortlet){
def deployReleaseJob(String service, String version, String smartgears){
def now = new Date();
println("Going to deploy "+service+" "+version+" on preproduction ");
dir("${ANSIBLE_ROOT_FOLDER}/CD/"){
sh("""
git pull;
""")
def statusCode = sh( script: "./deployPreprodService.sh $service $version $smartgears ;", returnStatus: true);
sh("""
echo " last exit code \$?";
""")
println("Deploy ended with status: "+statusCode);
if (statusCode != 0){
currentBuild.result = 'FAILURE'
sh("""
exit $statusCode;
""")
}
}
def statusCode = sh( script: "cd ${ANSIBLE_ROOT_FOLDER}/CD;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
sh("""
echo " last exit code \$?";
""")
println("Deploy ended with status: "+statusCode);
}

View File

@ -20,7 +20,7 @@ Jenkins Pipeline script to manage one or more gCube components deployment
The variables below must be specified as environment variables on the agent where the deployments will be executed:
* IS_SCHEDULED (True | False): if true all the deployment requests will be performed periodically as specified by cron
* ENVIRONMENT: ( DEV | PREPROD | PROD) Indicates the target environment where will be deployed all the artifacts
* DEPLOY_CATEGORY: (Related to release build) one or more Component group (separated by commas) on yaml file where search the components to deploy
* DEPLOY_CATEGORY: (Related to release build) one or more Component group on yaml file where search the components to deploy
* CD: (Continuous Deployment: True | False) if True the remote deploy will be performed
## References