Skip to content

Instantly share code, notes, and snippets.

@michaelneale
Created March 9, 2021 00:08
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 michaelneale/e3544a30e4b1d350a286f043902b35cc to your computer and use it in GitHub Desktop.
Save michaelneale/e3544a30e4b1d350a286f043902b35cc to your computer and use it in GitHub Desktop.
def honeycomb_setup() {
script {
env.STEP_START = sh(script:'date +%s', returnStdout: true).trim()
env.STEP_SPAN_ID = sh(script:'uuidgen', returnStdout: true).trim()
}
}
def install_buildevents() {
sh"""
curl -L -o buildevents https://github.com/honeycombio/buildevents/releases/latest/download/buildevents-linux-amd64 curl -L -o buildevents https://github.com/honeycombio/buildevents/releases/latest/download/buildevents-linux-amd64
chmod 755 buildevents
"""
}
pipeline {
environment {
BUILD_START = "${sh(script:'date +%s', returnStdout: true).trim()}"
}
stages {
stage('Install buildevents') {
steps {
install_buildevents()
}
}
stage('Lint') {
steps {
honeycomb_setup()
sh"""
${WORKSPACE}/buildevents cmd $BUILD_TAG $STEP_SPAN_ID lint -- lint-command
${WORKSPACE}/buildevents step $BUILD_TAG $STEP_SPAN_ID $STEP_START lint
"""
}
}
stage('Unit Tests') {
steps {
honeycomb_setup()
sh"""
${WORKSPACE}/buildevents cmd $BUILD_TAG $STEP_SPAN_ID unit-test -- unit-test-command
${WORKSPACE}/buildevents step $BUILD_TAG $STEP_SPAN_ID $STEP_START unit-test
"""
}
}
}
post {
always {
sh '${WORKSPACE}/buildevents build $BUILD_TAG $BUILD_START success'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment