Skip to content

Commit

Permalink
Adding post sections and deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell committed May 18, 2017
1 parent 87c01bd commit 8c394c6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
37 changes: 32 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
pipeline {
environment {
REL_VERSION = "${env.BRANCH_NAME.startswith('release-') ? "${env.BRANCH_NAME.drop(8)}.${env.BUILD_NUMBER}" : ""}"
}
agent none
stages {
stage('Checkout') {
Expand All @@ -19,6 +22,11 @@ pipeline {
sh './mvnw -B -DskipTests=true clean compile package'
stash name: 'war', includes: 'target/**/*.war'
}
post {
success {
archive 'target/**/*.war'
}
}
}
stage('Test Backend') {
agent {
Expand All @@ -31,8 +39,16 @@ pipeline {
unstash 'ws'
unstash 'war'
sh './mvnw -B test findbugs:findbugs'
junit '**/surefire-reports/**/*.xml'
findbugs pattern: 'target/**/findbugsXml.xml', unstableNewAll: '0' //unstableTotalAll: '0'
}
post {
success {
junit '**/surefire-reports/**/*.xml'
findbugs pattern: 'target/**/findbugsXml.xml', unstableNewAll: '0' //unstableTotalAll: '0'
}
unstable {
junit '**/surefire-reports/**/*.xml'
findbugs pattern: 'target/**/findbugsXml.xml', unstableNewAll: '0' //unstableTotalAll: '0'
}
}
}
stage('Test More') {
Expand Down Expand Up @@ -77,29 +93,40 @@ pipeline {
steps {
unstash 'ws'
unstash 'war'
sh './mvnw -B docker:build'
sh './mvnw -B -Drel.version=$REL_VERSION docker:build'
}
post {
success {
archive 'docker/**/*'
}
}
}
stage('Deploy to Staging') {
agent any
environment {
STAGING_AUTH = credentials('staging')
}
when {
allOf {
branch "master"
branch "release-*"
}
}
steps {
echo "Let's pretend a deployment is happening"
sh './deploy.sh staging -v $REL_VERSION -u $STAGING_AUTH_USR -p $STAGING_AUTH_PSW'
}
}
stage('Deploy to production') {
agent any
environment {
PROD_AUTH = credentials('production')
}
when {
branch "release-*"
}
steps {
input message: 'Deploy to production?', ok: 'Fire zee missiles!'
echo "Let's pretend a production deployment is happening"
sh './deploy.sh production -v $REL_VERSION -u $PROD_AUTH_USR -p $PROD_AUTH_PSW'
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "Deploying to $1..."
sleep 3
echo "Done"

0 comments on commit 8c394c6

Please sign in to comment.