In the fast-paced world of DevOps tools, platforms like GitLab are constantly evolving, frequently adding new native features that may eliminate the need for custom solutions. Before diving into custom development — which can be both tempting and powerful — it's crucial to thoroughly check the latest documentation to ensure you're not reinventing functionality that's already built into the platform.
This blog post explores how we approached the challenge of automating base image updates across multiple projects using GitLab's extension capabilities, while emphasizing a key principle: always verify what's natively supported before building custom solutions.
If you're managing multiple applications that depend on the same base container images (i.e, microservices architecture), you're likely familiar with this scenario: a new base image version is released with critical security patches or performance improvements, and now dozens of dependent applications need to be updated, tested, and redeployed.
Manually updating each project is not only tedious but error-prone and inconsistent. What starts as a simple update can quickly consume days of engineering time, delaying the rollout of important security patches and creating unnecessary technical debt.
At Arctiq, we've tackled this challenge by leveraging GitLab's powerful APIs and webhooks to create a custom automated solution that drastically reduces update times and ensures consistency across projects.
While we'll showcase base image updates in this example, the principles and approaches we discuss can be applied to numerous other cross-project automation scenarios.
Before diving into automation strategies, it's important to understand typical base image update patterns. According to Red Hat's documentation on base image vulnerability tracking:
This predictable pattern creates both challenges and opportunities: while frequent updates increase security maintenance overhead, their regularity makes them ideal candidates for automation.
Before arriving at our webhook-based solution, we went through an earlier implementation phase that's worth discussing as it highlights important design considerations.
Our first attempt used a polling approach: when a pipeline ran for any target project, it would check if a newer version of the base image was available. This check was implemented as a consistent, maintained part of our build system libraries.
While this solution worked, it had significant drawbacks:
These limitations led us to develop the webhook-based solution described earlier, which actively notifies and updates all dependent projects, regardless of their activity level. This ensures consistent base image versions across our entire ecosystem and simplifies release coordination.
Before diving into our implementation, it's worth emphasizing a critical approach we follow at Arctiq:
For our base image update challenge, we reviewed GitLab's capabilities before deciding that an API/webhook-based approach was the most appropriate solution for our specific requirements.
Our final approach leveraged GitLab's group webhooks and APIs to create a fully automated pipeline that:
This automation shifts what was previously a multi-day manual process into a 30-minute automated workflow, ensuring that security patches and updates are applied consistently and quickly across your entire application portfolio. Most importantly, it guarantees that all projects are updated - not just the active ones - which is critical for release coordination and security compliance.
Here's how we update configuration files across multiple projects using GitLab's API:
# Get the current file content |
While this implementation uses relatively simple API calls, it's important to note that GitLab frequently adds new features. Always check the latest documentation to see if there might be newer, more streamlined approaches to achieving similar results.
The automation flow begins when a new tag is pushed to your base image repository:
When a new version of your base image is tagged (e.g., v1.2.3), this triggers the base image project's CI/CD pipeline to build and publish the updated container.
Once the base image is published, a group webhook is triggered. This webhook notifies all projects within the specified GitLab group and its subgroups about the update.
For each notified project where appropriate, our automation:
With this system in place, we can now easily verify that all components in an upcoming release are using the latest approved base image versions. Before a release, we simply:
This verification step, which was almost impossible with our previous polling-based approach, is now straightforward and reliable.
Our journey from polling to push-based notifications taught us several valuable lessons about extending GitLab at scale:
The polling model (having projects check for updates) seems simpler but can leave projects behind. A push model (actively notifying projects of updates) ensures comprehensive coverage but requires more complex implementation.
When triggering updates across many projects simultaneously, consider the impact on your GitLab infrastructure. Random delays, queuing systems, or batch processing can help prevent overwhelming your runners.
# Example of random delay implementation in .gitlab-ci.yml |
Schedule regular reviews of your custom solutions against GitLab's evolving feature set to determine if native functionality has made your custom code obsolete.
By evolving from a polling-based to a push-based approach, we've achieved significant improvements:
The pattern we've established for base image updates can be applied to numerous other scenarios:
For each of these applications, we recommend first checking whether GitLab has since added native support for these workflows, as the platform is constantly evolving.
References
At Arctiq, we specialize in helping organizations implement DevOps best practices and optimization strategies. Our approach combines:
Our commitment to these principles and deep GitLab expertise are formally recognized. Arctiq is a GitLab Select Partner, delivering specialized services to ensure client success. We have also earned the Professional Services Partner (PSP) designation with GitLab, highlighting our proven ability to help customers plan, implement, and optimize their DevSecOps practices. More details about our GitLab partnership are available here.
With our extensive experience across Git-based platforms, public clouds, CI/CD, and system integrations, we can help you navigate the rapidly evolving landscape of DevOps tools - knowing when to leverage native features and when custom solutions truly add value.
Ready to optimize your DevOps processes? Contact us today to discuss your specific needs and discover how we can help you achieve greater efficiency and automation.