Skip to content

Instantly share code, notes, and snippets.

@foxutech
Last active March 22, 2018 10:11
Show Gist options
  • Select an option

  • Save foxutech/d644959ffb64567f02845f561a04d719 to your computer and use it in GitHub Desktop.

Select an option

Save foxutech/d644959ffb64567f02845f561a04d719 to your computer and use it in GitHub Desktop.
node {
// Mark the code checkout 'stage'....
stage 'checkout'
// Get some code from a GitHub repository
git url: 'https://github.com/test.git'
sh 'git clean -fdx; sleep 4;'
// Get the maven tool.
// ** NOTE: This 'mvn' maven tool must be configured
// ** in the global configuration.
def mvnHome = tool 'mvn'
stage 'build'
// set the version of the build artifact to the Jenkins BUILD_NUMBER so you can
// map artifacts to Jenkins builds
sh "${mvnHome}/bin/mvn versions:set -DnewVersion=${env.BUILD_NUMBER}"
sh "${mvnHome}/bin/mvn package"
stage 'test'
parallel 'test': {
sh "${mvnHome}/bin/mvn test; sleep 2;"
}, 'verify': {
sh "${mvnHome}/bin/mvn verify; sleep 3"
}
stage 'archive'
archive 'target/*.jar'
}
node {
stage 'deploy Canary'
sh 'echo "write your deploy code here"; sleep 5;'
stage 'deploy Production'
input 'Proceed?'
sh 'echo "write your deploy code here"; sleep 6;'
archive 'target/*.jar'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment