Skip to content

Instantly share code, notes, and snippets.

@cyrille-leclerc
Last active December 4, 2015 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyrille-leclerc/946aae4d2162f24fa866 to your computer and use it in GitHub Desktop.
Save cyrille-leclerc/946aae4d2162f24fa866 to your computer and use it in GitHub Desktop.
Webinar: Continuous Delivery for Cloud Native Application
#!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