def branches = [:] def names = nodeNames(); for (int i = 0; i < names.size(); i++) { def nodeName = names[i]; branches["node(" + nodeName + ")"] = { node(nodeName) { stage('Checkout') { checkout scm; } stage('Version') { sh 'rustc --version'; sh 'cargo --version'; } stage('Build') { sh 'LLVM_SYS_40_AUTOBUILD=YES cargo build --verbose'; } stage('Test') { sh 'LLVM_SYS_40_AUTOBUILD=YES argo test --verbose'; } stage('Bench') { sh 'LLVM_SYS_40_AUTOBUILD=YES cargo bench --verbose'; } stage('Doc') { sh 'LLVM_SYS_40_AUTOBUILD=YES cargo doc --verbose'; } } } } // Now we trigger all branches parallel branches // This method collects a list of Node names from the current Jenkins instance @NonCPS def nodeNames() { return jenkins.model.Jenkins.instance.nodes.collect { node -> node.name } }