(Day 20) Task : Jenkins- Linked Projects, Views, User Management & Master-Slave Concept :-

Linked Projects in Jenkins
What Are Linked Projects?
Linked projects in Jenkins refer to jobs that are dependent or related to one another. Jenkins allows you to link multiple jobs through build triggers, post-build actions, or parameterized builds.
Why Link Projects?
Modularize complex workflows: Break down large pipelines into smaller jobs.
Reuse jobs: A single job (e.g., testing) can be reused in multiple pipelines.
Control execution order: Ensure one job starts only after another completes successfully.
Ways to Link Projects
Post-build Actions:
Go to Configure > Post-build Actions.
Select Build other projects.
Enter the downstream job names and define conditions like “Trigger only if build is stable”.
Parameterized Trigger Plugin:
Allows passing parameters from one job to another.
Enables more dynamic and flexible job linking.
Pipeline Syntax:
stage('Build') { steps { build job: 'Job-A' } }
Upstream/Downstream Jobs View:
- Jenkins shows the relationship graphically under “Project Relationship”.
Upstream and Downstream Projects in Jenkins
What Do "Upstream" and "Downstream" Mean?
In Jenkins, Upstream and Downstream refer to the sequence of job executions and their dependencies.
Upstream Project: A job that triggers another job after its execution.
Downstream Project: A job that is triggered by another job.
Think of it like a chain reaction:
Job A (upstream) triggers Job B (downstream) when it finishes.
Job B can in turn be upstream for Job C, and so on.
Real-World Analogy
Let’s say you're building a Java web application:
Job A compiles the code (Upstream).
Job B runs tests only if Job A is successful (Downstream of A).
Job C deploys the app only if Job B passes (Downstream of B).
Here, the full chain is:
Job A → Job B → Job C
How to Set Up Upstream and Downstream Jobs
Using Post-build Actions (GUI)
Go to Job A.
Click Configure > Post-build Actions.
Choose Build other projects.
Enter Job B as the project to trigger.
This makes:
Job A the upstream.
Job B the downstream.
Using the "Build Trigger" Option in Job B
Go to Job B.
Click Configure > Build Triggers.
Check Build after other projects are built.
Enter Job A.
This makes:
Job A the upstream of Job B.
Job B the downstream of Job A.
Visualizing Upstream/Downstream Relationships
Jenkins offers a visual representation of project relationships:
Open any job (e.g., Job B).
In the left panel, click Pipeline Steps or Project Relationship (if plugins like Build Pipeline or Delivery Pipeline are installed).
You'll see arrows or a graph showing the flow between upstream and downstream jobs.
Why Use This?
Organize build flow: Define clear sequences.
Error handling: Only proceed if previous steps are successful.
Improve modularity: Separate compile, test, deploy, etc., into manageable units.
Example Scenario
Let’s take a CI/CD scenario with four jobs:
Job 1: Checkout & Build
Job 2: Unit Tests
Job 3: Integration Tests
Job 4: Deploy to Staging
Relationships:
- Job 1 → Job 2 → Job 3 → Job 4
This means:
Job 1 is upstream for all others.
Job 4 is downstream of all others.
Failures in upstream jobs will block the execution of downstream ones.
Views in Jenkins
What Are Views?
Views help organize and group jobs within the Jenkins UI. This is useful when you have dozens or hundreds of jobs and need better visibility.
Types of Views
List View (default):
Create a custom list of jobs.
Filter by name, status, or regex.
Shows job status, last build, and last success/failure.
My View:
Personalized view for each user.
Can include jobs triggered or configured by that user.
Nested Views Plugin:
- Allows creating folders and sub-views within those folders.
Dashboard View Plugin:
- Rich UI with widgets like build statistics, job health, weather reports, etc.
How to Create a View
Navigate to Jenkins Dashboard > + New View.
Choose the type (e.g., List View).
Name the view and select jobs to include.
Jenkins User Management
Why User Management Matters
In multi-user environments, especially in large organizations, controlling who can do what is essential for security and traceability.
Enabling User Security
Go to Manage Jenkins > Configure Global Security.
Check Enable Security.
Choose a Security Realm (e.g., Jenkins’ own database or LDAP).
Select an Authorization Strategy:
Matrix-based security: Fine-grained control.
Project-based Matrix Authorization: Define permissions per job.
Role-based Strategy Plugin: Best for enterprise-grade access control.
Adding Users
Go to Manage Jenkins > Manage Users > Create User.
Enter username, password, full name, and email.
Recommended Plugins
Role-based Authorization Strategy
Matrix Authorization Strategy
LDAP Plugin (for enterprise SSO)
Master-Slave (Now Controller-Agent) Concept
What Is the Master-Slave Architecture?
Jenkins uses a controller-agent model (previously master-slave) to distribute the workload of building, testing, and deploying projects across multiple machines.
Jenkins Controller
Hosts the Jenkins UI.
Manages job scheduling, user management, and job configuration.
Should not be overloaded with build tasks.
Jenkins Agent
Executes the build tasks.
Can be physical, virtual, or cloud-based machines.
Useful for running builds on different OS, hardware, or isolated environments.
Why Use Agents?
Load distribution: Avoid overloading the controller.
Parallel execution: Multiple builds can run at the same time.
Environment-specific builds: E.g., test on Linux, Windows, and macOS.
How to Add an Agent
Go to Manage Jenkins > Manage Nodes and Clouds > New Node.
Enter the node name, choose Permanent Agent, and click OK.
Configure:
Remote root directory
Labels (to filter jobs)
Launch method (e.g., SSH, JNLP, or cloud provider)
Save and connect the agent.
Pipeline Example Using Labels
pipeline {
agent { label 'linux-agent' }
stages {
stage('Test') {
steps {
sh 'pytest test_app.py'
}
}
}
}
Subscribe to my newsletter
Read articles from Aditya Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Aditya Sharma
Aditya Sharma
DevOps Enthusiast | Python | Chef | Docker | GitHub | Linux | Shell Scripting | CI/CD & Cloud Learner | AWS