Last active
October 29, 2015 20:16
-
-
Save cyrille-leclerc/b818e8e2d6320793e2a3 to your computer and use it in GitHub Desktop.
Jenkins Workflow code snippet to deploy a java-maven web app to Cloud Foundry runtime using CloudBees Cloud Foundry CLI Plugin
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
node() { | |
stage 'BUILD' | |
git url:'https://github.com/cyrille-leclerc/spring-petclinic.git' | |
env.PATH = "${tool 'Maven (latest)'}/bin:${env.PATH}" | |
env.PATH = "${tool 'CloudFoundry CLI 6.9.0-cloudbees-1'}:${env.PATH}" | |
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'pws-credentials-id', | |
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { | |
stage concurrency: 1, name: 'DEPLOY' | |
sh ''' | |
# set -x | |
mvn -Dmaven.test.skip=true package | |
cf api https://api.run.pivotal.io | |
cf auth $USERNAME $PASSWORD | |
cf target -o cleclerc -s development | |
cf apps | |
cf push petclinic-clc -p target/petclinic.war | |
# cf logout should be defined in a 'finally' block | |
cf logout | |
''' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment