Created
February 8, 2017 15:33
-
-
Save rnagle/5f9c6940f06d4132045eb18e44cf69ca to your computer and use it in GitHub Desktop.
Jenkinsfile outline w/ essentials
This file contains hidden or 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 { | |
currentBuild.result = 'SUCCESS' | |
try { | |
stage('Checkout') { | |
// Use this for "Pipeline script from SCM" | |
// checkout scm | |
// Use this for copy/paste pipeline script into jenkins | |
// Checks out/builds only for the master branch | |
checkout([ | |
$class: 'GitSCM', | |
branches: [[name: '*/master']], | |
doGenerateSubmoduleConfigurations: false, | |
extensions: [], | |
submoduleCfg: [], | |
userRemoteConfigs: [[ | |
name: 'origin', | |
// Using this refspec option tells git NOT to | |
// fetch all tags for a project (can be slow) | |
refspec: '+refs/heads/master:refs/remotes/origin/master', | |
url: 'https://github.com/ORGANIZATION/PROJECT.git' | |
]] | |
]) | |
} | |
stage('Build') { | |
echo 'Build!' | |
echo 'Here are yer files:' | |
sh 'ls -hl .' | |
} | |
stage('Test') { | |
echo 'Kickoff yer unit tests here' | |
} | |
stage('Deploy') { | |
echo 'Deploy!' | |
} | |
} | |
catch(err) { | |
currentBuild.result = 'FAILURE' | |
echo 'Something went wrong.' | |
throw err | |
} | |
finally { | |
echo 'This always runs.' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment