Skip to content

Instantly share code, notes, and snippets.

@michaelneale
Created March 9, 2021 00:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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