Skip to content

Commit

Permalink
Merge pull request #9 from TerrenceMcGuinness-NOAA/hotfix_jenkins_emc…
Browse files Browse the repository at this point in the history
…_nodename

Updating MACHINE_ID map to Jenkins Node Name logic for EMC / EPIC compatlity
  • Loading branch information
AnilKumar-NOAA authored Mar 5, 2025
2 parents e3771d4 + 64c3a56 commit 539e67c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ def CUSTOM_WORKSPACE = 'none'
def HOMEgfs = 'none'
def CI_CASES = ''
def GH = 'none'
// Map of the machine names (MACHINE_ID) to the Jenkins Node names
def NodeName = [hera: 'Hera-EMC', orion: 'Orion-EMC', hercules: 'Hercules-EMC', gaeac5: 'GaeaC5', gaeac6: 'Gaeac6-EMC']
// Location of the custom workspaces for each machine in the CI system. They are persistent for each iteration of the PR.
def NodeName = [hera: 'Hera-EMC', orion: 'Orion-EMC', hercules: 'Hercules-EMC', gaeac5: 'gaeac5', gaeac6: 'Gaeac6-EMC']
def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/global/CI/HERCULES', gaeac5: '/gpfs/f5/epic/proj-shared/global/CI', gaeac6: '/gpfs/f6/drsa-precip3/proj-shared/global/CI']

def repo_url = '[email protected]:NOAA-EMC/global-workflow.git'
def STATUS = 'Passed'

Expand Down Expand Up @@ -35,6 +37,7 @@ pipeline {
}

def run_nodes = []
def machine_names = []
if (isSpawnedFromAnotherJob) {
echo "machine being set to value passed to this spawned job"
echo "passed machine: ${params.machine}"
Expand All @@ -47,24 +50,26 @@ pipeline {
jenkins.model.Jenkins.get().computers.each { c ->
if (c.node.selfLabel.name == NodeName[machine_name]) {
run_nodes.add(c.node.selfLabel.name)
machine_names.add(machine_name) // record machine name alongside node
}
}
}
}
// Spawning all the jobs on the nodes matching the labels
// Spawning jobs using both run_nodes and machine_names arrays
if (run_nodes.size() > 1) {
run_nodes.init().each { node ->
def machine_name = node.split('-')[0].toLowerCase()
for (int i = 0; i < run_nodes.size() - 1; i++) {
def node = run_nodes[i]
def machine_name = machine_names[i] // use the corresponding machine name
echo "Spawning job on node: ${node} with machine name: ${machine_name}"
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
string(name: 'Node', value: node)
], wait: false
}
machine = run_nodes.last().split('-')[0].toLowerCase()
machine = machine_names[run_nodes.size() - 1]
echo "Running parent job: ${machine}"
} else {
machine = run_nodes[0].split('-')[0].toLowerCase()
machine = machine_names[0]
echo "Running only the parent job: ${machine}"
}
}
Expand Down

0 comments on commit 539e67c

Please sign in to comment.