From 6c6ea2f5c2d842038b51af25e33333a71659f1b2 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 2 May 2022 13:02:50 +0200 Subject: [PATCH 01/52] add function for service deploy --- Jenkinsfile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ab75a33..018d22b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,9 +34,10 @@ pipeline { // cron('H/15 * * * *') // once a day on the 1st and 15th of every month 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 { AGENT_ROOT_FOLDER = "${agent_root_folder}" DEPLOY_FILE = "${agent_root_folder}/${agent_deploy_filename}" @@ -71,6 +72,7 @@ pipeline { stage(component){ println "Deploy on going of component: $component" catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + // calling the ansible dispatcher here sh "exit 0" } } @@ -135,7 +137,7 @@ pipeline { steps { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" 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 + """) +} From 77de7aef8b8a9e79b218fb8530164f4485190061 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 2 May 2022 14:29:54 +0200 Subject: [PATCH 02/52] fix sintax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 018d22b..cf28f84 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -137,7 +137,7 @@ pipeline { steps { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - deployService(${params.TRIGGER_JOB}, ${params.TRIGGER_VERSION}, ${params.TRIGGER_HOST) + deployService(${params.TRIGGER_JOB}, ${params.TRIGGER_VERSION}, ${params.TRIGGER_HOST}) } } From 953e0a38a090cb646fb1b69554f2fd0935f9ddd9 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 2 May 2022 14:33:54 +0200 Subject: [PATCH 03/52] fix sintax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cf28f84..06b6cd9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -137,7 +137,7 @@ pipeline { steps { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - deployService(${params.TRIGGER_JOB}, ${params.TRIGGER_VERSION}, ${params.TRIGGER_HOST}) + deployService("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}") } } From 9326d444cf622f97efcdab641a407fc58468464a Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 2 May 2022 14:37:32 +0200 Subject: [PATCH 04/52] fix sintax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 06b6cd9..34208b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -137,7 +137,7 @@ pipeline { steps { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - deployService("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}") + deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}") } } From 5395ea418b341de0f8d29bc0c961000f70a07ed3 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 6 May 2022 15:59:59 +0200 Subject: [PATCH 05/52] add git pull command --- Jenkinsfile | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 34208b4..1de35d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,18 +81,7 @@ pipeline { println "No components found" } } - sh ''' - echo "cleanup $DEPLOY_FILE"; - if [ -f ${DEPLOY_FILE} ]; then - if [ -f ${BACKUP_FILE} ]; then - echo "backup found: ${BACKUP_FILE} going to replace it"; - rm ${BACKUP_FILE}; - fi - mv ${DEPLOY_FILE} ${BACKUP_FILE}; - else - echo "deploy file empty" - fi - ''' + cleanup(DEPLOY_FILE,BACKUP_FILE); } } stage('Nothing to do by System ') { @@ -219,7 +208,24 @@ 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/; + cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/; + git pull; + cd CD; ./deployService..sh $service $version $host """) } + +def cleanup(def DEPLOY_FILE, def BACKUP_FILE){ + sh ''' + echo "cleanup $DEPLOY_FILE"; + if [ -f ${DEPLOY_FILE} ]; then + if [ -f ${BACKUP_FILE} ]; then + echo "backup found: ${BACKUP_FILE} going to replace it"; + rm ${BACKUP_FILE}; + fi + mv ${DEPLOY_FILE} ${BACKUP_FILE}; + else + echo "deploy file empty" + fi + ''' +} \ No newline at end of file From 4ae533206f745975bf12a2a4dbbb2e2d41e2a922 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 6 May 2022 16:22:10 +0200 Subject: [PATCH 06/52] fix deploy command --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1de35d3..54cb7f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -211,7 +211,7 @@ def deploy(String service, String version, String host){ cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/; git pull; cd CD; - ./deployService..sh $service $version $host + ./deployService.sh $service $version $host """) } From 1bd81d38ebaa9cb3fed0a1c2cc0b0c523ce6ff93 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 6 May 2022 16:35:48 +0200 Subject: [PATCH 07/52] change agent label to CI ( just a test) --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 54cb7f0..05eb322 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ backupList = agent_root_folder+'/'+agent_deploy_backup_filename; pipeline { agent { - label 'CD' + label 'CI' } triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) From 9f33b6385e9efb7d6e965364829e622dd2ca985c Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 6 May 2022 16:40:56 +0200 Subject: [PATCH 08/52] restored agent label CD --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 05eb322..54cb7f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ backupList = agent_root_folder+'/'+agent_deploy_backup_filename; pipeline { agent { - label 'CI' + label 'CD' } triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) From b7785e72f1170d6162db93aa24b646e67aa54c95 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 12:39:33 +0200 Subject: [PATCH 09/52] change agent label to deploy --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 54cb7f0..4e2ee36 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ backupList = agent_root_folder+'/'+agent_deploy_backup_filename; pipeline { agent { - label 'CD' + label 'deploy' } triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) From d866f93a8a23969f34f9f808777f72e064d06205 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 12:56:25 +0200 Subject: [PATCH 10/52] test ansicolor plugin directly on pipeline --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4e2ee36..eb5249f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,6 +28,9 @@ backupList = agent_root_folder+'/'+agent_deploy_backup_filename; pipeline { agent { label 'deploy' + options { + ansiColor('xterm') + } } triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) @@ -64,6 +67,7 @@ pipeline { } steps { echo 'Cron build enabled. Deploy from system ongoing' + echo '\033[34mHello\033[0m \033[33mcolorful\033[0m \033[35mworld!\033[0m' script { // parse the report and extract the data def components = parseCSVList(deployList) @@ -211,6 +215,7 @@ def deploy(String service, String version, String host){ cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/; git pull; cd CD; + echo '\033[34mStarting\033[0m \033[33mAnsible\033[0m \033[35mWorld\033[0m' ./deployService.sh $service $version $host """) } From 97ff85b943d568480417bab2ccd0499bcc4faf4a Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 13:01:55 +0200 Subject: [PATCH 11/52] fix ansicolor plugin declaration --- Jenkinsfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eb5249f..6e11b96 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,10 +28,11 @@ backupList = agent_root_folder+'/'+agent_deploy_backup_filename; pipeline { agent { label 'deploy' - options { - ansiColor('xterm') - } } + options { + ansiColor('xterm') + } + triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) // cron('H/15 * * * *') @@ -220,6 +221,12 @@ def deploy(String service, String version, String host){ """) } +def checkup(String service, String version, String host){ + sh(""" + exit 0; + ) +} + def cleanup(def DEPLOY_FILE, def BACKUP_FILE){ sh ''' echo "cleanup $DEPLOY_FILE"; From 5ced6872dacedba21fad15f3e845eb545d5bf238 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 15:42:54 +0200 Subject: [PATCH 12/52] fix sintax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6e11b96..a05e14b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -224,7 +224,7 @@ def deploy(String service, String version, String host){ def checkup(String service, String version, String host){ sh(""" exit 0; - ) + """) } def cleanup(def DEPLOY_FILE, def BACKUP_FILE){ From ec2f653223a6575821326ef72ba635dd3e220abb Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 16:06:17 +0200 Subject: [PATCH 13/52] add status code return --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a05e14b..e362a10 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,7 +131,8 @@ pipeline { steps { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - deploy("${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}"); } } @@ -212,13 +213,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/; + def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/; git pull; cd CD; - echo '\033[34mStarting\033[0m \033[33mAnsible\033[0m \033[35mWorld\033[0m' + echo \'\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m\' ./deployService.sh $service $version $host - """) + ", returnStdout: true): } def checkup(String service, String version, String host){ From 92833db6e4e3343778bc5b8055f62d58f50ba904 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 16:29:43 +0200 Subject: [PATCH 14/52] fix sintax --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e362a10..29ca6cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -216,9 +216,9 @@ def deploy(String service, String version, String host){ def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/; git pull; cd CD; - echo \'\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m\' + echo '\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m' ./deployService.sh $service $version $host - ", returnStdout: true): + ", returnStdout: true); } def checkup(String service, String version, String host){ From 5cccfc8e3a66faa2b4beaa81a714b4dd4ad9e266 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 16:36:44 +0200 Subject: [PATCH 15/52] fix sintax --- Jenkinsfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 29ca6cd..51c3811 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -213,12 +213,7 @@ 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); - def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/; - git pull; - cd CD; - echo '\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m' - ./deployService.sh $service $version $host - ", returnStdout: true); + def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/;git pull;cd CD;echo '\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m';./deployService.sh $service $version $host", returnStdout: true); } def checkup(String service, String version, String host){ From 4f5699caf6fc477ac0bc6226bf5decaa20f5b4a5 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 16:49:22 +0200 Subject: [PATCH 16/52] add println and comments --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 51c3811..30ef5e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -209,13 +209,17 @@ 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); def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/;git pull;cd CD;echo '\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m';./deployService.sh $service $version $host", returnStdout: true); + println("Deploy ended with status: "+statusCode); + sh(""" + echo " last exit code $?"; + """) } +//Implement a new method in order to check the input parameters def checkup(String service, String version, String host){ sh(""" exit 0; From db1c8ec581dd39bd692b91e9e6b39f4c1834715c Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 16:55:40 +0200 Subject: [PATCH 17/52] fix sintax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 30ef5e8..246b0b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -215,7 +215,7 @@ def deploy(String service, String version, String host){ def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/;git pull;cd CD;echo '\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m';./deployService.sh $service $version $host", returnStdout: true); println("Deploy ended with status: "+statusCode); sh(""" - echo " last exit code $?"; + echo " last exit code \$?"; """) } From 3550005598a9ff4450ccb0c6f2b2c9962c778bef Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 17:03:28 +0200 Subject: [PATCH 18/52] restored CD agent for testing --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 246b0b2..5ec708d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ backupList = agent_root_folder+'/'+agent_deploy_backup_filename; pipeline { agent { - label 'deploy' + label 'CD' } options { ansiColor('xterm') @@ -212,7 +212,7 @@ 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); - def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/;git pull;cd CD;echo '\\033[34mStarting\\033[0m \\033[33mAnsible\\033[0m \\033[35mWorld\\033[0m';./deployService.sh $service $version $host", returnStdout: true); + def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/;git pull;cd CD;echo '\033[34mStarting\033[0m \033[33mAnsible\033[0m \033[35mWorld\033[0m';./deployService.sh $service $version $host;", returnStdout: true); println("Deploy ended with status: "+statusCode); sh(""" echo " last exit code \$?"; From c116e1265d2f9cc867e2e2b2375293d649fea6be Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 9 May 2022 17:20:42 +0200 Subject: [PATCH 19/52] fix sintax --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5ec708d..71189ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -130,11 +130,13 @@ pipeline { } steps { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" - catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); - deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); - } - + ansiColor("xterm") { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + } + } + } } } From 6ca6c5ad89ba8f0978ee3261a267e074efab3587 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 10:50:15 +0200 Subject: [PATCH 20/52] add TRIGGER_CD boolean parameter. --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 71189ba..96f1e9d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,10 +44,12 @@ pipeline { } environment { AGENT_ROOT_FOLDER = "${agent_root_folder}" + DEPLOY_ROOT_FOLDER ="${agent_root_folder}/ansible-repos/ansible-playbooks/d4science-ghn-cluster/" DEPLOY_FILE = "${agent_root_folder}/${agent_deploy_filename}" BACKUP_FILE = "${agent_root_folder}/${agent_deploy_backup_filename}" TRIGGER_JOB= "${params.TRIGGER_JOB}" TRIGGER_VERSION= "${params.TRIGGER_VERSION}" + TRIGGER_CD="${params.TRIGGER_CD}" // maybe here define another param used to identify the target host. In this way the developer can change it from the job } stages { @@ -68,7 +70,6 @@ pipeline { } steps { echo 'Cron build enabled. Deploy from system ongoing' - echo '\033[34mHello\033[0m \033[33mcolorful\033[0m \033[35mworld!\033[0m' script { // parse the report and extract the data def components = parseCSVList(deployList) @@ -123,6 +124,7 @@ pipeline { stage('Deploy from job ') { when{ environment name: 'IS_CRON', value: 'False' + TRIGGER_CD; anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' @@ -214,7 +216,7 @@ 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); - def statusCode = sh( script: "cd /var/lib/jenkins/ansible-repos/ansible-playbooks/d4science-ghn-cluster/;git pull;cd CD;echo '\033[34mStarting\033[0m \033[33mAnsible\033[0m \033[35mWorld\033[0m';./deployService.sh $service $version $host;", returnStdout: true); + def statusCode = sh( script: "cd $DEPLOY_ROOT_FOLDER/;./deployService.sh $service $version $host;", returnStdout: true); println("Deploy ended with status: "+statusCode); sh(""" echo " last exit code \$?"; From c326e72b207676f649921edbde1f5c754acd2358 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 11:04:55 +0200 Subject: [PATCH 21/52] fix when condition --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 96f1e9d..3dc0e65 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -123,8 +123,8 @@ pipeline { } stage('Deploy from job ') { when{ - environment name: 'IS_CRON', value: 'False' - TRIGGER_CD; + environment name: 'IS_CRON', value: 'False'; + environment name: 'TRIGGER_CD', value: 'True'; anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' From 03453efc5ca0dd39a20fc9bddbbe2b7f56298714 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 11:22:29 +0200 Subject: [PATCH 22/52] fix when clause --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3dc0e65..a7069d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -124,7 +124,7 @@ pipeline { stage('Deploy from job ') { when{ environment name: 'IS_CRON', value: 'False'; - environment name: 'TRIGGER_CD', value: 'True'; + TRIGGER_CD True anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' From 8562a9d48e95156b26c430f731fb1e2b4bff6575 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 11:32:10 +0200 Subject: [PATCH 23/52] fix when sintax --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a7069d9..7ce9247 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -124,7 +124,9 @@ pipeline { stage('Deploy from job ') { when{ environment name: 'IS_CRON', value: 'False'; - TRIGGER_CD True + expression { + env.TRIGGER_CD.toBoolean() + } anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' From 783b3f9b9a47a263b02b811d45f59c8c2c945383 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 11:36:13 +0200 Subject: [PATCH 24/52] fix deploy_root_folder variable --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7ce9247..e49d8a3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,7 @@ pipeline { } environment { AGENT_ROOT_FOLDER = "${agent_root_folder}" - DEPLOY_ROOT_FOLDER ="${agent_root_folder}/ansible-repos/ansible-playbooks/d4science-ghn-cluster/" + DEPLOY_ROOT_FOLDER ="${agent_root_folder}/ansible-repos/ansible-playbooks/d4science-ghn-cluster/CD" DEPLOY_FILE = "${agent_root_folder}/${agent_deploy_filename}" BACKUP_FILE = "${agent_root_folder}/${agent_deploy_backup_filename}" TRIGGER_JOB= "${params.TRIGGER_JOB}" @@ -218,7 +218,7 @@ 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); - def statusCode = sh( script: "cd $DEPLOY_ROOT_FOLDER/;./deployService.sh $service $version $host;", returnStdout: true); + def statusCode = sh( script: "cd $DEPLOY_ROOT_FOLDER;./deployService.sh $service $version $host;", returnStdout: true); println("Deploy ended with status: "+statusCode); sh(""" echo " last exit code \$?"; From 28f63c3eb98aaa92d290a3b50d6355be49a2d4b3 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 11:57:09 +0200 Subject: [PATCH 25/52] add LICENSE; fix deploy exitcode --- Jenkinsfile | 2 +- LICENSE.md | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 LICENSE.md diff --git a/Jenkinsfile b/Jenkinsfile index e49d8a3..69751af 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -219,10 +219,10 @@ 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); def statusCode = sh( script: "cd $DEPLOY_ROOT_FOLDER;./deployService.sh $service $version $host;", returnStdout: true); - println("Deploy ended with status: "+statusCode); sh(""" echo " last exit code \$?"; """) + println("Deploy ended with status: "+statusCode); } //Implement a new method in order to check the input parameters diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..3af0507 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,312 @@ +# European Union Public Licence V. 1.1 + + +EUPL © the European Community 2007 + + +This European Union Public Licence (the “EUPL”) applies to the Work or Software +(as defined below) which is provided under the terms of this Licence. Any use of +the Work, other than as authorised under this Licence is prohibited (to the +extent such use is covered by a right of the copyright holder of the Work). + +The Original Work is provided under the terms of this Licence when the Licensor +(as defined below) has placed the following notice immediately following the +copyright notice for the Original Work: + +Licensed under the EUPL V.1.1 + +or has expressed by any other mean his willingness to license under the EUPL. + + + +## 1. Definitions + +In this Licence, the following terms have the following meaning: + +- The Licence: this Licence. + +- The Original Work or the Software: the software distributed and/or + communicated by the Licensor under this Licence, available as Source Code and + also as Executable Code as the case may be. + +- Derivative Works: the works or software that could be created by the Licensee, + based upon the Original Work or modifications thereof. This Licence does not + define the extent of modification or dependence on the Original Work required + in order to classify a work as a Derivative Work; this extent is determined by + copyright law applicable in the country mentioned in Article 15. + +- The Work: the Original Work and/or its Derivative Works. + +- The Source Code: the human-readable form of the Work which is the most + convenient for people to study and modify. + +- The Executable Code: any code which has generally been compiled and which is + meant to be interpreted by a computer as a program. + +- The Licensor: the natural or legal person that distributes and/or communicates + the Work under the Licence. + +- Contributor(s): any natural or legal person who modifies the Work under the + Licence, or otherwise contributes to the creation of a Derivative Work. + +- The Licensee or “You”: any natural or legal person who makes any usage of the + Software under the terms of the Licence. + +- Distribution and/or Communication: any act of selling, giving, lending, + renting, distributing, communicating, transmitting, or otherwise making + available, on-line or off-line, copies of the Work or providing access to its + essential functionalities at the disposal of any other natural or legal + person. + + + +## 2. Scope of the rights granted by the Licence + +The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, +sub-licensable licence to do the following, for the duration of copyright vested +in the Original Work: + +- use the Work in any circumstance and for all usage, reproduce the Work, modify +- the Original Work, and make Derivative Works based upon the Work, communicate +- to the public, including the right to make available or display the Work or +- copies thereof to the public and perform publicly, as the case may be, the +- Work, distribute the Work or copies thereof, lend and rent the Work or copies +- thereof, sub-license rights in the Work or copies thereof. + +Those rights can be exercised on any media, supports and formats, whether now +known or later invented, as far as the applicable law permits so. + +In the countries where moral rights apply, the Licensor waives his right to +exercise his moral right to the extent allowed by law in order to make effective +the licence of the economic rights here above listed. + +The Licensor grants to the Licensee royalty-free, non exclusive usage rights to +any patents held by the Licensor, to the extent necessary to make use of the +rights granted on the Work under this Licence. + + + +## 3. Communication of the Source Code + +The Licensor may provide the Work either in its Source Code form, or as +Executable Code. If the Work is provided as Executable Code, the Licensor +provides in addition a machine-readable copy of the Source Code of the Work +along with each copy of the Work that the Licensor distributes or indicates, in +a notice following the copyright notice attached to the Work, a repository where +the Source Code is easily and freely accessible for as long as the Licensor +continues to distribute and/or communicate the Work. + + + +## 4. Limitations on copyright + +Nothing in this Licence is intended to deprive the Licensee of the benefits from +any exception or limitation to the exclusive rights of the rights owners in the +Original Work or Software, of the exhaustion of those rights or of other +applicable limitations thereto. + + + +## 5. Obligations of the Licensee + +The grant of the rights mentioned above is subject to some restrictions and +obligations imposed on the Licensee. Those obligations are the following: + +Attribution right: the Licensee shall keep intact all copyright, patent or +trademarks notices and all notices that refer to the Licence and to the +disclaimer of warranties. The Licensee must include a copy of such notices and a +copy of the Licence with every copy of the Work he/she distributes and/or +communicates. The Licensee must cause any Derivative Work to carry prominent +notices stating that the Work has been modified and the date of modification. + +Copyleft clause: If the Licensee distributes and/or communicates copies of the +Original Works or Derivative Works based upon the Original Work, this +Distribution and/or Communication will be done under the terms of this Licence +or of a later version of this Licence unless the Original Work is expressly +distributed only under this version of the Licence. The Licensee (becoming +Licensor) cannot offer or impose any additional terms or conditions on the Work +or Derivative Work that alter or restrict the terms of the Licence. + +Compatibility clause: If the Licensee Distributes and/or Communicates Derivative +Works or copies thereof based upon both the Original Work and another work +licensed under a Compatible Licence, this Distribution and/or Communication can +be done under the terms of this Compatible Licence. For the sake of this clause, +“Compatible Licence” refers to the licences listed in the appendix attached to +this Licence. Should the Licensee’s obligations under the Compatible Licence +conflict with his/her obligations under this Licence, the obligations of the +Compatible Licence shall prevail. + +Provision of Source Code: When distributing and/or communicating copies of the +Work, the Licensee will provide a machine-readable copy of the Source Code or +indicate a repository where this Source will be easily and freely available for +as long as the Licensee continues to distribute and/or communicate the Work. + +Legal Protection: This Licence does not grant permission to use the trade names, +trademarks, service marks, or names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the copyright notice. + + + +## 6. Chain of Authorship + +The original Licensor warrants that the copyright in the Original Work granted +hereunder is owned by him/her or licensed to him/her and that he/she has the +power and authority to grant the Licence. + +Each Contributor warrants that the copyright in the modifications he/she brings +to the Work are owned by him/her or licensed to him/her and that he/she has the +power and authority to grant the Licence. + +Each time You accept the Licence, the original Licensor and subsequent +Contributors grant You a licence to their contributions to the Work, under the +terms of this Licence. + + + +## 7. Disclaimer of Warranty + +The Work is a work in progress, which is continuously improved by numerous +contributors. It is not a finished work and may therefore contain defects or +“bugs” inherent to this type of software development. + +For the above reason, the Work is provided under the Licence on an “as is” basis +and without warranties of any kind concerning the Work, including without +limitation merchantability, fitness for a particular purpose, absence of defects +or errors, accuracy, non-infringement of intellectual property rights other than +copyright as stated in Article 6 of this Licence. + +This disclaimer of warranty is an essential part of the Licence and a condition +for the grant of any rights to the Work. + + + +## 8. Disclaimer of Liability + +Except in the cases of wilful misconduct or damages directly caused to natural +persons, the Licensor will in no event be liable for any direct or indirect, +material or moral, damages of any kind, arising out of the Licence or of the use +of the Work, including without limitation, damages for loss of goodwill, work +stoppage, computer failure or malfunction, loss of data or any commercial +damage, even if the Licensor has been advised of the possibility of such +damage. However, the Licensor will be liable under statutory product liability +laws as far such laws apply to the Work. + + + +## 9. Additional agreements + +While distributing the Original Work or Derivative Works, You may choose to +conclude an additional agreement to offer, and charge a fee for, acceptance of +support, warranty, indemnity, or other liability obligations and/or services +consistent with this Licence. However, in accepting such obligations, You may +act only on your own behalf and on your sole responsibility, not on behalf of +the original Licensor or any other Contributor, and only if You agree to +indemnify, defend, and hold each Contributor harmless for any liability incurred +by, or claims asserted against such Contributor by the fact You have accepted +any such warranty or additional liability. + + + +## 10. Acceptance of the Licence + +The provisions of this Licence can be accepted by clicking on an icon “I agree” +placed under the bottom of a window displaying the text of this Licence or by +affirming consent in any other similar way, in accordance with the rules of +applicable law. Clicking on that icon indicates your clear and irrevocable +acceptance of this Licence and all of its terms and conditions. + +Similarly, you irrevocably accept this Licence and all of its terms and +conditions by exercising any rights granted to You by Article 2 of this Licence, +such as the use of the Work, the creation by You of a Derivative Work or the +Distribution and/or Communication by You of the Work or copies thereof. + + + +## 11. Information to the public + +In case of any Distribution and/or Communication of the Work by means of +electronic communication by You (for example, by offering to download the Work +from a remote location) the distribution channel or media (for example, a +website) must at least provide to the public the information requested by the +applicable law regarding the Licensor, the Licence and the way it may be +accessible, concluded, stored and reproduced by the Licensee. + + + +## 12. Termination of the Licence + +The Licence and the rights granted hereunder will terminate automatically upon +any breach by the Licensee of the terms of the Licence. + +Such a termination will not terminate the licences of any person who has +received the Work from the Licensee under the Licence, provided such persons +remain in full compliance with the Licence. + + + +## 13. Miscellaneous + +Without prejudice of Article 9 above, the Licence represents the complete +agreement between the Parties as to the Work licensed hereunder. + +If any provision of the Licence is invalid or unenforceable under applicable +law, this will not affect the validity or enforceability of the Licence as a +whole. Such provision will be construed and/or reformed so as necessary to make +it valid and enforceable. + +The European Commission may publish other linguistic versions and/or new +versions of this Licence, so far this is required and reasonable, without +reducing the scope of the rights granted by the Licence. New versions of the +Licence will be published with a unique version number. + +All linguistic versions of this Licence, approved by the European Commission, +have identical value. Parties can take advantage of the linguistic version of +their choice. + + + +## 14. Jurisdiction + +Any litigation resulting from the interpretation of this License, arising +between the European Commission, as a Licensor, and any Licensee, will be +subject to the jurisdiction of the Court of Justice of the European Communities, +as laid down in article 238 of the Treaty establishing the European Community. + +Any litigation arising between Parties, other than the European Commission, and +resulting from the interpretation of this License, will be subject to the +exclusive jurisdiction of the competent court where the Licensor resides or +conducts its primary business. + + + +## 15. Applicable Law + +This Licence shall be governed by the law of the European Union country where +the Licensor resides or has his registered office. + +This licence shall be governed by the Belgian law if: + +- a litigation arises between the European Commission, as a Licensor, and any +- Licensee; the Licensor, other than the European Commission, has no residence +- or registered office inside a European Union country. + + + +## Appendix + + + +“Compatible Licences” according to article 5 EUPL are: + + +- GNU General Public License (GNU GPL) v. 2 + +- Open Software License (OSL) v. 2.1, v. 3.0 + +- Common Public License v. 1.0 + +- Eclipse Public License v. 1.0 + +- Cecill v. 2.0 + From 10ec47cbe544bdb2f964227be565cf1f322aea2f Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 14:16:54 +0200 Subject: [PATCH 26/52] add check on snapshot; add host field in pending job stage --- Jenkinsfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 69751af..854575d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -78,8 +78,8 @@ pipeline { stage(component){ println "Deploy on going of component: $component" catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - // calling the ansible dispatcher here - sh "exit 0" + checkup("${component.name}", "${component.version}", "${component.host}"); + deploy("${component.name}", "${component.version}", "${component.host}"); } } } @@ -116,7 +116,7 @@ pipeline { if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then echo "component ${TRIGGER_JOB} already added. Nothing to add." else - echo "${TRIGGER_JOB},${TRIGGER_VERSION}" >> ${DEPLOY_FILE} + echo "${TRIGGER_JOB},${TRIGGER_VERSION},${}" >> ${DEPLOY_FILE} fi ''' } @@ -127,6 +127,10 @@ pipeline { expression { env.TRIGGER_CD.toBoolean() } + expression { + return env.TRIGGER_VERSION.contains("SNAPSHOT") + } + anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' @@ -184,7 +188,8 @@ def parseCSVList(def deployList) { def fields = line.split(',') components.add([ name : fields[0], - version : fields[1] + version : fields[1], + host : fields[2] ] ) } From 9101fdf173346a126f8921077da2ab7783a1ff63 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 14:24:02 +0200 Subject: [PATCH 27/52] add check on component version into cleanup function --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 854575d..a7900e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -127,9 +127,9 @@ pipeline { expression { env.TRIGGER_CD.toBoolean() } - expression { - return env.TRIGGER_VERSION.contains("SNAPSHOT") - } +// expression { +// return env.TRIGGER_VERSION.contains("SNAPSHOT") +// } anyOf{ triggeredBy 'BuildUpstreamCause' @@ -233,7 +233,9 @@ def deploy(String service, String version, String host){ //Implement a new method in order to check the input parameters def checkup(String service, String version, String host){ sh(""" - exit 0; + if [![ "$version" == *"SNAPSHOT"* ]]; then + exit 1; + fi """) } From 03c5fd33493a3c47e47948bd240e29af5d711735 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 14:33:39 +0200 Subject: [PATCH 28/52] fix check on version --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a7900e3..54c57c2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -233,7 +233,8 @@ def deploy(String service, String version, String host){ //Implement a new method in order to check the input parameters def checkup(String service, String version, String host){ sh(""" - if [![ "$version" == *"SNAPSHOT"* ]]; then + if [![ "$version" ~= *"SNAPSHOT"* ]]; then + echo"This is not a snapshot version: $version" exit 1; fi """) From 4639d922e113453cfd30d0c1bb3a617679167a5a Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 14:43:15 +0200 Subject: [PATCH 29/52] fix version check --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 54c57c2..a008acc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -233,7 +233,7 @@ def deploy(String service, String version, String host){ //Implement a new method in order to check the input parameters def checkup(String service, String version, String host){ sh(""" - if [![ "$version" ~= *"SNAPSHOT"* ]]; then + if [[ "$version" ~= *"SNAPSHOT"* ]]; then echo"This is not a snapshot version: $version" exit 1; fi From 26043f361be7309cc4b83c60e7f6a6ac38751d5c Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 14:55:18 +0200 Subject: [PATCH 30/52] check exit code on checkup function --- Jenkinsfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a008acc..65810ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -233,10 +233,7 @@ def deploy(String service, String version, String host){ //Implement a new method in order to check the input parameters def checkup(String service, String version, String host){ sh(""" - if [[ "$version" ~= *"SNAPSHOT"* ]]; then - echo"This is not a snapshot version: $version" - exit 1; - fi + exit 1; """) } From 977c022cc0d4d48ce362408eb0b6deb464482a45 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:12:07 +0200 Subject: [PATCH 31/52] fix check version --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 65810ce..0a0d1d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -233,7 +233,10 @@ def deploy(String service, String version, String host){ //Implement a new method in order to check the input parameters def checkup(String service, String version, String host){ sh(""" - exit 1; + case "$version" in + **SNAPSHOT) echo "version contains SNAPSHOT" ;; + * ) exit 1;; + esac """) } From 213ffe70ad06ed04c5fbf5252356bf1f4b4b530b Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:16:48 +0200 Subject: [PATCH 32/52] fix works. Add println --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0a0d1d3..6525585 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -235,7 +235,7 @@ def checkup(String service, String version, String host){ sh(""" case "$version" in **SNAPSHOT) echo "version contains SNAPSHOT" ;; - * ) exit 1;; + * ) echo "version without SNAPSHOT. EXIT WITHOUT DEPLOY " exit 1;; esac """) } From b7853644e0cb8182f4c4d0e0252ce3a52555d634 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:22:56 +0200 Subject: [PATCH 33/52] fix print --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6525585..4fcb4c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -235,7 +235,7 @@ def checkup(String service, String version, String host){ sh(""" case "$version" in **SNAPSHOT) echo "version contains SNAPSHOT" ;; - * ) echo "version without SNAPSHOT. EXIT WITHOUT DEPLOY " exit 1;; + * ) echo "version without SNAPSHOT. EXIT WITHOUT DEPLOY "; exit 1;; esac """) } From 5fca2943ed9d750eaffc1bac6c44f04a3aca39f9 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:28:02 +0200 Subject: [PATCH 34/52] rename function --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4fcb4c4..d3601d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { echo 'Cron build enabled. Deploy from system ongoing' script { // parse the report and extract the data - def components = parseCSVList(deployList) + def components = estractComponentsFromCSV(deployList) if (components.size() > 0) { for (component in components) { stage(component){ @@ -177,8 +177,8 @@ pipeline { } -//parse a csv file formatted in this way: ComponentName,ComponentVersion -def parseCSVList(def deployList) { +//parse a csv file formatted in this way: ComponentName,ComponentVersion, ComponentHost +def estractComponentsFromCSV(def deployList) { def components = [] if (fileExists("${deployList}")) { echo 'file found' From 0b83e9128e1619f6f6b7e563f4212c1c95a2ee22 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:28:57 +0200 Subject: [PATCH 35/52] set cron every 15' --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d3601d4..cc3e4ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,9 +35,9 @@ pipeline { triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) -// cron('H/15 * * * *') + cron('H/15 * * * *') // 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') From da899baafd6da579fb0c4d48f474d4c4811408a4 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:34:47 +0200 Subject: [PATCH 36/52] fix trigger_host param --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cc3e4ce..c24ab5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,6 +49,7 @@ pipeline { BACKUP_FILE = "${agent_root_folder}/${agent_deploy_backup_filename}" TRIGGER_JOB= "${params.TRIGGER_JOB}" TRIGGER_VERSION= "${params.TRIGGER_VERSION}" + TRIGGER_HOST="${params.TRIGGER_HOST}" TRIGGER_CD="${params.TRIGGER_CD}" // maybe here define another param used to identify the target host. In this way the developer can change it from the job } @@ -116,7 +117,7 @@ pipeline { if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then echo "component ${TRIGGER_JOB} already added. Nothing to add." else - echo "${TRIGGER_JOB},${TRIGGER_VERSION},${}" >> ${DEPLOY_FILE} + echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} fi ''' } From ec4bbb7856cae11195cc8747a3a809fe8a7a3eed Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 15:54:13 +0200 Subject: [PATCH 37/52] catch error set to UNSTABLE for system stage --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c24ab5d..d414d7b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -78,7 +78,7 @@ pipeline { for (component in components) { stage(component){ println "Deploy on going of component: $component" - catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { checkup("${component.name}", "${component.version}", "${component.host}"); deploy("${component.name}", "${component.version}", "${component.host}"); } From 56fb8bd136bcc858a857b76e3b325c2219326e03 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 10 May 2022 16:01:16 +0200 Subject: [PATCH 38/52] set to UNSTABLE when a job is added to pending list --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d414d7b..50be665 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -120,6 +120,11 @@ pipeline { echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} fi ''' + catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { + sh(""" + exit 126; + """) + } } } stage('Deploy from job ') { From 2d430bd8cd624e71e1f737e1a9c701a60873a667 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 11 May 2022 09:16:10 +0200 Subject: [PATCH 39/52] change cron setting --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 50be665..7fa471c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,11 +35,11 @@ pipeline { triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) - cron('H/15 * * * *') +// cron('H/15 * * * *') // once a day on the 1st and 15th of every month // 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') + cron('H H(9-16)/2 * * 1-5') } environment { From a19122069ee4f2820025eb10f7edb331ae15b656 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 11 May 2022 10:02:40 +0200 Subject: [PATCH 40/52] changing stage names and add some comments --- Jenkinsfile | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7fa471c..b09fce0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,12 +36,10 @@ pipeline { triggers { // every fifteen minutes (perhaps at :07, :22, :37, :52) // cron('H/15 * * * *') -// once a day on the 1st and 15th of every month -// 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') - } + environment { AGENT_ROOT_FOLDER = "${agent_root_folder}" DEPLOY_ROOT_FOLDER ="${agent_root_folder}/ansible-repos/ansible-playbooks/d4science-ghn-cluster/CD" @@ -51,10 +49,10 @@ pipeline { TRIGGER_VERSION= "${params.TRIGGER_VERSION}" TRIGGER_HOST="${params.TRIGGER_HOST}" TRIGGER_CD="${params.TRIGGER_CD}" - // maybe here define another param used to identify the target host. In this way the developer can change it from the job } + stages { - stage('initialize environment') { + stage('Initialize environment') { steps { sh ''' date=`date`; @@ -91,7 +89,7 @@ pipeline { cleanup(DEPLOY_FILE,BACKUP_FILE); } } - stage('Nothing to do by System ') { + stage('Nothing to do ') { when{ allOf{ triggeredBy 'TimerTrigger' @@ -102,7 +100,7 @@ pipeline { echo 'Do Nothing: cron build disabled' } } - stage('Add new pending deploy ') { + stage('New pending deploy ') { when{ environment name: 'IS_CRON', value: 'True' anyOf{ @@ -158,7 +156,7 @@ pipeline { always { script { sh ''' - echo ' jobs currently appended:' + echo 'Sending report' ''' //cat ./${ACTION_DEPLOY_FILE}.csv } @@ -168,14 +166,14 @@ pipeline { emailext attachLog: true,//attachmentsPattern: "**/${ACTION_DEPLOY_FILE}.csv", to: 'roberto.cirillo@isti.cnr.it', - subject: "Deploy report", + 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', - subject: "[Jenkins deploy D4S] deploy ${currentBuild.fullDisplayName} failed", + subject: "[Jenkins-gCubeDeployer] deploy ${currentBuild.fullDisplayName} failed", body: "Something is wrong with ${env.BUILD_URL}" } @@ -205,27 +203,7 @@ def estractComponentsFromCSV(def deployList) { return components } -//Alternative way to append a text in a small file (not used) -def appendToFile(String fileName, String line) { - def current = "" - if (fileExists(fileName)) { - current = readFile fileName - } - writeFile file: fileName, text: current + "\n" + line -} - -/** - * Appends the footer to the deploy file. - */ -def appendFooter( def File) { - def now = new Date() - sh(""" - echo "#---" >> $File - echo "#generated by the gCubeDeploy pipeline >> $File - echo "#last update $now*" >> $File - """) -} - +//launch ansible deploy 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); @@ -245,7 +223,7 @@ def checkup(String service, String version, String host){ esac """) } - +//clean and update the local deploy file def cleanup(def DEPLOY_FILE, def BACKUP_FILE){ sh ''' echo "cleanup $DEPLOY_FILE"; From 041850e099d1e20b8ced53a813eb53e49dcee813 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 11 May 2022 10:14:01 +0200 Subject: [PATCH 41/52] small changes --- Jenkinsfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b09fce0..ca0a70b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,10 +131,6 @@ pipeline { expression { env.TRIGGER_CD.toBoolean() } -// expression { -// return env.TRIGGER_VERSION.contains("SNAPSHOT") -// } - anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' From b447e3025fa24215046dd3d30e914255dd519c9a Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 11 May 2022 12:03:07 +0200 Subject: [PATCH 42/52] fix method name --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca0a70b..bf4f368 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { echo 'Cron build enabled. Deploy from system ongoing' script { // parse the report and extract the data - def components = estractComponentsFromCSV(deployList) + def components = gettComponentsFromCSV(deployList) if (components.size() > 0) { for (component in components) { stage(component){ @@ -178,7 +178,7 @@ pipeline { //parse a csv file formatted in this way: ComponentName,ComponentVersion, ComponentHost -def estractComponentsFromCSV(def deployList) { +def getComponentsFromCSV(def deployList) { def components = [] if (fileExists("${deployList}")) { echo 'file found' From 14012029af1b5c2c908d9133f21488b2113535ed Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 11 May 2022 15:20:46 +0200 Subject: [PATCH 43/52] update README file --- README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 24d298a..7cf8064 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,25 @@ # Pipeline-gCubeDeploy -This is a test: try to implements a deply pipeline integrated with ansible. +Jenkins Pipeline script to manage one or more gCube components deployment -## USAGE TIPS: +## Requirements +* [Jenkins](https://jenkins.io/) ver. 2.164.2 or newer +* [Pipeline plugin](https://wiki.jenkins.io/display/JENKINS/Pipeline+Plugin) +* [Pipeline: Maven](https://plugins.jenkins.io/pipeline-maven) +* [Pipeline: Basic Steps](https://plugins.jenkins.io/workflow-basic-steps) +* [Email Extension](https://plugins.jenkins.io/email-ext) (to send emails with attachments) +* Jenkins slave(s) configured with Ansible ver. 2.9.27 or newer +* One or more Jenkins agents labeled as 'CD' +## Expected parameters + + +## References +* [Jenkins Pipeline](https://jenkins.io/doc/book/pipeline/) +* [Pipeline Syntax](https://jenkins.io/doc/book/pipeline/syntax/) + +## Wiki doc + + +## License +This project is licensed under the [EUPL V.1.1 License](LICENSE.md). From 0788fa85171030f947b52cb0836ca480de775647 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Thu, 12 May 2022 09:46:15 +0200 Subject: [PATCH 44/52] fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7cf8064..36a46a5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Pipeline-gCubeDeploy +# Pipeline-gCubeDeployer Jenkins Pipeline script to manage one or more gCube components deployment From 3028ffc459ba5683f8a17cc839eb50fed5700b4e Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 10 Jun 2022 11:05:21 +0200 Subject: [PATCH 45/52] README change slave/agent --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36a46a5..0588485 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Jenkins Pipeline script to manage one or more gCube components deployment * [Pipeline: Maven](https://plugins.jenkins.io/pipeline-maven) * [Pipeline: Basic Steps](https://plugins.jenkins.io/workflow-basic-steps) * [Email Extension](https://plugins.jenkins.io/email-ext) (to send emails with attachments) -* Jenkins slave(s) configured with Ansible ver. 2.9.27 or newer +* Jenkins agent(s) configured with Ansible ver. 2.9.27 or newer * One or more Jenkins agents labeled as 'CD' ## Expected parameters From 4f2aeb59200c807f81b4ce953c07834811c15815 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 21 Jun 2022 15:47:38 +0200 Subject: [PATCH 46/52] add input parameters in order to launch the pipeline manually; add new stage dedicated to the manually execution --- Jenkinsfile | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf4f368..ddf305a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,6 +25,15 @@ if (params.deployFile) { } backupList = agent_root_folder+'/'+agent_deploy_backup_filename; +//locate the targetHost file +//String targetHostURL = "https://code-repo.d4science.org/gCubeCI/gCubeDeployer/raw/branch/master/open/gcube-${gCube_release_version}.yaml" +//if (verbose) +// println "Querying ${targetHostURL}" +//load the release file +//def text = targetHostURL.toURL().getText() + + + pipeline { agent { label 'CD' @@ -50,7 +59,23 @@ pipeline { TRIGGER_HOST="${params.TRIGGER_HOST}" TRIGGER_CD="${params.TRIGGER_CD}" } - + + parameters { + string(name: 'TRIGGER_JOB', + defaultValue: '', + description: 'Name of the service or job to deploy') + string(name: 'TRIGGER_VERSION', + defaultValue: '', + description: 'service version to deploy') + string(name: 'TRIGGER_HOST', + defaultValue: '', + description: 'Target Host / Host group where deploy the service') + booleanParam(name: 'TRIGGER_CD', + defaultValue: true, + description: 'Set to false to avoid current deploy') + + } + stages { stage('Initialize environment') { steps { @@ -71,7 +96,7 @@ pipeline { echo 'Cron build enabled. Deploy from system ongoing' script { // parse the report and extract the data - def components = gettComponentsFromCSV(deployList) + def components = getComponentsFromCSV(deployList) if (components.size() > 0) { for (component in components) { stage(component){ @@ -147,6 +172,24 @@ pipeline { } } + stage('Deploy manually ') { + when{ + allOf{ + environment name: 'IS_CRON', value: 'False'; + triggeredBy 'UserIdCause' + } + } + steps { + echo "Cron build disabled. Pipeline executed Manually. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" + ansiColor("xterm") { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + } + } + + } + } } post { always { From 8ced60db1b666d3f2fe3a5918247e6be102e1983 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 21 Jun 2022 17:24:56 +0200 Subject: [PATCH 47/52] add check on latest: if latest then deploy allowed --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index ddf305a..ea7a287 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -258,6 +258,7 @@ def checkup(String service, String version, String host){ sh(""" case "$version" in **SNAPSHOT) echo "version contains SNAPSHOT" ;; + **latest) echo "version contains latest" ;; * ) echo "version without SNAPSHOT. EXIT WITHOUT DEPLOY "; exit 1;; esac """) From 2bde8be50d3824e672469b59e58e119d61da865f Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Wed, 22 Jun 2022 17:08:41 +0200 Subject: [PATCH 48/52] WIP add deploy report input param --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ea7a287..a1e7b52 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,6 +73,9 @@ pipeline { booleanParam(name: 'TRIGGER_CD', defaultValue: true, description: 'Set to false to avoid current deploy') + string(name: 'report', + defaultValue: '', + description: 'The deploy report. Leave blank to pull the build report from Git.') } From 214dfc7c52c566e2b68bb8398bdebb13f8e39a19 Mon Sep 17 00:00:00 2001 From: "roberto.cirillo" Date: Mon, 18 Jul 2022 10:04:42 +0200 Subject: [PATCH 49/52] small comment --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index bf4f368..bc68003 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -118,6 +118,8 @@ pipeline { echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} fi ''' + + // the following catch give always an error in order to return a feedback UNSTABLE to the final user since the deploy is still not performed catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { sh(""" exit 126; From a9453e070752d00ad55a95350c30d9c90e373ba7 Mon Sep 17 00:00:00 2001 From: "roberto.cirillo" Date: Mon, 18 Jul 2022 10:08:09 +0200 Subject: [PATCH 50/52] merge conflicts --- Jenkinsfile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bc68003..09d8c31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,6 +25,15 @@ if (params.deployFile) { } backupList = agent_root_folder+'/'+agent_deploy_backup_filename; +//locate the targetHost file +//String targetHostURL = "https://code-repo.d4science.org/gCubeCI/gCubeDeployer/raw/branch/master/open/gcube-${gCube_release_version}.yaml" +//if (verbose) +// println "Querying ${targetHostURL}" +//load the release file +//def text = targetHostURL.toURL().getText() + + + pipeline { agent { label 'CD' @@ -50,7 +59,26 @@ pipeline { TRIGGER_HOST="${params.TRIGGER_HOST}" TRIGGER_CD="${params.TRIGGER_CD}" } - + + parameters { + string(name: 'TRIGGER_JOB', + defaultValue: '', + description: 'Name of the service or job to deploy') + string(name: 'TRIGGER_VERSION', + defaultValue: '', + description: 'service version to deploy') + string(name: 'TRIGGER_HOST', + defaultValue: '', + description: 'Target Host / Host group where deploy the service') + booleanParam(name: 'TRIGGER_CD', + defaultValue: true, + description: 'Set to false to avoid current deploy') + string(name: 'report', + defaultValue: '', + description: 'The deploy report. Leave blank to pull the build report from Git.') + + } + stages { stage('Initialize environment') { steps { @@ -71,7 +99,7 @@ pipeline { echo 'Cron build enabled. Deploy from system ongoing' script { // parse the report and extract the data - def components = gettComponentsFromCSV(deployList) + def components = getComponentsFromCSV(deployList) if (components.size() > 0) { for (component in components) { stage(component){ @@ -149,6 +177,24 @@ pipeline { } } + stage('Deploy manually ') { + when{ + allOf{ + environment name: 'IS_CRON', value: 'False'; + triggeredBy 'UserIdCause' + } + } + steps { + echo "Cron build disabled. Pipeline executed Manually. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" + ansiColor("xterm") { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + } + } + + } + } } post { always { @@ -217,6 +263,7 @@ def checkup(String service, String version, String host){ sh(""" case "$version" in **SNAPSHOT) echo "version contains SNAPSHOT" ;; + **latest) echo "version contains latest" ;; * ) echo "version without SNAPSHOT. EXIT WITHOUT DEPLOY "; exit 1;; esac """) From c1e0f30e3ebb25040d5ee15c782f23722cbc5ca0 Mon Sep 17 00:00:00 2001 From: "roberto.cirillo" Date: Mon, 18 Jul 2022 10:10:04 +0200 Subject: [PATCH 51/52] update cron --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 09d8c31..98991e9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,7 @@ pipeline { // every fifteen minutes (perhaps at :07, :22, :37, :52) // cron('H/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') + cron('H H(9-16)/6 * * 1-5') } environment { From f6b9b58930e2bac80aa95169f103cb6cbacd1177 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 29 Jul 2022 16:46:49 +0200 Subject: [PATCH 52/52] change var name used as input param --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 98991e9..3ad9b2b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,9 +73,9 @@ pipeline { booleanParam(name: 'TRIGGER_CD', defaultValue: true, description: 'Set to false to avoid current deploy') - string(name: 'report', + string(name: 'gCube_release_version', defaultValue: '', - description: 'The deploy report. Leave blank to pull the build report from Git.') + description: 'Leave blank if executed outside gCube release') }