generated from gCubeCI/Pipeline-Docker-Template
add function for service deploy
This commit is contained in:
parent
ce05084684
commit
6c6ea2f5c2
|
@ -34,9 +34,10 @@ pipeline {
|
||||||
// cron('H/15 * * * *')
|
// cron('H/15 * * * *')
|
||||||
// once a day on the 1st and 15th of every month
|
// once a day on the 1st and 15th of every month
|
||||||
cron ('H H 1,15 * *')
|
cron ('H H 1,15 * *')
|
||||||
|
// once in every two hours slot between 9 AM and 5 PM every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM)
|
||||||
|
// cron('H H(9-16)/2 * * 1-5')
|
||||||
|
|
||||||
}
|
}
|
||||||
//once in every two hours slot between 9 AM and 5 PM every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM)
|
|
||||||
// cron('H H(9-16)/2 * * 1-5')
|
|
||||||
environment {
|
environment {
|
||||||
AGENT_ROOT_FOLDER = "${agent_root_folder}"
|
AGENT_ROOT_FOLDER = "${agent_root_folder}"
|
||||||
DEPLOY_FILE = "${agent_root_folder}/${agent_deploy_filename}"
|
DEPLOY_FILE = "${agent_root_folder}/${agent_deploy_filename}"
|
||||||
|
@ -71,6 +72,7 @@ pipeline {
|
||||||
stage(component){
|
stage(component){
|
||||||
println "Deploy on going of component: $component"
|
println "Deploy on going of component: $component"
|
||||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||||
|
// calling the ansible dispatcher here
|
||||||
sh "exit 0"
|
sh "exit 0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +137,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing"
|
echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing"
|
||||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||||
sh "exit 0"
|
deployService(${params.TRIGGER_JOB}, ${params.TRIGGER_VERSION}, ${params.TRIGGER_HOST)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -212,3 +214,12 @@ def appendFooter( def File) {
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def deploy(String service, String version, String host){
|
||||||
|
def now = new Date();
|
||||||
|
println("Going to deploy the service "+service+" with version: "+version+" on target: "+host);
|
||||||
|
sh("""
|
||||||
|
cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/CD/;
|
||||||
|
./deployService..sh $service $version $host
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue