Why Nerve for Jenkins
Jenkins email is easy to ignore. Nerve gives you an encrypted push signal from the pipeline itself. The sender DSN can only send to one pipe; it cannot read message history or run commands.
Jenkinsfile: notify on failure
pipeline {
agent any
environment {
NERVE_DSN = credentials('nerve-dsn')
}
stages {
stage('Build') {
steps { sh 'make build' }
}
stage('Test') {
steps { sh 'make test' }
}
}
post {
failure {
sh '''
go install github.com/nerve-ink/nerve-cli/cmd/nerve@latest
echo "Jenkins failed: ${JOB_NAME} #${BUILD_NUMBER}" | nerve send --severity critical
'''
}
}
}
Notify on every build result
post {
always {
sh '''
go install github.com/nerve-ink/nerve-cli/cmd/nerve@latest
echo "Jenkins ${currentBuild.currentResult}: ${JOB_NAME} #${BUILD_NUMBER}" | nerve send
'''
}
}
Deployment alerts
Send a dedicated signal when production deploys finish or fail.
stage('Deploy production') {
steps {
sh './deploy.sh production'
}
post {
success {
sh 'echo "Production deploy OK: ${GIT_COMMIT}" | nerve send'
}
failure {
sh 'echo "Production deploy FAILED: ${JOB_NAME}" | nerve send --severity critical'
}
}
}
Store the DSN as a Jenkins credential
Create a secret text credential named nerve-dsn. Keep the DSN out of your Jenkinsfile and logs.
NERVE_DSN=nerve://TOKEN:[email protected]
FAQ
How do I send Jenkins build notifications to my phone?
Add a nerve send command to your Jenkinsfile post block. Store NERVE_DSN as a Jenkins credential or environment variable.
Can Nerve notify only on Jenkins failures?
Yes. Put nerve send in the failure block of your Jenkins pipeline post section.
Are Jenkins logs encrypted?
The message you pipe to nerve send is encrypted before it reaches the relay. Keep messages concise and avoid sending secrets.