I'm trying to wrap stages by using:
wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '', autoDisplayName: true, debug: true, displayNameOffset: 100, installationName: 'XVFB', parallelBuild: true]) {
If I have Jenkins file with below lines, how can I start the Xvfb first then start running the tests suite? In other words how to wrap the stages?
pipeline {
agent any
parameters{
choice(choices: 'chrome\nfirefox\nie' , description: 'choose browser name' , name: 'browser')
choice(choices: 'false\ntrue' , description: 'Not running on Selenium Grid?' , name: 'localRun')
}
stages {
stage('Install Parent Project') {
steps {
sh 'mvn -f /var/lib/jenkins/workspace/ clean install -DskipTests=true'
}
}
}
Thanks.
Here is how to add the wrap block with timeout:
stage('Run Tests Suite') {
steps {
timeout(45) {
wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '', autoDisplayName: true, debug: true, displayNameOffset: 0, installationName: 'XVFB', parallelBuild: true, screen: '1024x758x24', timeout: 25]) {
sh 'mvn -f /var/lib/jenkins/workspace/... test -DlocalRun=${localRun} -Dbrowser=${browser} -DxmlPath='''
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With