generated from gCubeCI/Pipeline-Docker-Template
Compare commits
19 Commits
feature/27
...
master
Author | SHA1 | Date |
---|---|---|
Roberto Cirillo | 5e84d57f91 | |
Roberto Cirillo | 545ec46752 | |
Roberto Cirillo | 6a162840a4 | |
Roberto Cirillo | 4a89d6b448 | |
Roberto Cirillo | d678d87ec8 | |
Roberto Cirillo | 78904c0793 | |
Roberto Cirillo | fea4741152 | |
Roberto Cirillo | c9af197c68 | |
Roberto Cirillo | 4ab3535e90 | |
Roberto Cirillo | ad9f9382fb | |
Roberto Cirillo | 5bbf75f4fd | |
Roberto Cirillo | 8ae9a74ff0 | |
Roberto Cirillo | cf0ea75460 | |
Roberto Cirillo | 4728bd16b9 | |
Roberto Cirillo | ecc8b71cbe | |
Roberto Cirillo | ceaa196895 | |
Roberto Cirillo | ec7ae82e9b | |
Roberto Cirillo | d56d1a693e | |
Roberto Cirillo | dbee8ad96c |
|
@ -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='roberto.cirillo'
|
||||
RELEASE_MANAGER_USER='giancarlo.panichi'
|
||||
// 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,8 +203,13 @@ 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: 'FAILURE') {
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
@ -262,14 +267,14 @@ pipeline {
|
|||
echo 'The deploy pipeline worked!'
|
||||
|
||||
emailext attachLog: true,//attachmentsPattern: "**/${ACTION_DEPLOY_FILE}.csv",
|
||||
to: 'roberto.cirillo@isti.cnr.it',
|
||||
to: 'jenkinsbuilds@d4science.org',
|
||||
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: 'roberto.cirillo@isti.cnr.it',
|
||||
to: 'jenkinsbuilds@d4science.org',
|
||||
subject: "[Jenkins-gCubeDeployer] deploy ${currentBuild.fullDisplayName} failed",
|
||||
body: "Something is wrong with ${env.BUILD_URL}"
|
||||
}
|
||||
|
@ -334,6 +339,11 @@ 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]);
|
||||
}
|
||||
}
|
||||
|
@ -345,11 +355,23 @@ 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);
|
||||
def statusCode = sh( script: "cd ${ANSIBLE_ROOT_FOLDER}/CD;./deployService.sh $service $version $host $foo;", returnStdout: true);
|
||||
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 ended with status: "+statusCode);
|
||||
println("Deploy statusCode value: "+statusCode);
|
||||
if (statusCode != 0){
|
||||
currentBuild.result = 'FAILURE'
|
||||
sh("""
|
||||
exit $statusCode;
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,9 +444,21 @@ 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 ");
|
||||
def statusCode = sh( script: "cd ${ANSIBLE_ROOT_FOLDER}/CD;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
|
||||
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;
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 on yaml file where search the components to deploy
|
||||
* DEPLOY_CATEGORY: (Related to release build) one or more Component group (separated by commas) on yaml file where search the components to deploy
|
||||
* CD: (Continuous Deployment: True | False) if True the remote deploy will be performed
|
||||
|
||||
## References
|
||||
|
|
Loading…
Reference in New Issue