Jenkins Integration
Automate your build pipeline with full job management and artifact tracking.
Table of contents
- Overview
- Configuration
- Setup Steps
- Webhook Configuration
- Features
- Job Templates
- Webhook Payload Format
- Troubleshooting
- API Reference
- Best Practices
Overview
ButterStack provides comprehensive Jenkins integration:
- Build triggering from commits
- Job creation from templates
- Build status tracking
- Artifact and console output access
- SCM correlation (link builds to changelists)
- Multi-job support
Configuration
Connection Settings
| Field | Description | Required | Example |
|---|---|---|---|
server_url | Jenkins server URL | Yes | https://jenkins.company.com |
job_name | Default job to trigger | No | MyGame-Build |
selected_jobs | Jobs available for triggering | No | Build-Win64,Build-Linux |
build_parameters | Default parameters for builds | No | {"platform": "Win64"} |
Credentials
| Field | Description | Required |
|---|---|---|
username | Jenkins username | Yes |
api_token | Jenkins API token | Yes |
Setup Steps
1. Generate API Token
- Log into Jenkins as your service account
- Click your username > Configure
- In API Token section, click Add new Token
- Name it
butterstackand click Generate - Copy the token (it won’t be shown again)
2. Add the Integration
- Go to Project Settings > Integrations
- Click Add Integration
- Select Jenkins
- Enter server URL, username, and API token
- Click Test Connection
- Save the integration
3. Select Jobs
After connecting, ButterStack fetches your available jobs. Select which jobs can be triggered:
- Click Configure Jobs
- Check the jobs you want to allow
- Set a default job for automatic triggers
- Save
Webhook Configuration
Jenkins needs to notify ButterStack when builds start and complete.
Option A: Notification Plugin (Recommended)
- Install the Notification Plugin in Jenkins
- In your job configuration, add a Notification Endpoint:
- URL:
https://your-butterstack.com/webhooks/jenkins?token={webhook_token} - Format: JSON
- Events: Job Started, Job Completed, Job Finalized
- URL:
Option B: Post-Build Script
Add a post-build shell step:
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"job_name": "'${JOB_NAME}'",
"build_number": '${BUILD_NUMBER}',
"status": "'${BUILD_STATUS}'",
"build_url": "'${BUILD_URL}'"
}' \
"https://your-butterstack.com/webhooks/jenkins?token=${BUTTERSTACK_TOKEN}"
Option B: Pipeline Step
In your Jenkinsfile:
post {
always {
script {
def status = currentBuild.result ?: 'SUCCESS'
httpRequest(
url: "https://your-butterstack.com/webhooks/jenkins?token=${BUTTERSTACK_TOKEN}",
httpMode: 'POST',
contentType: 'APPLICATION_JSON',
requestBody: """
{
"job_name": "${env.JOB_NAME}",
"build_number": ${env.BUILD_NUMBER},
"status": "${status}",
"build_url": "${env.BUILD_URL}"
}
"""
)
}
}
}
Features
Build Triggering
Trigger builds programmatically or automatically:
From ButterStack UI:
- Go to Builds
- Click Trigger Build
- Select job and parameters
- Click Start Build
From Commit Tags: Include in your commit message:
#ci- Trigger default job#build- Trigger default job#jenkins- Trigger default job#jenkins:JobName- Trigger specific job
Via API:
POST /api/v1/projects/{project_id}/builds/trigger
{
"job_name": "MyGame-Build",
"parameters": {
"platform": "Win64",
"configuration": "Shipping"
}
}
Build Status Tracking
ButterStack tracks build lifecycle:
pending → in_progress → completed
→ failed
→ aborted
Each build record includes:
- Job name and build number
- Start and end times
- Duration
- Status and result
- Triggering changelist(s)
- Build URL
SCM Correlation
ButterStack links builds to their source changes:
- Jenkins reports SCM data (changelist numbers, commits)
- ButterStack matches to existing Changelist/Change records
- Full lineage: Task → Commit → Build
Artifact Access
View and download build artifacts:
GET /api/v1/builds/{build_id}/artifacts
Console Output
Access build logs:
GET /api/v1/builds/{build_id}/console
Job Templates
ButterStack can create Jenkins jobs from templates:
Unreal Engine Template
Creates a job configured for:
- Perforce checkout
- UAT BuildCookRun
- Platform selection (Win64, Linux, etc.)
- Configuration selection (Development, Shipping)
- Artifact archiving
Unity Template
Creates a job configured for:
- Git/Perforce checkout
- Unity batch mode build
- Platform selection
- Build target selection
Creating a Job from Template
- Go to Integrations > Jenkins
- Click Create Job
- Select template and configure options
- Click Create
- Job is created in Jenkins with your settings
Webhook Payload Format
Build Started
{
"event": "build_started",
"job_name": "MyGame-Build",
"build_number": 123,
"timestamp": "2026-12-15T10:30:00Z"
}
Build Completed
{
"event": "build_completed",
"job_name": "MyGame-Build",
"build_number": 123,
"status": "SUCCESS",
"duration": 1234567,
"build_url": "https://jenkins.company.com/job/MyGame-Build/123",
"scm": {
"changelist": 12345,
"branch": "main"
}
}
Troubleshooting
Connection Failed
Error: Failed to connect to Jenkins
- Verify server URL includes protocol (
https://) - Check network connectivity
- Verify firewall allows access
Authentication Failed
Error: 401 Unauthorized
- Regenerate API token
- Verify username is correct
- Check token hasn’t expired
CSRF Token Error
Error: No valid crumb was included
ButterStack handles CSRF automatically. If you see this:
- Ensure you’re using the latest ButterStack version
- Check Jenkins CSRF settings
Build Not Triggering
- Verify job name matches exactly (case-sensitive)
- Check job is in
selected_jobslist - Ensure job accepts remote triggers
- Review Jenkins security settings
Build Status Not Updating
- Verify webhook URL is correct
- Check webhook token matches
- Ensure notification plugin is installed
- Review Jenkins logs for webhook errors
API Reference
Trigger Build
POST /webhooks/jenkins/commit_trigger
Build Notification
POST /webhooks/jenkins/build_notification
Headers:
X-Jenkins-Signature- HMAC signature for verification
List Jobs
GET /api/v1/integrations/{integration_id}/jenkins_jobs
Best Practices
- Use API tokens - Don’t use passwords
- Service account - Create dedicated Jenkins user for ButterStack
- Webhook notifications - More reliable than polling
- Selective job access - Only allow necessary jobs in
selected_jobs - Parameter validation - Define allowed parameters to prevent injection