generated from gCubeCI/Pipeline-Docker-Template
Compare commits
No commits in common. "master" and "feature/27892" have entirely different histories.
master
...
feature/27
|
@ -82,7 +82,7 @@ pipeline {
|
||||||
//URL to the YAML file. Used alternatively to RELEASE_JOB
|
//URL to the YAML file. Used alternatively to RELEASE_JOB
|
||||||
RELEASE_URL= "${params.RELEASE_URL}"
|
RELEASE_URL= "${params.RELEASE_URL}"
|
||||||
// username of ReleaseManager. Used for limiting the preproduction deployments
|
// 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)
|
// name of Smartgears distribution group, defined in the yaml file ( only for release deployments)
|
||||||
DISTRIBUTION_CATEGORY='Distribution'
|
DISTRIBUTION_CATEGORY='Distribution'
|
||||||
// name of Portlets group, defined in the yaml file ( only for release deployments)
|
// 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 '\033[31;1;4mNew upstream deploy ongoing\033[0m'
|
||||||
echo "Cron build disabled. Component: ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION}"
|
echo "Cron build disabled. Component: ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION}"
|
||||||
ansiColor('xterm') {
|
ansiColor('xterm') {
|
||||||
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
|
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||||
checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
|
checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
|
||||||
}
|
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}", "${params.TRIGGER_FOO}");
|
||||||
if (currentBuild.result == "UNSTABLE") {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
||||||
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}", "${params.TRIGGER_FOO}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,14 +262,14 @@ pipeline {
|
||||||
echo 'The deploy pipeline worked!'
|
echo 'The deploy pipeline worked!'
|
||||||
|
|
||||||
emailext attachLog: true,//attachmentsPattern: "**/${ACTION_DEPLOY_FILE}.csv",
|
emailext attachLog: true,//attachmentsPattern: "**/${ACTION_DEPLOY_FILE}.csv",
|
||||||
to: 'jenkinsbuilds@d4science.org',
|
to: 'roberto.cirillo@isti.cnr.it',
|
||||||
subject: "[Jenkins-gCubeDeployer] Deploy report",
|
subject: "[Jenkins-gCubeDeployer] Deploy report",
|
||||||
body: "${currentBuild.fullDisplayName}. Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}. "
|
body: "${currentBuild.fullDisplayName}. Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}. "
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
echo 'The deploy pipeline has failed'
|
echo 'The deploy pipeline has failed'
|
||||||
emailext attachLog: true,
|
emailext attachLog: true,
|
||||||
to: 'jenkinsbuilds@d4science.org',
|
to: 'roberto.cirillo@isti.cnr.it',
|
||||||
subject: "[Jenkins-gCubeDeployer] deploy ${currentBuild.fullDisplayName} failed",
|
subject: "[Jenkins-gCubeDeployer] deploy ${currentBuild.fullDisplayName} failed",
|
||||||
body: "Something is wrong with ${env.BUILD_URL}"
|
body: "Something is wrong with ${env.BUILD_URL}"
|
||||||
}
|
}
|
||||||
|
@ -339,13 +334,8 @@ def deployJobs(def serviceList){
|
||||||
println("Processing deploy: "+service[ 0 ])
|
println("Processing deploy: "+service[ 0 ])
|
||||||
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
|
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
|
||||||
checkup(service[0], service[ 1 ], service[2]);
|
checkup(service[0], service[ 1 ], service[2]);
|
||||||
}
|
|
||||||
if (currentBuild.result == "UNSTABLE") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
||||||
deploy(service[0], service[ 1 ], service[2]);
|
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 deploy(String service, String version, String host, String foo){
|
||||||
def now = new Date();
|
def now = new Date();
|
||||||
println("Going to deploy the service "+service+" with version: "+version+" on target: "+host+" with argument: "+foo);
|
println("Going to deploy the service "+service+" with version: "+version+" on target: "+host+" with argument: "+foo);
|
||||||
dir("${ANSIBLE_ROOT_FOLDER}/CD/"){
|
def statusCode = sh( script: "cd ${ANSIBLE_ROOT_FOLDER}/CD;./deployService.sh $service $version $host $foo;", returnStdout: true);
|
||||||
sh("""
|
sh("""
|
||||||
git pull;
|
echo " last exit code \$?";
|
||||||
""")
|
""")
|
||||||
def statusCode = sh( script: "./deployService.sh $service $version $host $foo;", returnStatus: true);
|
println("Deploy ended with status: "+statusCode);
|
||||||
sh("""
|
|
||||||
echo " last exit code \$?";
|
|
||||||
""")
|
|
||||||
println("Deploy statusCode value: "+statusCode);
|
|
||||||
if (statusCode != 0){
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
sh("""
|
|
||||||
exit $statusCode;
|
|
||||||
""")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -444,21 +422,9 @@ def deployReleaseJobs(def serviceList, String smartgears, boolean isPortlet){
|
||||||
def deployReleaseJob(String service, String version, String smartgears){
|
def deployReleaseJob(String service, String version, String smartgears){
|
||||||
def now = new Date();
|
def now = new Date();
|
||||||
println("Going to deploy "+service+" "+version+" on preproduction ");
|
println("Going to deploy "+service+" "+version+" on preproduction ");
|
||||||
dir("${ANSIBLE_ROOT_FOLDER}/CD/"){
|
def statusCode = sh( script: "cd ${ANSIBLE_ROOT_FOLDER}/CD;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
|
||||||
sh("""
|
sh("""
|
||||||
git pull;
|
echo " last exit code \$?";
|
||||||
""")
|
""")
|
||||||
def statusCode = sh( script: "./deployPreprodService.sh $service $version $smartgears ;", returnStatus: true);
|
println("Deploy ended with status: "+statusCode);
|
||||||
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:
|
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
|
* 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
|
* 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
|
* CD: (Continuous Deployment: True | False) if True the remote deploy will be performed
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
Loading…
Reference in New Issue