pipeline {
agent none
stages {
stage('Test') {
parallel {
stage('success1') {
agent {
label 'small'
}
steps {
sh 'sleep 1'
writeFile file: 'report.xml', text: """\
""".stripIndent()
junit testResults: 'report.xml'
echo 'hello'
}
}
stage('success2') {
agent {
label 'small'
}
steps {
sh 'sleep 30'
writeFile file: 'report.xml', text: """\
""".stripIndent()
junit testResults: 'report.xml'
echo 'hello'
}
}
stage('unstable') {
agent {
label 'small'
}
steps {
sh 'sleep 5'
writeFile file: 'report.xml', text: '''\
'''.stripIndent()
junit testResults: 'report.xml'
echo 'hello'
}
}
stage('failure') {
agent {
label 'small'
}
steps {
sh 'sleep 10'
writeFile file: 'report.xml', text: '''\
'''.stripIndent()
sh 'missingCommand'
}
post {
always {
junit testResults: 'report.xml'
echo 'hello'
}
}
}
}
}
}
}