From fbbb2a73f9e66d06914b758c8f16d845da42202d Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 19:57:58 +0000 Subject: [PATCH 01/34] first file update for multilable feature into main Jenkinsfile --- ci/Jenkinsfile | 66 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index eba25ca99a..39231162d9 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -4,7 +4,8 @@ def HOME = 'none' def caseList = '' // Location of the custom workspaces for each machine in the CI system. They are persitent for each iteration of the PR. def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/stmp/CI/HERCULES'] -def repo_url = 'git@github.com:NOAA-EMC/global-workflow.git' +//def repo_url = 'git@github.com:NOAA-EMC/global-workflow.git' +def repo_url = 'git@github.com:TerrenceMcGuinness-NOAA/global-workflow.git' def STATUS = 'Passed' pipeline { @@ -21,31 +22,58 @@ pipeline { // Each Jenknis Node is connected to said machine via an JAVA agent via an ssh tunnel // no op 2 - stage('Get Machine') { + stage('1. Get Machine') { + //when { + // //expression { env.BUILD_CAUSE != 'UPSTREAMTRIGGER' } + // expression { env.Node == 'built-in' } + //} agent { label 'built-in' } steps { script { - machine = 'none' - for (label in pullRequest.labels) { - echo "Label: ${label}" - if ((label.matches('CI-Hera-Ready'))) { - machine = 'hera' - } else if ((label.matches('CI-Orion-Ready'))) { - machine = 'orion' - } else if ((label.matches('CI-Hercules-Ready'))) { - machine = 'hercules' + if ( env.Node != 'built-in' ) { + echo "machine being set to value passed to this spawned job" + echo "passed machine: ${params.machine}" + machine = params.machine + } else { + echo "This is parent job and testing the listing out of nodes matching labels:" + for (label in pullRequest.labels) { + matcher = label =~ /CI-(.*?)-Ready/ + if (matcher.matches()) { + def Machine_name = matcher[0][1] + jenkins.model.Jenkins.get().computers.each { c -> + if (c.node.selfLabel.name == "${Machine_name}-EMC") { + run_nodes.add(c.node.selfLabel.name) + } + } + } } - } // createing a second machine varible with first letter capital - // because the first letter of the machine name is captitalized in the GitHub labels - Machine = machine[0].toUpperCase() + machine.substring(1) + // Spawning all the jobs on the nodes matching the labels + // exept for the last one which will be run on the parent job + if (run_nodes.size() > 1) { + run_nodes.init().each { node -> + echo "Spawning job on node: ${node}" + def machine_name = node.split('-')[0].toLowerCase() + build job: "/global-workflow/EMC-Pipelines/PR-${env.CHANGE_ID}", parameters: [ + string(name: 'machine', value: ${machine_name}), + string(name: 'Node', value: ${node}) ], + wait: false + } + machine = run_nodes.last().split('-')[0].toLowerCase() + echo "Running parent job: ${machine}" + } else { + machine = run_nodes[0].split('-')[0].toLowerCase() + echo "Running only the parent job: ${machine}" + } + } } } } - stage('Get Common Workspace') { + stage('2. Get Common Workspace') { agent { label "${machine}-emc" } steps { script { + Machine = machine[0].toUpperCase() + machine.substring(1) ws("${custom_workspace[machine]}/${env.CHANGE_ID}") { properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in', 'Hera-EMC', 'Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])]) HOME = "${WORKSPACE}" @@ -57,7 +85,7 @@ pipeline { } } - stage('Build System') { + stage('3. Build System') { matrix { agent { label "${machine}-emc" } //options { @@ -141,7 +169,7 @@ pipeline { } } - stage('Run Tests') { + stage('4. Run Tests') { failFast false matrix { agent { label "${machine}-emc" } @@ -216,7 +244,7 @@ pipeline { STATUS = 'Failed' try { sh(script: """${GH} pr edit ${env.CHANGE_ID} --repo ${repo_url} --remove-label "CI-${Machine}-Running" --add-label "CI-${Machine}-${STATUS}" """, returnStatus: true) - sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Experiment ${Case} **FAILED** on ${Machine}\nin\\`${HOME}/RUNTESTS/${pslot}\\`" """) + sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Experiment ${Case} **FAILED** on ${Machine} in\n\\`${HOME}/RUNTESTS/${pslot}\\`" """) } catch (Exception e) { echo "Failed to update label from Running to ${STATUS}: ${e.getMessage()}" } @@ -229,7 +257,7 @@ pipeline { } } } - stage( 'FINALIZE' ) { + stage( '5. FINALIZE' ) { when { expression { STATUS == 'Passed' From a6bb515d74d318a5e9c114977854080ecf6b861f Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 20:15:11 +0000 Subject: [PATCH 02/34] debug out env.Node as it was not flagging the parent job --- ci/Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 39231162d9..9d71a7b6b2 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -30,6 +30,8 @@ pipeline { agent { label 'built-in' } steps { script { + def run_nodes = [] + echo "env Node: ${env.Node}" if ( env.Node != 'built-in' ) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" From b8163402f3c18b0cede23e857d151799281ca407 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 20:44:08 +0000 Subject: [PATCH 03/34] damn env.Node is now nulll checking for BUILD_CAUSE --- ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 9d71a7b6b2..e682f259fc 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -32,6 +32,7 @@ pipeline { script { def run_nodes = [] echo "env Node: ${env.Node}" + echo "env BUILD_CAUSE: ${env.BUILD_CAUSE}" if ( env.Node != 'built-in' ) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" From abd87ccd19713c027bd3e50d80126c73f311f57f Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 20:54:16 +0000 Subject: [PATCH 04/34] echo out getCauses --- ci/Jenkinsfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index e682f259fc..21cc8a7314 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -23,16 +23,11 @@ pipeline { // no op 2 stage('1. Get Machine') { - //when { - // //expression { env.BUILD_CAUSE != 'UPSTREAMTRIGGER' } - // expression { env.Node == 'built-in' } - //} agent { label 'built-in' } steps { script { + echo "BUILD CAUSE: ${currentBuild.rawBuild.getCauses()[0].toString()}" def run_nodes = [] - echo "env Node: ${env.Node}" - echo "env BUILD_CAUSE: ${env.BUILD_CAUSE}" if ( env.Node != 'built-in' ) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" From 8363a2de356e9c838d5b186c943d002fdc76b552 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:09:54 +0000 Subject: [PATCH 05/34] found consice way to check for spawned jobs --- ci/Jenkinsfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 21cc8a7314..e9cbacfa9d 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -26,13 +26,18 @@ pipeline { agent { label 'built-in' } steps { script { - echo "BUILD CAUSE: ${currentBuild.rawBuild.getCauses()[0].toString()}" - def run_nodes = [] - if ( env.Node != 'built-in' ) { + + def causes = currentBuild.rawBuild.getCauses() + def isSpawnedFromAnotherJob = causes.any { cause -> + cause instanceof hudson.model.Cause.UpstreamCause + } + + if (isSpawnedFromAnotherJob) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" machine = params.machine } else { + def run_nodes = [] echo "This is parent job and testing the listing out of nodes matching labels:" for (label in pullRequest.labels) { matcher = label =~ /CI-(.*?)-Ready/ From 54343a71aec68bfda90ce57b184ed3cc5a4ae151 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:19:46 +0000 Subject: [PATCH 06/34] moved scope of run_nodes --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index e9cbacfa9d..a5454e3886 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -32,12 +32,12 @@ pipeline { cause instanceof hudson.model.Cause.UpstreamCause } + def run_nodes = [] if (isSpawnedFromAnotherJob) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" machine = params.machine } else { - def run_nodes = [] echo "This is parent job and testing the listing out of nodes matching labels:" for (label in pullRequest.labels) { matcher = label =~ /CI-(.*?)-Ready/ From a6f023bf3d05fba8ade4827c93a2438665678a42 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:26:45 +0000 Subject: [PATCH 07/34] are we failing on pullRequests again --- ci/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index a5454e3886..87f5511f58 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -38,8 +38,9 @@ pipeline { echo "passed machine: ${params.machine}" machine = params.machine } else { - echo "This is parent job and testing the listing out of nodes matching labels:" + echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { + echo "Checking label: ${label}" matcher = label =~ /CI-(.*?)-Ready/ if (matcher.matches()) { def Machine_name = matcher[0][1] From 8007c972e8ad70aafe851bec52297b3893ca9ac9 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:34:09 +0000 Subject: [PATCH 08/34] adding more debug statments for nodes found and spawning --- ci/Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 87f5511f58..06dd10e372 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -53,10 +53,15 @@ pipeline { } // Spawning all the jobs on the nodes matching the labels // exept for the last one which will be run on the parent job + echo "Found ${run_nodes.size()} nodes to run the job(s)" + for (node in run_nodes) { + echo "Node: ${node}" + } if (run_nodes.size() > 1) { run_nodes.init().each { node -> echo "Spawning job on node: ${node}" def machine_name = node.split('-')[0].toLowerCase() + echo "Spawning job on machine: ${machine_name}" build job: "/global-workflow/EMC-Pipelines/PR-${env.CHANGE_ID}", parameters: [ string(name: 'machine', value: ${machine_name}), string(name: 'Node', value: ${node}) ], From f6a73e724c041ddd81e7128f1585951e89da7cf8 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:41:23 +0000 Subject: [PATCH 09/34] testing each llooop --- ci/Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 06dd10e372..92b1ca9d32 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -57,6 +57,10 @@ pipeline { for (node in run_nodes) { echo "Node: ${node}" } + echo "Testing init loop" + run_nodes.init().each { node -> + echo "Node: ${node}" + } if (run_nodes.size() > 1) { run_nodes.init().each { node -> echo "Spawning job on node: ${node}" From 2c0e9fe4d1448297eecc913ba2718a5e5b8aadd9 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:50:20 +0000 Subject: [PATCH 10/34] just trying two nodes --- ci/Jenkinsfile | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 92b1ca9d32..7b97497de9 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -52,20 +52,10 @@ pipeline { } } // Spawning all the jobs on the nodes matching the labels - // exept for the last one which will be run on the parent job - echo "Found ${run_nodes.size()} nodes to run the job(s)" - for (node in run_nodes) { - echo "Node: ${node}" - } - echo "Testing init loop" - run_nodes.init().each { node -> - echo "Node: ${node}" - } if (run_nodes.size() > 1) { run_nodes.init().each { node -> - echo "Spawning job on node: ${node}" def machine_name = node.split('-')[0].toLowerCase() - echo "Spawning job on machine: ${machine_name}" + echo "Spawning job on node: ${node} with machine name: ${machine_name}" build job: "/global-workflow/EMC-Pipelines/PR-${env.CHANGE_ID}", parameters: [ string(name: 'machine', value: ${machine_name}), string(name: 'Node', value: ${node}) ], From 2fc9f2cdfe8093f84cb0aea22cd90d17e35132d2 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 21:57:02 +0000 Subject: [PATCH 11/34] added debug running common works space on machine in question --- ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 7b97497de9..122b2d8042 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -77,6 +77,7 @@ pipeline { steps { script { Machine = machine[0].toUpperCase() + machine.substring(1) + echo "Getting Common Workspace for ${Machine}" ws("${custom_workspace[machine]}/${env.CHANGE_ID}") { properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in', 'Hera-EMC', 'Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])]) HOME = "${WORKSPACE}" From 794aca14d56db92c870cc6741fd8f3550c8cff40 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:04:55 +0000 Subject: [PATCH 12/34] test machien assiginment --- ci/Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 122b2d8042..2b1d0387f9 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -52,6 +52,9 @@ pipeline { } } // Spawning all the jobs on the nodes matching the labels + echo "is this failing" + test_machine = run_nodes.last().split('-')[0].toLowerCase() + echo "Running parent job with entent to run: ${test_machine}" if (run_nodes.size() > 1) { run_nodes.init().each { node -> def machine_name = node.split('-')[0].toLowerCase() From 67002924a49733bdc7a8585f67d775789d61a531 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:20:52 +0000 Subject: [PATCH 13/34] echo start of get machine --- ci/Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 2b1d0387f9..67548ec57d 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -27,6 +27,8 @@ pipeline { steps { script { + echo "entering Get Machine stage" + def causes = currentBuild.rawBuild.getCauses() def isSpawnedFromAnotherJob = causes.any { cause -> cause instanceof hudson.model.Cause.UpstreamCause From 435d57fdfd839236144832c2e059b0cd61db1f77 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:29:07 +0000 Subject: [PATCH 14/34] still tryinig anything at this point --- ci/Jenkinsfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 67548ec57d..437c10d0cf 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -29,13 +29,14 @@ pipeline { echo "entering Get Machine stage" - def causes = currentBuild.rawBuild.getCauses() - def isSpawnedFromAnotherJob = causes.any { cause -> - cause instanceof hudson.model.Cause.UpstreamCause - } + // def causes = currentBuild.rawBuild.getCauses() + // def isSpawnedFromAnotherJob = causes.any { cause -> + // cause instanceof hudson.model.Cause.UpstreamCause + // } def run_nodes = [] - if (isSpawnedFromAnotherJob) { + // if (isSpawnedFromAnotherJob) { + if (false) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" machine = params.machine From 8fa8887efc9e68df9dbe90bfec06e94d2ef12498 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:39:24 +0000 Subject: [PATCH 15/34] it was the regex object I bet --- ci/Jenkinsfile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 437c10d0cf..88275b50af 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -27,16 +27,13 @@ pipeline { steps { script { - echo "entering Get Machine stage" - - // def causes = currentBuild.rawBuild.getCauses() - // def isSpawnedFromAnotherJob = causes.any { cause -> - // cause instanceof hudson.model.Cause.UpstreamCause - // } + def causes = currentBuild.rawBuild.getCauses() + def isSpawnedFromAnotherJob = causes.any { cause -> + cause instanceof hudson.model.Cause.UpstreamCause + } def run_nodes = [] - // if (isSpawnedFromAnotherJob) { - if (false) { + if (isSpawnedFromAnotherJob) { echo "machine being set to value passed to this spawned job" echo "passed machine: ${params.machine}" machine = params.machine @@ -46,7 +43,7 @@ pipeline { echo "Checking label: ${label}" matcher = label =~ /CI-(.*?)-Ready/ if (matcher.matches()) { - def Machine_name = matcher[0][1] + Machine_name = matcher[0][1].toString() jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { run_nodes.add(c.node.selfLabel.name) @@ -55,9 +52,7 @@ pipeline { } } // Spawning all the jobs on the nodes matching the labels - echo "is this failing" test_machine = run_nodes.last().split('-')[0].toLowerCase() - echo "Running parent job with entent to run: ${test_machine}" if (run_nodes.size() > 1) { run_nodes.init().each { node -> def machine_name = node.split('-')[0].toLowerCase() From 427620242db00bf9461bdb4eccf25a43faa10cc1 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:45:41 +0000 Subject: [PATCH 16/34] surgecly removeing reg --- ci/Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 88275b50af..735911dff8 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -41,11 +41,13 @@ pipeline { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { echo "Checking label: ${label}" - matcher = label =~ /CI-(.*?)-Ready/ - if (matcher.matches()) { - Machine_name = matcher[0][1].toString() + //matcher = label =~ /CI-(.*?)-Ready/ + //if (matcher.matches()) { + if (true) { + //name = matcher[0][1].toString() + name = 'Heracles' jenkins.model.Jenkins.get().computers.each { c -> - if (c.node.selfLabel.name == "${Machine_name}-EMC") { + if (c.node.selfLabel.name == "${name}-EMC") { run_nodes.add(c.node.selfLabel.name) } } From 02977fa7ebb1b4fa415466b8f5fd33b04f46cc8d Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:47:44 +0000 Subject: [PATCH 17/34] surgecly removeing reg --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 735911dff8..f3252d0ab6 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -45,7 +45,7 @@ pipeline { //if (matcher.matches()) { if (true) { //name = matcher[0][1].toString() - name = 'Heracles' + name = 'Hercules' jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${name}-EMC") { run_nodes.add(c.node.selfLabel.name) From 5ad0c8ed3683e2be0542283e450ff8762352e371 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 22:56:05 +0000 Subject: [PATCH 18/34] assigning a matcher is a mistake --- ci/Jenkinsfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index f3252d0ab6..db2dd7c7b5 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,21 +40,17 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - echo "Checking label: ${label}" - //matcher = label =~ /CI-(.*?)-Ready/ - //if (matcher.matches()) { - if (true) { - //name = matcher[0][1].toString() - name = 'Hercules' + matcher = label =~ /CI-(.*?)-Ready/ + if (matcher.matches()) { + def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> - if (c.node.selfLabel.name == "${name}-EMC") { + if (c.node.selfLabel.name == "${Machine_name}-EMC") { run_nodes.add(c.node.selfLabel.name) } } } } // Spawning all the jobs on the nodes matching the labels - test_machine = run_nodes.last().split('-')[0].toLowerCase() if (run_nodes.size() > 1) { run_nodes.init().each { node -> def machine_name = node.split('-')[0].toLowerCase() From 49792a90a7e9e30bf585bd7768f4027d0b41e882 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:06:57 +0000 Subject: [PATCH 19/34] release the matcher --- ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index db2dd7c7b5..cb2335caea 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -50,6 +50,7 @@ pipeline { } } } + matcher = null // Spawning all the jobs on the nodes matching the labels if (run_nodes.size() > 1) { run_nodes.init().each { node -> From 0fb30e282b961fc381998fff028bb17ff4e11d02 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:10:48 +0000 Subject: [PATCH 20/34] force match to bool and test bool --- ci/Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index cb2335caea..19bbcc14e8 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,8 +40,8 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - matcher = label =~ /CI-(.*?)-Ready/ - if (matcher.matches()) { + matcher = (label ==~ /CI-(.*?)-Ready/) + if (matcher) { def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { @@ -50,7 +50,6 @@ pipeline { } } } - matcher = null // Spawning all the jobs on the nodes matching the labels if (run_nodes.size() > 1) { run_nodes.init().each { node -> From 5a6db2b2fd38c2c72d61b77b54f319b2dc10d2d6 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:14:28 +0000 Subject: [PATCH 21/34] force match to bool and test bool --- ci/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 19bbcc14e8..63b1d8389d 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,9 +40,10 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - matcher = (label ==~ /CI-(.*?)-Ready/) + matcher = label ==~ /CI-(.*?)-Ready/ if (matcher) { def Machine_name = lable.split('-')[1].toString() + echo "Machine_name: ${Machine_name}" jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { run_nodes.add(c.node.selfLabel.name) From 9beae19c4fd78e52107615fe0b5de037c25d42d0 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:16:43 +0000 Subject: [PATCH 22/34] force match to bool and test bool --- ci/Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 63b1d8389d..f3318d0f42 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,16 +40,17 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - matcher = label ==~ /CI-(.*?)-Ready/ - if (matcher) { + matcher = label =~ /CI-(.*?)-Ready/ + sleep(1) + if (matcher.matches()) { def Machine_name = lable.split('-')[1].toString() - echo "Machine_name: ${Machine_name}" jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { run_nodes.add(c.node.selfLabel.name) } } } + matcher = null } // Spawning all the jobs on the nodes matching the labels if (run_nodes.size() > 1) { From dedbadc7cacd4b56610c893fcbab3c5e6dc484d3 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:23:30 +0000 Subject: [PATCH 23/34] null after bool on matcher --- ci/Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index f3318d0f42..a338358cab 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,9 +40,9 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - matcher = label =~ /CI-(.*?)-Ready/ - sleep(1) - if (matcher.matches()) { + def matcher = label =~ /CI-(.*?)-Ready/ + if (matcher) { + matcher = null def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { @@ -50,7 +50,6 @@ pipeline { } } } - matcher = null } // Spawning all the jobs on the nodes matching the labels if (run_nodes.size() > 1) { From d9f1ad2c06b9d6497672126e43a5ae21e463b429 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:25:25 +0000 Subject: [PATCH 24/34] null after bool on matcher --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index a338358cab..3747855d0f 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { def matcher = label =~ /CI-(.*?)-Ready/ - if (matcher) { + if (matcher.matches() { matcher = null def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> From b35c940f1553eb75cd458432156e251d460a4221 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:27:04 +0000 Subject: [PATCH 25/34] null after bool on matcher --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 3747855d0f..e43b97e858 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { def matcher = label =~ /CI-(.*?)-Ready/ - if (matcher.matches() { + if (matcher.matches()) { matcher = null def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> From d449c272aa4ec418e42ec8cfb5ee1e8c04b9483e Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:31:48 +0000 Subject: [PATCH 26/34] removed matcher and used lable.matches --- ci/Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index e43b97e858..868f56933b 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,9 +40,7 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - def matcher = label =~ /CI-(.*?)-Ready/ - if (matcher.matches()) { - matcher = null + if (label.matches("CI-(.*?)-Ready")) { def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { From b263ebdd95c06a6c95e8c5db94e46f036424b99d Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:33:44 +0000 Subject: [PATCH 27/34] removed matcher and used lable.matches --- ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 868f56933b..fa0778d93f 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,6 +40,7 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { + echo "Checking label: ${label}" if (label.matches("CI-(.*?)-Ready")) { def Machine_name = lable.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> From 16a45c2fdbf0fcbec7fbf2e361d74d6756d2b66c Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:35:14 +0000 Subject: [PATCH 28/34] lable is label --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index fa0778d93f..d6f6d18a98 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -42,7 +42,7 @@ pipeline { for (label in pullRequest.labels) { echo "Checking label: ${label}" if (label.matches("CI-(.*?)-Ready")) { - def Machine_name = lable.split('-')[1].toString() + def Machine_name = label.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> if (c.node.selfLabel.name == "${Machine_name}-EMC") { run_nodes.add(c.node.selfLabel.name) From ed21a60225fba3db722005e4ad8c7924ef90d49c Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:41:40 +0000 Subject: [PATCH 29/34] vars did not need $ evaluations --- ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index d6f6d18a98..e03a1749b4 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -56,8 +56,8 @@ pipeline { def machine_name = node.split('-')[0].toLowerCase() echo "Spawning job on node: ${node} with machine name: ${machine_name}" build job: "/global-workflow/EMC-Pipelines/PR-${env.CHANGE_ID}", parameters: [ - string(name: 'machine', value: ${machine_name}), - string(name: 'Node', value: ${node}) ], + string(name: 'machine', value: machine_name), + string(name: 'Node', value: node) ], wait: false } machine = run_nodes.last().split('-')[0].toLowerCase() From 7e4c6f0d08c1f50048f803228b6e11267d7e955c Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:47:21 +0000 Subject: [PATCH 30/34] finally works removin one extra debug line --- ci/Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index e03a1749b4..1e2ae8d157 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,7 +40,6 @@ pipeline { } else { echo "This is parent job so getting list of nodes matching labels:" for (label in pullRequest.labels) { - echo "Checking label: ${label}" if (label.matches("CI-(.*?)-Ready")) { def Machine_name = label.split('-')[1].toString() jenkins.model.Jenkins.get().computers.each { c -> From 77fdbbad2de6805d58e940b5163b35ec327fbb53 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 26 Apr 2024 23:48:54 +0000 Subject: [PATCH 31/34] updated to main repo --- ci/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 1e2ae8d157..5b61701312 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -4,8 +4,7 @@ def HOME = 'none' def caseList = '' // Location of the custom workspaces for each machine in the CI system. They are persitent for each iteration of the PR. def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/stmp/CI/HERCULES'] -//def repo_url = 'git@github.com:NOAA-EMC/global-workflow.git' -def repo_url = 'git@github.com:TerrenceMcGuinness-NOAA/global-workflow.git' +def repo_url = 'git@github.com:NOAA-EMC/global-workflow.git' def STATUS = 'Passed' pipeline { From 64be1bb36931a6d989d6842e516cd98cac251b37 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 26 Apr 2024 21:36:50 -0400 Subject: [PATCH 32/34] Update ci/Jenkinsfile --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 5b61701312..c8000556d1 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -258,7 +258,7 @@ pipeline { } } } - stage( '5. FINALIZE' ) { + stage( '5. Finalize' ) { when { expression { STATUS == 'Passed' From 270c4d31f663953af2e4319c722c7077632dd920 Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Sat, 27 Apr 2024 01:52:22 +0000 Subject: [PATCH 33/34] updated path to EMC-Global-Pipelines for authoratiative repo --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 5b61701312..9906d926c2 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -53,7 +53,7 @@ pipeline { run_nodes.init().each { node -> def machine_name = node.split('-')[0].toLowerCase() echo "Spawning job on node: ${node} with machine name: ${machine_name}" - build job: "/global-workflow/EMC-Pipelines/PR-${env.CHANGE_ID}", parameters: [ + build job: "/global-workflow/EMC-Global-Pipelines/PR-${env.CHANGE_ID}", parameters: [ string(name: 'machine', value: machine_name), string(name: 'Node', value: node) ], wait: false From 9f1b4d52c83886cc3972c7cc067384c5ae318f0f Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Sat, 27 Apr 2024 02:00:19 +0000 Subject: [PATCH 34/34] Pipelines is not plurl in project path --- ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 85fbd66695..5f64ba4d8d 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -53,7 +53,7 @@ pipeline { run_nodes.init().each { node -> def machine_name = node.split('-')[0].toLowerCase() echo "Spawning job on node: ${node} with machine name: ${machine_name}" - build job: "/global-workflow/EMC-Global-Pipelines/PR-${env.CHANGE_ID}", parameters: [ + build job: "/global-workflow/EMC-Global-Pipeline/PR-${env.CHANGE_ID}", parameters: [ string(name: 'machine', value: machine_name), string(name: 'Node', value: node) ], wait: false @@ -258,7 +258,7 @@ pipeline { } } } - stage( '5. Finalize' ) { + stage( '5. FINALIZE' ) { when { expression { STATUS == 'Passed'