Skip to content

Instantly share code, notes, and snippets.

@imeredith
Last active January 19, 2018 01:55
Show Gist options
  • Save imeredith/3d091c6cf6e3452970309abac8fb00fd to your computer and use it in GitHub Desktop.
Save imeredith/3d091c6cf6e3452970309abac8fb00fd to your computer and use it in GitHub Desktop.
#!groovy
node() {
stage('Setup') {
deleteDir()
checkout scm
sh 'docker build -t blueocean_build_env --build-arg GID=$(id -g ${USER}) --build-arg UID=$(id -u ${USER}) - < Dockerfile.build'
sh "./acceptance-tests/runner/scripts/start-selenium.sh"
sh "./acceptance-tests/runner/scripts/start-bitbucket-server.sh"
}
docker.image('blueocean_build_env').inside("--net=container:blueo-selenium") {
withEnv(['[email protected]','GIT_COMMITTER_NAME=Hates','GIT_AUTHOR_NAME=Cake','[email protected]']) {
try {
stage('Sanity check dependencies') {
sh "node ./bin/checkdeps.js"
sh "node ./bin/checkshrinkwrap.js"
}
stage('Building JS Libraries') {
sh 'node -v && npm -v'
sh 'npm --prefix ./js-extensions run build'
}
stage('Building BlueOcean') {
try {
sh "mvn clean install -B -DcleanNode -DskipTests"
} catch(e) {
archive '*/target/code-coverage/**/*.html'
throw e;
}
junit '**/target/surefire-reports/TEST-*.xml'
junit '**/target/jest-reports/*.xml'
archive '*/target/*.hpi'
}
stage('ATH - Jenkins 2.73.3') {
sh "cd acceptance-tests && ./run.sh -v=2.73.3 --no-selenium --settings='-s ${env.WORKSPACE}/settings.xml'"
junit 'acceptance-tests/target/surefire-reports/*.xml'
archive 'acceptance-tests/target/screenshots/**/*'
}
} catch(err) {
currentBuild.result = "FAILURE"
if (err.toString().contains('exit code 143')) {
currentBuild.result = "ABORTED"
}
} finally {
stage('Cleanup') {
sh "${env.WORKSPACE}/acceptance-tests/runner/scripts/stop-selenium.sh"
sh "${env.WORKSPACE}/acceptance-tests/runner/scripts/stop-bitbucket-server.sh"
deleteDir()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment