Automate Test Runs on Pull Requests with Shiplight AI in a Jenkins Pipeline
Updated on April 24, 2026
Updated on April 24, 2026
Pull requests are where quality either becomes a fast, repeatable habit or a weekly fire drill. For teams running Jenkins, the good news is you do not need to overhaul your CI stack to get modern, PR-native UI verification. You can keep Jenkins as the system of record for builds and approvals, and use Shiplight AI to make end-to-end and UI regression testing reliable, maintainable, and fast enough to run on every change.
This post walks through a practical pattern for triggering Shiplight test runs automatically on pull request builds in Jenkins, then using those results to gate merges with confidence.
PR checks fail for predictable reasons: they take too long, they are flaky, or they require constant maintenance. A useful PR testing workflow should:
Shiplight AI is built around those constraints. It verifies UI changes in real browsers, supports intent-based test execution (so tests are not brittle selector puzzles), and emphasizes near-zero maintenance through self-healing behavior. It also supports triggering runs from CI workflows and reviewing outcomes in live dashboards with reporting designed for teams who need fast decisions.
In a standard Jenkins setup, pull requests are typically built using a Multibranch Pipeline (for example, with GitHub or Bitbucket branch source plugins). Jenkins detects a PR event, creates a corresponding build, and runs your Jenkinsfile.
Shiplight slots into that flow as the PR-level “browser proof” step:
The key advantage is separation of concerns: Jenkins orchestrates and enforces policy; Shiplight specializes in UI verification and keeping tests stable as the product evolves.
Below is a clean, production-style pattern you can adapt. It uses Jenkins Declarative Pipeline features to run Shiplight only for pull requests, while keeping a different path for main branch builds.
A few notes before the snippet:
when { changeRequest() } is designed for this use case.pipeline {
agent any
options {
timestamps()
ansiColor('xterm')
}
environment {
// Example: store these in Jenkins credentials and inject safely.
// SHIPLIGHT_API_TOKEN = credentials('shiplight-api-token')
// SHIPLIGHT_PROJECT_ID = '...'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build and Unit Tests') {
steps {
sh '''
set -e
./gradlew test
'''
}
}
stage('Shiplight PR UI Verification') {
when {
changeRequest()
}
steps {
sh '''
set -e
echo "Triggering Shiplight run for PR validation..."
echo "Tip: pass commit SHA and PR metadata so results map cleanly to the change."
# Example placeholder:
# Call Shiplight using your preferred integration method (API/CLI),
# then wait for completion and return a non-zero exit code on failure.
#
# Replace the lines below with the Shiplight trigger you use in your org.
#
# curl -sS -X POST "https://<your-shiplight-endpoint>/runs" \
# -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
# -H "Content-Type: application/json" \
# -d '{
# "projectId": "'"$SHIPLIGHT_PROJECT_ID"'",
# "commitSha": "'"$GIT_COMMIT"'",
# "suite": "pr-smoke"
# }'
echo "Shiplight run triggered (placeholder)."
echo "Wait/poll for completion here, then fail the build if Shiplight reports failures."
'''
}
}
stage('Main Branch Regression') {
when {
branch 'main'
}
steps {
sh '''
set -e
echo "Run broader regression coverage for main (placeholder)."
'''
}
}
}
post {
always {
echo "Publish artifacts, test reports, or links to Shiplight run details here."
}
}
}
This is intentionally conservative about implementation details: the exact trigger mechanism depends on how your team has connected Shiplight (API, CLI, or a dedicated integration step). The important part is the shape of the pipeline: PR builds run a fast, high-signal UI suite; main merges get broader coverage.
PR-based testing lives and dies on cycle time. Shiplight enables a more practical approach than “run everything, always”:
If you want PR checks to be meaningful, they need to be consistent. Speed matters, but stability matters more.
The cleanest operational model is:
In practice, teams typically implement:
This division keeps PR reviews focused. Reviewers do not need to interpret logs. They need to know whether the change is safe, and where to look if it is not.
You can bolt UI testing onto Jenkins with almost any framework. The difference is what happens in week six, when the UI has evolved and your PR checks either keep up or collapse under maintenance.
Shiplight is designed to make PR-based UI verification a sustainable habit:
If your Jenkins PR checks are currently green but not credible, or credible but too slow to run on every pull request, Shiplight gives you a path to both speed and proof, without rebuilding your CI foundation.