Created
March 9, 2021 00:08
-
-
Save michaelneale/e3544a30e4b1d350a286f043902b35cc to your computer and use it in GitHub Desktop.
This file contains 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
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