Created
May 25, 2017 14:35
-
-
Save jinnabaalu/fafbb368b0bc05ae54d9bef1cf3eaf71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
node { | |
stage('checkout') { | |
checkout scm | |
} | |
stage('check java') { | |
sh "java -version" | |
} | |
stage('clean') { | |
sh "chmod +x mvnw" | |
sh "./mvnw clean" | |
} | |
stage('install tools') { | |
sh "./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-yarn -DnodeVersion=v6.10.3 -DyarnVersion=v0.24.4" | |
} | |
stage('yarn install') { | |
sh "./mvnw com.github.eirslett:frontend-maven-plugin:yarn" | |
} | |
stage('backend tests') { | |
try { | |
sh "./mvnw test" | |
} catch(err) { | |
throw err | |
} finally { | |
junit '**/target/surefire-reports/TEST-*.xml' | |
} | |
} | |
stage('frontend tests') { | |
try { | |
sh "./mvnw com.github.eirslett:frontend-maven-plugin:gulp -Dfrontend.gulp.arguments=test" | |
} catch(err) { | |
throw err | |
} finally { | |
junit '**/target/test-results/karma/TESTS-*.xml' | |
} | |
} | |
stage('packaging') { | |
sh "./mvnw package -Pprod -DskipTests" | |
archiveArtifacts artifacts: '**/target/*.war', fingerprint: true | |
} | |
def dockerImage | |
stage('build docker') { | |
sh "cp -R src/main/docker target/" | |
sh "cp target/*.war target/docker/" | |
dockerImage = docker.build('app', 'target/docker') | |
} | |
stage('publish docker') { | |
docker.withRegistry('http://107.23.66.141:5000/', 'docker-login') { | |
dockerImage.push 'latest' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment