Kiwi for Jenkins
Report check results from Jenkins to a run's Verify step with a checker key.
- Posts named check results over HTTP with a checker key. The key can report only the checks you choose in one project.
- Checks reserved for CI accept results only from a checker key.
- Records each result against the candidate under review. A pass counts toward Verify; a fail means the run needs rework.
- Records a retried report once.
- Kiwi does not start pipelines or read their logs. It records the results your pipeline sends.
Set up
Store your checker key as a Secret text credential with the ID kiwi-checker-key and add report-kiwi-check.sh from the setup guide to your repository.
This Jenkinsfile runs your tests, then reports the tests-pass check as pass or fail:
pipeline {
agent any
parameters {
string(name: 'KIWI_RUN_ID', defaultValue: '', description: 'Kiwi run ID')
}
environment {
KIWI_CHECKER_KEY = credentials('kiwi-checker-key')
}
stages {
stage('Test') {
steps {
sh 'npm ci && npm test'
}
}
}
post {
always {
script {
if (params.KIWI_RUN_ID) {
env.KIWI_CHECK_STATUS = currentBuild.currentResult == 'SUCCESS' ? 'pass' : 'fail'
sh './report-kiwi-check.sh tests-pass "$KIWI_CHECK_STATUS" "$BUILD_URL"'
}
}
}
}
}Run the build with the Kiwi run ID as the KIWI_RUN_ID parameter. The first build registers the parameter and does not report.
Run it on an agent that has curl, jq and uuidgen, and set the Jenkins URL so that BUILD_URL is filled in.
Replace tests-pass with the check ID from your plan.