Skip to content

Instantly share code, notes, and snippets.

@rnagle
Created February 8, 2017 15:33
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 rnagle/5f9c6940f06d4132045eb18e44cf69ca to your computer and use it in GitHub Desktop.
Save rnagle/5f9c6940f06d4132045eb18e44cf69ca to your computer and use it in GitHub Desktop.
Jenkinsfile outline w/ essentials
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