<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Thiru G</title>
    <description>The latest articles on DEV Community by Thiru G (@thiru_g).</description>
    <link>https://dev.to/thiru_g</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3055064%2F44846384-1770-4ea6-b3b2-7307d2620763.jpg</url>
      <title>DEV Community: Thiru G</title>
      <link>https://dev.to/thiru_g</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thiru_g"/>
    <language>en</language>
    <item>
      <title>Building a Self-Healing CI/CD Pipeline on GitLab</title>
      <dc:creator>Thiru G</dc:creator>
      <pubDate>Wed, 16 Apr 2025 12:57:53 +0000</pubDate>
      <link>https://dev.to/thiru_g/building-a-self-healing-cicd-pipeline-on-gitlab-1fn3</link>
      <guid>https://dev.to/thiru_g/building-a-self-healing-cicd-pipeline-on-gitlab-1fn3</guid>
      <description>&lt;h1&gt;
  
  
  🔁 Building a Self-Healing CI/CD Pipeline on GitLab
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Auto-resume from stuck jobs. Improve resilience. Save time.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🤔 The Problem: Flaky Pipelines, Delayed Delivery
&lt;/h2&gt;

&lt;p&gt;If you've worked with CI/CD in GitLab long enough, you've likely run into this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pipelines hang or fail midway because a GitLab runner disconnects.&lt;/li&gt;
&lt;li&gt;A flaky environment causes a single failed job — and the entire pipeline restarts.&lt;/li&gt;
&lt;li&gt;No checkpointing, no fallback... just re-run from the top.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These issues waste time, delay releases, and block engineering focus.&lt;/p&gt;

&lt;p&gt;So I built something to fix it.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔧 Introducing: GitLab Self-Healing Pipeline Framework
&lt;/h2&gt;

&lt;p&gt;A fully open-source system that allows your pipelines to automatically &lt;strong&gt;resume from the last successful stage&lt;/strong&gt; — without manual intervention.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/gThiru/gitlab-self-healing-pipeline" rel="noopener noreferrer"&gt;gThiru/gitlab-self-healing-pipeline&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 How It Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Each stage of your GitLab pipeline records progress to &lt;code&gt;.ci-progress.json&lt;/code&gt; (shared volume)&lt;/li&gt;
&lt;li&gt;A Python watchdog script checks these files on a schedule (cron or Kubernetes)&lt;/li&gt;
&lt;li&gt;If a pipeline is &lt;strong&gt;stuck&lt;/strong&gt; or &lt;strong&gt;timed out&lt;/strong&gt;, it:

&lt;ul&gt;
&lt;li&gt;Reads the last successful stage&lt;/li&gt;
&lt;li&gt;Triggers a new pipeline with &lt;code&gt;RESUME_STAGE&lt;/code&gt; set to the next needed stage&lt;/li&gt;
&lt;li&gt;Enforces retry limits and pipeline age cutoffs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🧰 Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🟣 &lt;strong&gt;GitLab CI/CD&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🐍 &lt;strong&gt;Python&lt;/strong&gt; for watchdog&lt;/li&gt;
&lt;li&gt;📂 &lt;strong&gt;Shared mount&lt;/strong&gt; (e.g. NFS, EFS) across runners&lt;/li&gt;
&lt;li&gt;⏱️ &lt;strong&gt;Linux cron&lt;/strong&gt; or &lt;strong&gt;Kubernetes CronJob&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔐 &lt;strong&gt;Environment-safe&lt;/strong&gt; with retry guardrails&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔍 Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Pipeline resumes from last good stage&lt;/li&gt;
&lt;li&gt;✅ JSON-based per-pipeline tracking&lt;/li&gt;
&lt;li&gt;✅ Retry limit + max age protection&lt;/li&gt;
&lt;li&gt;✅ Works in hybrid GitLab runner setups&lt;/li&gt;
&lt;li&gt;✅ Dev-friendly Bash helper to update stage status&lt;/li&gt;
&lt;li&gt;✅ Linux + K8s CronJob support&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🏁 Quick Example
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;.gitlab-ci.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$RESUME_STAGE&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;==&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"test"&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;||&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$RESUME_STAGE&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;==&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;""'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;build&lt;/code&gt; job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ./update_stage_status.sh
update_stage_status build in_progress
&lt;span class="c"&gt;# ... your build steps ...&lt;/span&gt;
update_stage_status build &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 OSS Ready
&lt;/h2&gt;

&lt;p&gt;This project is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Released under MIT License&lt;/li&gt;
&lt;li&gt;✅ Submitted to &lt;a href="https://github.com/wmariuss/awesome-devops" rel="noopener noreferrer"&gt;awesome-devops&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;✅ Includes full documentation, examples, templates&lt;/li&gt;
&lt;li&gt;🏁 Ready for production use in GitLab-based orgs&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🌱 What's Next
&lt;/h2&gt;

&lt;p&gt;I'm planning to add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Job-level tracking (not just stage)&lt;/li&gt;
&lt;li&gt;Webhook-based watchdog&lt;/li&gt;
&lt;li&gt;S3/GCS support instead of local disk&lt;/li&gt;
&lt;li&gt;Slack/email notifications on resume&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🙌 Get Involved
&lt;/h2&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/gThiru/gitlab-self-healing-pipeline" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;br&gt;&lt;br&gt;
💫 Star it if you like it&lt;br&gt;&lt;br&gt;
💬 Open issues or suggest ideas&lt;br&gt;&lt;br&gt;
🤝 Contributions are welcome!&lt;/p&gt;




&lt;p&gt;📢 Let’s build smarter pipelines, together.&lt;/p&gt;

&lt;p&gt;— &lt;em&gt;Thirunavukkarasu Ganesan&lt;/em&gt;&lt;br&gt;&lt;br&gt;
DevOps Manager / Architect&lt;/p&gt;

</description>
      <category>devops</category>
      <category>gitlab</category>
      <category>pipeline</category>
      <category>cicd</category>
    </item>
  </channel>
</rss>
