Using Blue Ocean Interface
1. Accessing Blue Ocean UI
| Method | Description | Notes |
|---|---|---|
| Browser Access | http://<Jenkins-URL>:8080/blue |
Default URL to access Blue Ocean interface |
| Plugin Installation | Install Blue Ocean plugin via Jenkins Plugin Manager |
Required for UI access; may need restart |
| Authentication | Use Jenkins credentials or OAuth with GitHub/GitLab | Blue Ocean supports multiple authentication methods |
Note: Ensure Jenkins is running and the Blue Ocean plugin is installed before accessing the UI.
2. Creating Pipelines in Blue Ocean
| Step | Action | Description |
|---|---|---|
| 1 | Access Blue Ocean | Navigate to Jenkins dashboard and click on the "Blue Ocean" button or visit http://your-jenkins-url/blue. |
| 2 | Create New Pipeline | Click on "Create a new pipeline" and select the source (e.g., Git, GitHub, Bitbucket). |
| 3 | Link Repository | Select the repository containing your project and configure access if needed. |
| 4 | Configure Pipeline | Choose whether to use an existing Jenkinsfile or generate one automatically. |
| 5 | Start Pipeline | Click "Start Pipeline" to begin execution. |
Example: Jenkinsfile for a Simple Pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}
Note: Blue Ocean provides a visual editor for creating pipelines, which can simplify the process of writing Jenkinsfiles.
3. Visualizing Pipeline Runs
Example: Pipeline Run Visualization
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
stage('Test') {
steps {
echo 'Testing...'
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
}
}
}
}
| Visualization Element | Description | Details |
|---|---|---|
| Pipeline Graph | Visual representation of pipeline stages | Shows execution flow and dependencies |
| Stage Status | Color-coded status indicators | NEW in Jenkins 2.300+ |
| Duration Tracking | Execution time per stage | Real-time updates during run |
| Log Stream | Live logs from each stage | Accessible via click on stage |
How to View Pipeline Runs
- Navigate to Blue Ocean dashboard
- Select project from list
- Click on pipeline run to open visualization
- Use timeline to inspect stage execution
Key Features of Pipeline Visualization
- Interactive timeline for run history
- Stage-level resource usage tracking
- Real-time log streaming
- Easy access to artifacts and console output
4. Using Visual Pipeline Editor
Example: Creating a Pipeline with Visual Editor
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}
| Element | Description | Usage |
|---|---|---|
| Stage | Represents a logical group of steps | Used to organize pipeline execution into phases |
| Step | Basic unit of work in a pipeline | Can be a shell command, script, or built-in action |
| Agent | Defines where the pipeline runs | Can be 'any', 'none', or specify a node |
Note: The visual editor allows drag-and-drop creation of stages and steps, simplifying pipeline design for users unfamiliar with Groovy syntax.
Warning: Changes made in the visual editor may not always translate perfectly to the underlying Jenkinsfile syntax, so review before committing.
5. Viewing Test Results
| Property | Description | Values | Notes |
|---|---|---|---|
| testResults | Test result files to be parsed | **/test-results.xml |
Supports glob patterns |
| testReport | Test report file path | **/TEST-*.xml |
Used for JUnit-style reports |
| testResultsDirectory | Directory containing test result files | build/test-results |
Default location for test reports |
Example: Configure Test Results in Jenkins Pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean compile'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
post {
always {
junit 'build/test-results/*.xml'
}
}
}
}
}
Note: Ensure test result files are in JUnit XML format for proper parsing by Blue Ocean.
Warning: If test results are not found, Blue Ocean will show a "No Test Results" message.
6. Analyzing Pipeline Trends
| Metric | Description | Availability |
|---|---|---|
| Build Duration | Time taken to complete a build | NEW |
| Build Success Rate | Percentage of successful builds over time | Standard |
| Failure Count | Total number of failed builds in a period | Standard |
| Stability Index | Measure of pipeline consistency over time | EXPERIMENTAL |
Example: Build Duration Trend Analysis
// Jenkins Pipeline Script Example
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
sh 'make'
}
}
}
post {
always {
script {
def duration = (System.currentTimeMillis() - buildStartTime) / 1000
echo "Build took ${duration} seconds"
}
}
}
}
Note: Pipeline trends can be visualized using the Blue Ocean interface's built-in analytics dashboard.
Key Metrics for Pipeline Trends
- Build Duration: Helps identify performance bottlenecks
- Success Rate: Indicates overall pipeline reliability
- Failure Count: Highlights recurring issues in the CI/CD process
- Stability Index: Provides a quantitative measure of pipeline consistency
7. Using Personalized Dashboard
The Blue Ocean interface provides a personalized dashboard that allows users to customize their Jenkins experience based on their role and preferences.
| Feature | Description | Availability |
|---|---|---|
| Pipeline View | Displays pipelines in a visual, flow-based format with real-time status updates. | NEW Jenkins 2.305+ |
| Personalized Widgets | Allows users to add, remove, and reorder widgets to suit their workflow. | Jenkins 2.305+ |
| Quick Access to Recent Pipelines | Shows recently accessed pipelines for quick navigation. | Jenkins 2.305+ |
| Customizable Layout | Enables users to arrange dashboard elements according to their preferences. | Jenkins 2.305+ |
Example: Adding a Widget to the Dashboard
// Navigate to Blue Ocean dashboard
// Click on "Configure" in the top right
// Select "Add Widget"
// Choose desired widget (e.g., Pipeline Status)
// Drag and drop to preferred location
Note: The personalized dashboard is available only in the Blue Ocean plugin and requires Jenkins 2.305 or higher.
8. Filtering and Searching Builds
| Filter Type | Description | Usage Example |
|---|---|---|
| Build Status | Filter builds by their status (success, failure, unstable, etc.) | status: success |
| Build Duration | Filter builds based on how long they took to complete | duration > 30s |
| Build Author | Filter builds by the user who triggered them | author: john.doe |
| Build Branch | Filter builds by the branch they were run on | branch: main |
| Build Result | Filter builds by result (success, failure, aborted) | result: failure |
Example: Filtering by Build Duration
curl -X GET "http://jenkins.example.com/blue/rest/organizations/jenkins/pipelines/my-pipeline/runs/?filter=duration>30s"
Note: The filtering capabilities in Blue Ocean are powered by the Jenkins REST API and support complex queries using a DSL (Domain Specific Language).
9. Using Branch and PR Views
Example: Configuring Branch View
// In Jenkins Pipeline configuration
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
post {
always {
cleanWs()
}
}
}
| View Type | Description | Features | Access |
|---|---|---|---|
| Branch View | Displays all branches in a repository | Build status, last build time, actions | Available in Blue Ocean UI |
| Pull Request View | Shows all PRs in a repository | Build status, mergeability, comments | Available in Blue Ocean UI |
Key Features of Branch and PR Views
- Visual Pipeline - Real-time visualization of builds
- Build Status - Color-coded indicators for job status
- Actions - Quick access to build, re-run, and delete actions
- Comments - Integrated commenting system for PRs
Workflow: Setting Up Branch View
- Navigate to Blue Ocean dashboard
- Select "Branches" from the sidebar
- Configure branch filters if needed
- View build status and actions for each branch
Branch View vs PR View
- Branch View: Focuses on branches and their build history
- PR View: Focuses on pull requests and their build status
10. Configuring Blue Ocean Preferences
| Preference | Description | Default Value | Notes |
|---|---|---|---|
| blueocean.dashboard.enabled | Enables or disables the Blue Ocean dashboard | true |
Set to false to disable Blue Ocean UI |
| blueocean.pipeline.editor.enabled | Enables or disables the pipeline editor in Blue Ocean | true |
Disabling this will hide the visual pipeline editor |
| blueocean.notifications.enabled | Enables or disables notifications in Blue Ocean | true |
Disabling this will hide all notification popups |
| blueocean.theme | Theme to use for Blue Ocean interface | light |
Options: light, dark |
Example: Enabling Blue Ocean UI
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}
Note: Blue Ocean preferences can be configured via the Jenkins UI under
Manage Jenkins > Configure System.
Warning: Disabling
blueocean.dashboard.enabled will remove access to the Blue Ocean interface entirely.