What is Jenkins? How to Run a Project in Jenkins
Let's Learn About Jenkins
Jenkins, a free open-source automation tool, is now one of the most used tools for CI/CD. It started as Hudson in 2007 and has since received notable recognition.
Awards & Recognition
- Won InfoWorld Bossie Award in 2011
- Received Geek Choice Award in 2014
Global Adoption
With over 1M+ active installations worldwide, Jenkins is a cornerstone for automated software development.
What is Jenkins? Your CI/CD Companion
Jenkins is a free, open-source automation server that simplifies the complex world of software development. It's the go-to tool for Continuous Integration (CI) and Continuous Delivery (CD), helping teams build, test, and deploy code automatically. By catching issues early and streamlining releases, Jenkins empowers developers to deliver high-quality software faster.
The Core Jenkins Workflow
The pipeline begins when a developer commits code and ends with a successful deployment. Jenkins sits at the heart of this process, automating every step to ensure a seamless flow.
Tests Pass
Tests Fail
Uses of Jenkins:
Build Your Code
Test Your Code
Put Your Code Online on app
Integrates with SCM Tools
Works seamlessly with version control systems like:
- Git
- Subversion (SVN)
- Mercurial
Fetches your latest code automatically before building.
Supports Diverse Build Tools
Can run projects built with:
- Maven
- Ant
- Gradle
- sbt
- Command-line scripts
Perfect for building anything from Java apps to simple scripts.
How to Run a Project in Jenkins
Getting your first project running in Jenkins involves a few straightforward steps, from setting up your job to viewing the build output.
Open Jenkins
Navigate to your Jenkins instance, typically at http://localhost:8080
or your server's URL.
Create a New Job
Click "New Item" from the Jenkins dashboard. Enter a name for your project and choose "Freestyle project" (or "Pipeline" for advanced workflows), then click OK.
Configure It
Add your Git repository URL (if applicable). In the "Build" section, add a build step like a "Execute shell" script or "Execute Windows batch command." Finally, click "Save."
Run the Project
On your project's page, click "Build Now" (usually on the left sidebar) to manually trigger the build.
See Output
After the build starts, click on the build number in the "Build History" and then select "Console Output" to view the real-time logs and results of your build.
Build Triggers: How Builds Start
Jenkins builds can be initiated through various triggers, allowing for flexible automation tailored to your development workflow.
On Git Push (Webhook)
Automatically triggers a build when new code is pushed to a Git repository via a configured webhook.
On a Schedule (Cron)
Initiates builds at predefined intervals, similar to cron jobs, for regular health checks or nightly builds.
By Visiting a Build URL
Allows external systems or users to trigger a build by accessing a specific URL.
After Other Builds Finish
Triggers a new build upon the successful (or even unstable) completion of an upstream job, creating a pipeline chain.
Triggered by Other Builds
Similar to "After Other Builds Finish," but can be explicitly configured for more complex inter-job dependencies.
Manual Trigger
A user with the correct permissions can start a build on-demand by clicking a button in the Jenkins UI.
Jenkins Plugins: Extending Capabilities
Plugins are the core of Jenkins' immense flexibility, allowing it to adapt to virtually any development environment by adding new features and integrating with a vast ecosystem of tools.
Extend Features & Support
Plugins extend Jenkins to support more programming languages, integrate with new tools, and add advanced features.
Integrate with Ecosystem
Seamlessly connect Jenkins with Source Code Management (SCM) systems, bug trackers, various build tools, and more.
Generate & Display Reports
Plugins help generate and display comprehensive test reports (e.g., JUnit, NUnit, MSTest), providing insights into code quality.
Customize Look & Functionality
Tailor the Jenkins user interface and modify its core functionality to suit specific project needs and preferences.
Mailer Plugin: Instant Build Alerts
The Jenkins Mailer plugin keeps your team informed with automated email alerts about critical build statuses, ensuring rapid response to pipeline events.
Build Fails
Immediate notification when something breaks, signaling urgent attention is needed.
Build is Unstable
A warning that the build succeeded but with issues (e.g., test failures), indicating something's off.
Successful Build After a Failure
Good news! Indicates recovery and that a previously failing build is now stable.
Unstable Build After a Success
A critical regression alert, notifying of new issues in a previously stable build.
🔑 Credentials Plugin
The Credentials plugin lets Jenkins securely store and manage login details for use across different plugins and jobs.
📊 External Job Monitoring
Jenkins can monitor and track the results of jobs run outside its system, providing a centralized view of all automation tasks.
🖥️ SSH Agents Plugin
The SSH Agent plugin lets Jenkins connect to and run agents on Linux/Unix machines via SSH, making remote builds easy to manage and integrate.
📄 Javadoc Plugin
The Javadoc plugin lets you publish Java documentation automatically after each build, making it easy to manage and share up-to-date API documentation.
⚡ Shell Scripts
Jenkins allows you to schedule and run shell scripts directly from its interface—no command line needed, enabling flexible custom automation steps.
Robust Security for Your Pipelines
Security is paramount in any automation tool. Jenkins provides essential features to protect your CI/CD pipelines, ensuring that your code and infrastructure remain safe from unauthorized access and malicious threats.
- 🔒User Access Control:Granular permissions to manage who can do what.
- 🚫CSRF Protection: Defends against Cross-Site Request Forgery attacks.
- 🛡️Unsafe Build Protection:Safeguards against potentially harmful build configurations.
Deployment Targets
After a successful build and test phase, Jenkins deploys the code. Deployments often target different environments, with most changes going to staging for final verification before a controlled push to production.