Skip to content

Instantly share code, notes, and snippets.

@icy
Created October 2, 2018 06:38
Show Gist options
  • Save icy/ce854bd753abb8a8291fcdc07b61541a to your computer and use it in GitHub Desktop.
Save icy/ce854bd753abb8a8291fcdc07b61541a to your computer and use it in GitHub Desktop.
Jenkinsfile.groovy
#!/usr/bin/env groovy
// Purpose: A Sample Jenkinsfile.groovy
// Author : Ky-Anh Huynh
// License: MIT
@Library("libs@default_branch")
def slack = new org.gfg.Slack()
try {
// Preamble
send_notification
prepare_worker_configuration_as_user
prepare_worker_configuration_as_root
fix_local_git_configuration
store_locking_states
store_build_states_for_future_reference
node("some_nodes") {
// a lot of stuff here
}
}
catch (exc) {
currentBuild.result = currentBuild.result ?: "FAILED"
echo "Caught: ${exc}"
throw exc
}
finally {
// Clean Up
send_notification
remove_locking_status
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment