Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch Multiple Platforms to Jenkins with polling #2548

Merged
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fbbb2a7
first file update for multilable feature into main Jenkinsfile
Apr 26, 2024
a6bb515
debug out env.Node as it was not flagging the parent job
Apr 26, 2024
b816340
damn env.Node is now nulll checking for BUILD_CAUSE
Apr 26, 2024
abd87cc
echo out getCauses
Apr 26, 2024
8363a2d
found consice way to check for spawned jobs
Apr 26, 2024
54343a7
moved scope of run_nodes
Apr 26, 2024
a6f023b
are we failing on pullRequests again
Apr 26, 2024
8007c97
adding more debug statments for nodes found and spawning
Apr 26, 2024
f6a73e7
testing each llooop
Apr 26, 2024
2c0e9fe
just trying two nodes
Apr 26, 2024
2fc9f2c
added debug running common works space on machine in question
Apr 26, 2024
794aca1
test machien assiginment
Apr 26, 2024
6700292
echo start of get machine
Apr 26, 2024
435d57f
still tryinig anything at this point
Apr 26, 2024
8fa8887
it was the regex object I bet
Apr 26, 2024
4276202
surgecly removeing reg
Apr 26, 2024
02977fa
surgecly removeing reg
Apr 26, 2024
5ad0c8e
assigning a matcher is a mistake
Apr 26, 2024
49792a9
release the matcher
Apr 26, 2024
0fb30e2
force match to bool and test bool
Apr 26, 2024
5a6db2b
force match to bool and test bool
Apr 26, 2024
9beae19
force match to bool and test bool
Apr 26, 2024
dedbadc
null after bool on matcher
Apr 26, 2024
d9f1ad2
null after bool on matcher
Apr 26, 2024
b35c940
null after bool on matcher
Apr 26, 2024
d449c27
removed matcher and used lable.matches
Apr 26, 2024
b263ebd
removed matcher and used lable.matches
Apr 26, 2024
16a45c2
lable is label
Apr 26, 2024
ed21a60
vars did not need $ evaluations
Apr 26, 2024
7e4c6f0
finally works removin one extra debug line
Apr 26, 2024
77fdbba
updated to main repo
Apr 26, 2024
64be1bb
Update ci/Jenkinsfile
aerorahul Apr 27, 2024
270c4d3
updated path to EMC-Global-Pipelines for authoratiative repo
Apr 27, 2024
1b92ef4
Merge branch 'feature/launch_multi-lables' of github.com:TerrenceMcGu…
Apr 27, 2024
9f1b4d5
Pipelines is not plurl in project path
Apr 27, 2024
19605ad
Merge branch 'NOAA-EMC:develop' into feature/launch_multi-lables
TerrenceMcGuinness-NOAA Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,60 @@ 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') {
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'

def causes = currentBuild.rawBuild.getCauses()
def isSpawnedFromAnotherJob = causes.any { cause ->
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 {
echo "This is parent job so getting list of nodes matching labels:"
for (label in pullRequest.labels) {
if (label.matches("CI-(.*?)-Ready")) {
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)
}
}
}
}
} // 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
if (run_nodes.size() > 1) {
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: [
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)
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}"
Expand All @@ -57,7 +86,7 @@ pipeline {
}
}

stage('Build System') {
stage('3. Build System') {
matrix {
agent { label "${machine}-emc" }
//options {
Expand Down Expand Up @@ -141,7 +170,7 @@ pipeline {
}
}

stage('Run Tests') {
stage('4. Run Tests') {
failFast false
matrix {
agent { label "${machine}-emc" }
Expand Down Expand Up @@ -216,7 +245,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()}"
}
Expand All @@ -229,7 +258,7 @@ pipeline {
}
}
}
stage( 'FINALIZE' ) {
stage( '5. FINALIZE' ) {
aerorahul marked this conversation as resolved.
Show resolved Hide resolved
when {
expression {
STATUS == 'Passed'
Expand Down
Loading