-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from TerrenceMcGuinness-NOAA/hotfix_jenkins_emc…
…_nodename Updating MACHINE_ID map to Jenkins Node Name logic for EMC / EPIC compatlity
- Loading branch information
Showing
1 changed file
with
13 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|
||
|
@@ -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}" | ||
|
@@ -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}" | ||
} | ||
} | ||
|