<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Upstream & Downstream job]]></title><description><![CDATA[Upstream & Downstream job]]></description><link>https://upstream-downstream-job.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 21 Oct 2026 09:50:52 GMT</lastBuildDate><atom:link href="https://upstream-downstream-job.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[🚀 Understanding Upstream and Downstream Jobs in Jenkins]]></title><description><![CDATA[Manage Jenkins job dependencies using upstream and downstream jobs to automate complex pipelines efficiently]]></description><link>https://upstream-downstream-job.hashnode.dev/understanding-upstream-and-downstream-jobs-in-jenkins</link><guid isPermaLink="true">https://upstream-downstream-job.hashnode.dev/understanding-upstream-and-downstream-jobs-in-jenkins</guid><category><![CDATA[Jenkins]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Learning Journey]]></category><category><![CDATA[#cicd #jenkins #goal]]></category><dc:creator><![CDATA[Ankit Raj]]></dc:creator><pubDate>Thu, 21 Nov 2024 14:24:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1732202355874/2abb468a-ae8f-4a5f-a646-034c82212d9e.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Jenkins is a fantastic tool for automating your workflows. One of its coolest features is <strong>upstream</strong> and <strong>downstream jobs</strong>, which help manage dependencies between tasks. Let’s dive in to learn what they are and how to use them—step by step, with emojis! 🛠️</p>
<hr />
<h2 id="heading-what-are-upstream-and-downstream-jobs"><strong>🤔 What Are Upstream and Downstream Jobs?</strong></h2>
<ul>
<li><p><strong>🔼 Upstream Job</strong>: A job that triggers another job when it completes.</p>
</li>
<li><p><strong>🔽 Downstream Job</strong>: A job that is triggered by another job.</p>
</li>
</ul>
<h3 id="heading-how-do-they-work-together"><strong>🧩 How Do They Work Together?</strong></h3>
<p>Imagine a pipeline with three tasks:</p>
<ol>
<li><p><strong>Job A</strong> (🔼 Upstream): Builds the application.</p>
</li>
<li><p><strong>Job B</strong> (🔽 Downstream): Tests the build.</p>
</li>
</ol>
<p><strong>Job A → Job B</strong></p>
<p>Simple, right? Let's set them up! 💡</p>
<hr />
<h2 id="heading-setting-up-upstream-and-downstream-jobs"><strong>🛠️ Setting Up Upstream and Downstream Jobs</strong></h2>
<h3 id="heading-1-create-the-upstream-job"><strong>1️⃣ Create the Upstream Job</strong></h3>
<ol>
<li><p>Go to your <strong>Jenkins Dashboard</strong>.</p>
</li>
<li><p>Click <strong>New Item</strong> 🆕.</p>
</li>
<li><p>Enter a name (e.g., <code>A 🛠️</code>) and select <strong>Pipeline</strong>.</p>
</li>
<li><p>Add your configuration for the build (e.g., source code checkout, build steps).</p>
</li>
<li><p>Save the job ✅.</p>
</li>
</ol>
<pre><code class="lang-plaintext">pipeline{
    agent any
    stages{
        stage('Hello'){
            steps{
                echo "Hello from A"
            }
        }
        post{
            success{
                    build job: 'B'
            }
        }
    }
}
</code></pre>
<hr />
<h3 id="heading-2-create-the-downstream-job"><strong>2️⃣ Create the Downstream Job</strong></h3>
<ol>
<li><p>Go back to your <strong>Jenkins Dashboard</strong>.</p>
</li>
<li><p>Click <strong>New Item</strong> 🆕 again.</p>
</li>
<li><p>Enter a name (e.g., <code>B🧪</code>) and select <strong>Pipeline</strong>.</p>
</li>
<li><p>Add your configuration for testing (e.g., run unit tests).</p>
</li>
<li><p>Save the job ✅.</p>
</li>
</ol>
<pre><code class="lang-plaintext">pipeline{
    agent any
    stages{
        stage('Hello'){
           steps{
                echo "Hello from B"
            }
        }
    }
}
</code></pre>
<hr />
<h3 id="heading-3-link-the-jobs-together"><strong>3️⃣ Link the Jobs Together</strong></h3>
<h4 id="heading-option-1-post-build-action-in-upstream-job"><strong>🔗 Option 1: Post-Build Action in Upstream Job</strong></h4>
<ol>
<li><p>Open the <strong>Upstream Job</strong> (<code>A 🛠️</code>).</p>
</li>
<li><p>Go to the <strong>Post-build Actions</strong> section.</p>
</li>
<li><p>Choose <strong>Build other projects</strong>.</p>
</li>
<li><p>Enter the downstream job name (e.g., <code>B 🧪</code>).</p>
</li>
<li><p>Select the trigger condition:</p>
<ul>
<li><p><strong>Only if build is stable</strong> (recommended 🟢).</p>
</li>
<li><p><strong>Even if the build is unstable or fails</strong> 🔴.</p>
</li>
</ul>
</li>
<li><p>Save the configuration ✅.</p>
</li>
</ol>
<p>Now, <code>B 🧪</code> will automatically trigger after <code>A🛠️</code> finishes! 🎉</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732198923317/075f485f-2296-4c31-95b3-afa67b4eca23.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-option-2-build-trigger-in-downstream-job"><strong>🔗 Option 2: Build Trigger in Downstream Job</strong></h4>
<ol>
<li><p>Open the <strong>Downstream Job</strong> (<code>B 🧪</code>).</p>
</li>
<li><p>Go to the <strong>Build Triggers</strong> section.</p>
</li>
<li><p>Check <strong>Build after other projects are built</strong>.</p>
</li>
<li><p>Enter the upstream job name (e.g., <code>A 🛠️</code>).</p>
</li>
<li><p>Save the configuration ✅.</p>
</li>
</ol>
<p>🔄 This setup creates the same dependency but from the downstream job's perspective.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732198884365/8b337cc3-a1d8-465c-bdfc-b7b9dff6a6ce.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-visualizing-job-dependencies"><strong>🔍 Visualizing Job Dependencies</strong></h2>
<p>Jenkins makes it easy to see how jobs are connected:</p>
<h3 id="heading-1-links-on-job-pages"><strong>1️⃣ Links on Job Pages</strong></h3>
<ul>
<li><p><strong>Upstream Projects</strong>: Shows jobs that trigger the current job 🔼.</p>
</li>
<li><p><strong>Downstream Projects</strong>: Shows jobs triggered by the current job 🔽.</p>
</li>
</ul>
<h3 id="heading-2-graphical-view"><strong>2️⃣ Graphical View</strong></h3>
<ol>
<li><p>Install the <strong>Dependency Graph Viewer</strong> plugin 📊:</p>
<ul>
<li><p>Go to <strong>Manage Jenkins &gt; Manage Plugins &gt; Available</strong>.</p>
</li>
<li><p>Search for and install <strong>Dependency Graph Viewer</strong>.</p>
</li>
</ul>
</li>
<li><p>View the graph under <strong>Project Relationships</strong>.</p>
</li>
</ol>
<hr />
<h2 id="heading-best-practices-for-upstream-and-downstream-jobs"><strong>🌟 Best Practices for Upstream and Downstream Jobs</strong></h2>
<ol>
<li><p><strong>Separate Responsibilities</strong>:</p>
<ul>
<li><p>Use upstream jobs for building 🛠️.</p>
</li>
<li><p>Use downstream jobs for testing 🧪 and deploying 🚀.</p>
</li>
</ul>
</li>
<li><p><strong>Use Notifications</strong>:</p>
<ul>
<li>Configure email or Slack alerts 📧 to stay informed about job statuses.</li>
</ul>
</li>
<li><p><strong>Handle Failures Gracefully</strong>:</p>
<ul>
<li>Ensure downstream jobs only trigger if upstream jobs succeed.</li>
</ul>
</li>
<li><p><strong>Parallel Execution</strong>:</p>
<ul>
<li>Run multiple downstream jobs simultaneously to save time ⏱️.</li>
</ul>
</li>
</ol>
<hr />
<h2 id="heading-real-world-use-cases"><strong>✨ Real-World Use Cases</strong></h2>
<ol>
<li><p><strong>Continuous Integration (CI)</strong>:</p>
<ul>
<li><p><strong>Upstream Job</strong>: Compile and package the app 📦.</p>
</li>
<li><p><strong>Downstream Job</strong>: Run unit and integration tests 🧪.</p>
</li>
</ul>
</li>
<li><p><strong>Continuous Deployment (CD)</strong>:</p>
<ul>
<li><p><strong>Upstream Job</strong>: Test the app 🧪.</p>
</li>
<li><p><strong>Downstream Job</strong>: Deploy to staging and production 🚀.</p>
</li>
</ul>
</li>
</ol>
<hr />
<h2 id="heading-conclusion"><strong>🎉 Conclusion</strong></h2>
<p>By mastering upstream and downstream jobs, you can orchestrate complex workflows in Jenkins with ease. Whether you’re automating a CI/CD pipeline or managing dependencies, this feature ensures smooth operations.</p>
<p><strong>Ready to level up your Jenkins game? Start linking your jobs today!</strong> 🔗✨</p>
]]></content:encoded></item></channel></rss>