Handling Real-World Jenkins Challenges: From IP Issues to Build Management


1. Handling Jenkins Slowness: The Public IP Problem
Jenkins is a web application that heavily depends on its configured IP address or DNS name.
Whenever Jenkins is hosted on a server (like AWS EC2, Azure VM, etc.), a server restart may change the public IP.
If this happens, Jenkins can behave strangely:
The web dashboard loads slow or may break.
Jobs that call webhooks (like GitHub) might fail.
Email notifications may not work.
Solution:
SSH into your Jenkins server.
Navigate to the Jenkins configuration path:
cd /var/lib/jenkins/
Edit the IP address in:
vi jenkins.model.JenkinsLocationConfiguration.xml
Search for your old IP and replace it with the new public IP.
Restart Jenkins safely.
Best Practice:
Assign a static IP or Elastic IP to your server to avoid manual IP changes after every reboot.
2. Prevent New Builds During Maintenance
Temporarily Disable a Jenkins Job
If you need to pause builds during server maintenance or updates:
- Navigate to the specific Jenkins job you want to disable.
Click on “Disable Project” (usually near the top of the job page).
The job will show as [DISABLED] in the list
When a job is disabled:
Even if new commits happen (for example, pushed to GitHub), webhooks will still fire, but Jenkins will ignore them.
No new builds will be triggered manually or automatically.
Note:
You must have the correct permissions (Job Configure or Admin rights) to disable or enable a project.
Existing running builds will not be affected — only new builds are blocked.
Missed commits during the disabled period will not automatically build when the job is re-enabled.
3.Maven Integration Plugin in Jenkins
The Maven Integration Plugin is specially designed for Java-based projects and helps Jenkins automatically build, test, and package Java applications using Maven, directly integrating with the project’s pom.xml
.
Difference Between Freestyle Project and Maven Project in Jenkins
Freestyle Project:
Does not recognize
pom.xml
automatically.You have to manually add a build step → "Invoke top-level Maven targets".
Does not auto-detect Maven version you must select or configure it each time.
Needs more manual configuration not ideal for pure Java/Maven projects.
Maven Project:
Automatically detects
pom.xml
no need to specify it manually.No need to add build steps it's already built-in for Maven jobs.
You just select the Maven version once from the dropdown (added in Global Tool Config).
Much cleaner, faster, and smoother setup for Java applications.
How to Install
Go to Dashboard → Manage Jenkins → Manage Plugins.
Click on the Available tab.
Search for Maven Integration Plugin.
How to Create Maven Jobs
When you create a new job:
Click New Item → Enter job name.
Select "Maven Project".
In the job configuration:
Just select the Maven version you added earlier (example:
Maven-3.8.1
).Set Goals and options like
clean package
.Set Root POM as
pom.xml
(default).Supports both local Maven installations and tool-managed Maven inside Jenkins.
4. Safe Restart vs Normal Restart in Jenkins
What is Normal Restart?
Normal Restart restarts Jenkins immediately, but it interrupts any ongoing builds.
Impact: If a build is in progress, it will be stopped, potentially resulting in incomplete build artifacts or failed builds.
Use Case: Best for situations where you need a quick restart, and you can accept that ongoing builds may be interrupted or fail.
How to Trigger Normal Restart:
http://your-jenkins-url/restart
- No Plugin Needed: Normal Restart can be triggered directly via the URL.
What is Safe Restart?
Safe Restart It’s a graceful shutdown waits for all ongoing builds to complete before restarting Jenkins.
Impact: Ensures that Jenkins does not interrupt running builds, allowing them to finish and preventing incomplete artifacts or data loss.
Use Case: Ideal for production environments or critical jobs, where uninterrupted builds are important.
How to Trigger Safe Restart:
You can trigger a Safe Restart using the URL:
http://your-jenkins-url/safeRestart
Plugin: Safe Restart can also be triggered using the Safe Restart Plugin.
To use a Safe Restart button inside Jenkins (instead of using a URL), you can install the Safe Restart Plugin:
After installing, a Safe Restart option will appear in the Jenkins UI (under Manage Jenkins).
Note: You can trigger a Safe Restart using either the URL or the Plugin, so you’ve got options depending on how you like to work.
5. Changing Jenkins Build Number
The build number in Jenkins is unique, and you can change it based on your requirements, like after a failure or to match versioning.
When to Change the Build Number:
Changing the build number is useful in scenarios like:
Skipping a build number after a failed or incomplete build.
Resetting the build number for a fresh job (e.g., after a new major release or renaming the job).
5.1 Manually Change Build Number (Not Recommended but Possible):
Navigate to the Jenkins Job Directory:
- Go to your Jenkins server and use the following command:
cd /var/lib/jenkins/jobs/<job-name>/nextBuildNumber
Edit the Build Number:
Open the
nextBuildNumber
file and change the build number to the one you want (for example,10 0
).After Changing the Build Number when you run the next build, Jenkins will use the new build number you set
5.2 Using Plugin (Recommended):
Install the Next Build Number Plugin.
Set the Next Build Number:
Navigate to the specific Jenkins Job.
Click on "Set Next Build Number" from the job’s configuration page.
Enter the desired build number and save.
When you run the next build, Jenkins will use the new build number you set
The Next Build Number Plugin makes it easy to update the build number without manually editing files.
6.Jenkins Audit Trail Plugin
The Jenkins Audit Trail Plugin stores log information about key actions in Jenkins, such as who created, deleted, or started a job. It also tracks changes made to job configurations, providing an audit trail of all critical actions in Jenkins.
How to Set Up Audit Trail Plugin in Jenkins:
Step 1: Install the Plugin
Go to Dashboard → Manage Jenkins → Manage Plugins
Search for Audit Trail Plugin
The plugin will be installed and ready for configuration.
Step 2: Enable and Configure the Audit Trail Plugin
Once the Audit Trail Plugin is installed, follow these steps to enable and configure it properly:
Go to Dashboard → Manage Jenkins
Click on Configure System
Scroll down to find the Audit Trail section click on "Add Logger"
When enabling the Audit Trail Plugin, you need to specify the full file path where the logs should be saved. This tells Jenkins where to write the audit data.
Log file location: e.g.,
/var/lib/jenkins/logs/audit.log
Log rotation size: Set a limit to avoid very large files
Number of backups: Define how many old logs to keep
you can also view normal log files stored in the same location, like:
audit.log.0, audit.log.1, ... up to audit.log.19
How to See Live Logs:
- Use the following command to view live logs:
tail -f <audit-log-file>
Once enabled, the logs will show:
Who changed job configuration ,Who deleted a job ,Who started a build
Which user performed the action, along with date and time
Features:
Track Changes: Keeps a record of all changes made within Jenkins.
Audit Actions: Shows who performed specific actions like creating, modifying, or deleting jobs.
Restore Configurations: Allows you to restore previous job configurations if needed.
Use Cases:
Security Auditing: Keep track of who made changes to critical jobs for accountability.
Troubleshooting: If something breaks after a change, you can check the logs to see who made the modification and when.
Compliance: Ensure you meet company or regulatory standards by tracking who did what in Jenkins.
Restoring Configurations: If a job's configuration was accidentally changed, you can restore it to its previous state using the logs.
7. Jenkins Job Config History Plugin
If someone accidentally deletes a Jenkins job, and you have the Job Config History Plugin installed and configured, you can restore the job easily — without recreating it manually.
The Job Config History Plugin in Jenkins tracks all configuration changes to jobs, giving you the ability to:
See what changed, when, and who made the change
View deleted job history
Restore jobs or configs if something breaks
What Happens When a Job is Deleted?
When a Jenkins job is deleted:
Jenkins removes the job folder (by default:
/var/lib/jenkins/jobs/<job-name>
)If the Job Config History Plugin is enabled, it keeps a backup of the job’s
config.xml
and metadataYou can use this to restore the job from the Jenkins UI
How to Restore a Deleted
someone accidentally deleted a job called airtel-testing
.
If the Job Config History Plugin is already installed and configured, you can restore the job easily
Go to Job Config History
From the Jenkins Dashboard, click on: Job Config History
Look for the Deleted Job , the plugin keeps a record even if the job was deleted
Restore the Job:
Next to the deleted job entry, click the
<<
Restore buttonClick this to restore the last saved configuration of the deleted job
- Jenkins will automatically recreate the job with its last saved configuration
The job airtel-testing
will now reappear in the job list exactly as it was before deletion.
8.Blue Ocean Plugin for Graphical Dashboard
The Blue Ocean Plugin provides a visual interface for managing Jenkins pipelines.
Visual Pipeline View: See your pipelines in a graphical, easy-to-understand layout.
Easier Management: Manage and monitor your pipelines more efficiently.
How to Use:
Install the Blue Ocean Plugin.
On the Jenkins Dashboard, click Open Blue Ocean to access the graphical interface.
9. Build Name and Description Setter Plugin
The Build Name and Description Setter Plugin allows you to set a custom build name (instead of just #123
), making it easier to identify them.
Step 1: Install the Plugin
Go to: Dashboard → Manage Jenkins → Manage Plugins
install
Build Name and Description Setter Plugin
After installation, the plugin becomes available in job configuration.
Step 2: Enable and Configure in Your Job
Go to the Jenkins Dashboard
Click your job → Configure
Scroll to the Build Environment section
select :Set Build Name
In the input field, enter your custom name format. For example: jio-dev-#${BUILD_NUMBER}
if the current build number is 44, the build will now appear as: jio-dev-#44
, Instead of the default: #44
10. Build With Parameters
The Build With Parameters feature in Jenkins allows you to pass dynamic data (like branch names, version numbers, or environment settings) to your builds.
This makes your builds more flexible, as you can specify different inputs without modifying the job configuration each time.
How to Set Up:
Go to Job → Configure.
In the General section, check This project is parameterized.
The Choice Parameter allows you to create a dropdown list of predefined options that users can select when starting a build. This is useful when you want to limit input to fixed values like:
Branch names (e.g.,
main
,dev
,release
)Environments (e.g.,
dev
,qa
,prod
)Build types (e.g.,
full
,partial
,hotfix
)
Fill in the parameter details:
Name:
BranchNames
(Make sure there are no spaces in the name)Choices: (Enter each branch name on a new line — these must be actual branches from your Git repository)
- Go to Git Section (SCM):
Scroll down to Source Code Management
Use
${BranchNames}
inside your build scripts to reference the parameter values.Avoid hardcoding values like branch names directly into the scripts eg:
*/development
.If you do this, Jenkins will always build
development
— and ignore the parameter.Now go and trigger your job using "Build with Parameters" — you'll see a dropdown list of branches (from your Choice Parameter). Select the branch you want, and Jenkins will use that value during the build.
11.Managing Views in Jenkins
What is a View in Jenkins?
A View in Jenkins is like a virtual folder or category that helps you organize your jobs. Instead of keeping all jobs in a single dashboard, you can create custom views to group related jobs — making it easier to manage and navigate.
For example, you can create separate views for different types of jobs like Airtel Jobs, Jio Jobs, Testing Jobs, or Deployment Jobs.
Why Use Views?
Organize your Jenkins dashboard: Instead of having 100 mixed jobs cluttering the dashboard, you can create separate views to easily manage and find jobs.
Better Job Grouping: Helps in organizing related jobs based on teams, environments, or types of tasks.
Improved Efficiency: You can quickly access the jobs that matter most without scrolling through everything.
Steps to Create a View:
Go to the Jenkins Dashboard.
Click on New View.
3.Enter a name for your view (e.g., Airtel Jobs, Jio Jobs).
Select the jobs you want to group in this view eg:Jio , Airtel related Jobs
Click OK to save.
Deleting a view will not delete the jobs inside it. Only the view grouping will be removed.
The jobs will still exist in Jenkins; they’ll just no longer be part of that specific view.
Subscribe to my newsletter
Read articles from Kandlagunta Venkata Siva Niranjan Reddy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
