Fix for updating branch to node mapping TestON Jenkins Pipelines
Change-Id: I202b567d38d706a949a8a49018e45c598aec2795
diff --git a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
index 7a7fabc..bb550c3 100644
--- a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
+++ b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
@@ -66,12 +66,11 @@
test_list.init()
readParams()
- if ( isFabric ){
- funcs.initializeTrend( "Fabric" )
- funcs.initialize( "Fabric" )
- } else {
- funcs.initializeTrend( "VM" );
- }
+ funcs.initializeTrend( "Fabric" )
+ funcs.initialize( "Fabric" )
+
+ funcs.initializeTrend( "VM" )
+
triggerFuncs.init( funcs )
// list of the tests to be run will be saved in each choices.
@@ -80,6 +79,8 @@
initDates()
onos_branches = getONOSBranches()
selectedTests = getONOSTests()
+
+ echo "selectedTests: " + selectedTests
}
def readParams(){
@@ -185,14 +186,15 @@
def generateRunList(){
runList = [:]
for ( branch in onos_branches ){
+ runBranch = []
nodeLabels = test_list.getAllNodeLabels( branch, selectedTests )
for ( nodeLabel in nodeLabels ){
selectedNodeLabelTests = test_list.getTestsFromNodeLabel( nodeLabel, branch, selectedTests )
selectedNodeLabelCategories = test_list.getAllTestCategories( selectedNodeLabelTests )
for ( category in selectedNodeLabelCategories ){
- selectedNodeLabelCategoryTests = getTestsFromCategory( category, selectedNodeLabelTests )
+ selectedNodeLabelCategoryTests = test_list.getTestsFromCategory( category, selectedNodeLabelTests )
exeTestList = test_list.getTestListAsString( selectedNodeLabelCategoryTests )
- runList.put( nodeLabel, triggerFuncs.trigger_pipeline( branch, exeTestList, nodeLabel, category, manually_run, onos_tag ) )
+ runList.put( branch + "-" + nodeLabel, triggerFuncs.trigger_pipeline( branch, exeTestList, nodeLabel, category, manually_run, onos_tag ) )
}
}
}
diff --git a/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy b/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
index 109b79b..5badbcc 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
@@ -63,7 +63,7 @@
def getTestsFromStringList( list ){
testsResult = [:]
for ( item in list ){
- if ( allTests.contains( item ) ){
+ if ( allTests.keySet().contains( item ) ){
testsResult.put( item, allTests[ item ] )
}
}
@@ -125,6 +125,14 @@
return branch_code
}
+def convertBranchToBranchCode( branch ){
+ if ( branch == "master" || branch.substring( 0, 1 ) == "o" ){
+ return branch
+ } else {
+ return "onos-" + branch.substring( 0, 1 ) + ".x"
+ }
+}
+
// *************
// Test Category
// *************
@@ -210,7 +218,7 @@
}
for ( String key in tests.keySet() ){
branchNodeLabelMap = getTestScheduleProperty( key, "nodeLabel", tests )
- if ( branchNodeLabelMap[ branch ] == nodeLabel ){
+ if ( branchNodeLabelMap[ convertBranchToBranchCode( branch ) ] == nodeLabel ){
nodeLabelTestsResult.put( key, tests[ key ] )
}
}
@@ -226,7 +234,7 @@
if ( result == [:] ){
return "UNKNOWN"
} else {
- return result[ branch ]
+ return result[ convertBranchToBranchCode( branch ) ]
}
}
@@ -237,7 +245,7 @@
}
for ( test_name in tests.keySet() ){
nodeLabel = getNodeLabel( test_name, branch, tests )
- if ( !nodeLabelResult.contains( nodeLabel ) ){
+ if ( !nodeLabelResult.contains( nodeLabel ) && nodeLabel != null ){
nodeLabelResult += nodeLabel
}
}