Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!groovy
- @Library('pa-shared')
- import java.lang.Object
- properties([
- [$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', daysToKeepStr: '10', numToKeepStr: '5']]
- ])
- node() {
- try {
- String buildVersion
- fallibleStage("Checkout") {
- checkout scm
- buildVersion = readProjectVersion()
- echo "BUILD VERSION DETERMINED AS : ${buildVersion}"
- }
- fallibleStage("Ensure Java Installed") {
- env.JAVA_HOME = "${tool 'JDK8'}"
- env.PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
- sh 'java -version'
- }
- fallibleStage("Stand Up Stack") {
- sh "docker ps -q | xargs docker stop 2>/dev/null || true"
- sh "echo \"ES_JAVA_OPTS=-Xmx750m -Xms750m\" > .env"
- // terminate any running stack containers, clean and update
- sh "docker rm -f selenium-hub || true"
- //Setup docker hub
- sh "docker run -p 4444:4444 --name selenium-hub selenium/hub"
- }
- fallibleStage("Link Selenium Node to Hub") {
- //Run chrome node attached to hub
- sh "docker run --link selenium-hub:hub selenium/node-chrome"
- }
- fallibleStage("Test") {
- mvn "verify"
- step([$class: 'CucumberReportPublisher', fileIncludePattern: '**/cucumber-report.json'])
- }
- }
- finally {
- notifyResults()
- thisRegistry = null // clean this up, as JsonSlurper objects are non-serialisable
- cleanWs()
- }
- }
- /**
- * Maven invocation with build failure on exception.
- *
- * @param invocation the maven invocation
- */
- private mvn(String invocation) {
- mvn(invocation, true);
- }
- /**
- * Maven invocation with build failure on exception.
- *
- * @param invocation the maven invocation
- * @param disableOpenTasksPublisher whether to disable the "Open Tasks" publisher
- */
- private mvn(String invocation, boolean disableOpenTasksPublisher) {
- withMaven(maven: "M3",
- options: [openTasksPublisher(disabled: disableOpenTasksPublisher)],
- mavenSettingsConfig: "983af180-96cb-4cb3-b252-bbbf858e78ac") {
- sh "mvn -B $invocation -Denv.GIT_BRANCH=${env.BRANCH_NAME}"
- }
- }
Add Comment
Please, Sign In to add comment