| recampbell I took the flow of "Jenkins, The Definitive guide" and tried to make it work with as few differences as possible between:
- A 'classic' linux build agent with Firefox that works with Java Selenium test frameworks
- A vanilla linux build agent using docker-pipeline to customize the build environment and get the desired JDK, Maven & Firefox with Firefox working with Java Selenium test frameworks
- A Docker based cloud agent (Kubernetes Agents, Amazon ECS Agents... ) so that the entire build runs in a Docker container that brings all the customization (JDK, Maven & Firefox)
Here is what I have succeeded to implement until docker-pipeline 1.8. The only trick was to switch the Selenium driver from Firefox to Remote+Firefox to use XVFB. The pipeline below is almost the same on classic linux, docker-pipeline and docker based cloud agents. Since docker-pipeline:1.8, I need to add something like "nohup /opt/bin/entry_point.sh &".
node ('docker'){
docker.image('cloudbees/java-build-tools:2.0.0').inside {
git 'https://github.com/cyrille-leclerc/game-of-life.git'
stage 'Build Web App'
withMaven(mavenSettingsConfig: 'maven-settings-for-gameoflife') {
sh "mvn clean package"
step([$class: 'ArtifactArchiver', artifacts: 'gameoflife-web/target/*.war'])
}
}
docker.image('cloudbees/java-build-tools:2.0.0').inside {
withMaven(
mavenSettingsConfig: 'maven-settings-for-gameoflife',
mavenLocalRepo: '.repository') {
sh """
cd gameoflife-acceptance-tests
mvn verify -Dwebdriver.driver=remote -Dwebdriver.remote.driver=firefox -Dwebdriver.remote.url=http://localhost:4444/wd/hub -Dwebdriver.base.url=http://...
"""
}
}
}
|