- Code snippets used in the webinar "Continuous Delivery for Cloud Native applications" presented by @cyrille-leclerc and @bboe-pivotal on Dec, 2nd 2015
- Slides: http://www.slideshare.net/cloudbees/continuous-delivery-for-cloud-native-applications-with-cloudbees-jenkins-platform-and-pivotal-cloud-foundry
- Youtube recording: https://youtu.be/FcBR9sBj-1g
Last active
December 4, 2015 11:21
-
-
Save cyrille-leclerc/946aae4d2162f24fa866 to your computer and use it in GitHub Desktop.
Webinar: Continuous Delivery for Cloud Native Application
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
#!groovy | |
docker.image('cloudbees/java-build-tools:0.0.5').inside { | |
git 'https://gitlab.com/cleclerc/game-of-life.git' | |
def mavenSettingsFile = "${pwd()}/.m2/settings.xml" | |
stage 'Build Web App' | |
wrap([$class: 'ConfigFileBuildWrapper', | |
managedFiles: [[fileId: 'maven-settings-for-gameoflife', targetLocation: "${mavenSettingsFile}"]]]) { | |
sh "mvn -s ${mavenSettingsFile} -DaltSnapshotDeploymentRepository=cleclerc.artifactoryonline.com::default::https://cleclerc.artifactoryonline.com/cleclerc/libs-snapshot-local clean source:jar deploy " | |
} | |
stage 'Deploy Web App On CloudFoundry' | |
wrap([$class: 'CloudFoundryCliBuildWrapper', | |
cloudFoundryCliVersion: 'Cloud Foundry CLI (built-in)', | |
apiEndpoint: 'https://api.hackney.cf-app.com', | |
skipSslValidation: true, | |
credentialsId: 'pcf-elastic-runtime-credentials', | |
organization: 'cloudbees', | |
space: 'development']) { | |
sh 'cf push gameoflife-dev -p gameoflife-web/target/gameoflife.war' | |
} | |
stash name: 'acceptance-tests', includes: 'gameoflife-acceptance-tests, gameoflife-web/target/gameoflife.war' | |
} | |
stage 'Test Web App with Selenium' | |
mail body: "Start web browser tests on http://gameoflife-dev.hackney.cf-app.com/ ?",subject: "Start web browser tests on http://gameoflife-dev.hackney.cf-app.com/ ?", to: 'cleclerc@cloudbees.com' | |
input "Start web browser tests on http://gameoflife-dev.hackney.cf-app.com/ ?" | |
node { | |
checkpoint 'Web Browser Tests' | |
unstash name: 'acceptance-tests' | |
// web browser tests are fragile, test up to 3 times | |
retry(3) { | |
docker.image('cloudbees/java-build-tools:0.0.5').inside { | |
def mavenSettingsFile = "${pwd()}/.m2/settings.xml" | |
wrap([$class: 'ConfigFileBuildWrapper', | |
managedFiles: [[fileId: 'maven-settings-for-gameoflife', targetLocation: "${mavenSettingsFile}"]]]) { | |
sh """ | |
cd gameoflife-acceptance-tests | |
mvn -B -V -s ${mavenSettingsFile} verify -Dwebdriver.driver=remote -Dwebdriver.remote.url=http://localhost:4444/wd/hub -Dwebdriver.base.url=http://gameoflife-dev.hackney.cf-app.com/ | |
""" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment