This tutorial demonstrates a CI/CD pipeline using GitOps principles with ArgoCD through a practical example.
In this tutorial, we demonstrate how a CI/CD pipeline can leverage GitOps principles using ArgoCD through a practical example. The demo follows a streamlined four-step process:
A developer clones the Solr system repository, makes modifications, and pushes them to a feature branch.
A Jenkins job builds the application using a Jenkinsfile.
A pull request is created in the Kubernetes manifest repository; once reviewed, it’s merged.
The ArgoCD application detects the changes, synchronizes the new configuration, and performs a rollback if needed.
Each stage is detailed below, complete with diagrams and code examples.
The process begins with the developer cloning the Solr system repository, making the necessary updates, and pushing them. The diagram below illustrates the overall software development and deployment process:
A user story requires replacing a static solar system image with an animated version. The repository includes key files like Dockerfile, Jenkinsfile, index.php, and images.First, the developer inspects a local directory that contains the new image files:
With the updated code in the repository, the next step is setting up the Jenkins job. A new pipeline project called “solar system dynamic demo” is created with the following configuration:
Pull Request Creation:
A shell script (pr.sh) utilizes curl to raise a pull request automatically:
Copy
Ask AI
bash pr.sh
The output confirms that the pull request has been successfully created:
Copy
Ask AI
Opening a Pull Request% Total % Received % Xferd Average Speed Time Time Current...{"id":13,"url":"http://139.59.21.103:3000/siddharth/gitops-argocd/pulls/10", ... }
A snapshot of the Git repository interface depicting commits, branches, and files is shown below:
Once the pull request is merged, the ArgoCD application synchronizes the changes. Two applications are used:
One monitors the feature branch.
The other monitors the production (main) branch.
They are deployed to separate namespaces and exposed via NodePort. The following dashboard shows their status:
After synchronizing the feature app, changes like the animated background and updated solar system view are visible. The Jenkins pipeline logs also display an updated deployment.yaml file, similar to:
Following the merge into the main branch, the production ArgoCD application initially becomes out of sync. Synchronizing it updates the deployment accordingly. Below is a snapshot of the deployment management dashboard:
Post-deployment, user feedback indicated that the flashy animated background was not ideal. Using the ArgoCD UI, an administrator can perform a rollback to a previously stable version by selecting the desired version from the application’s history and clicking the rollback option.
Always validate the UI changes after a rollback to ensure the production system remains stable.
Once confirmed, the production UI reverts to displaying the previously stable version of the solar system, ensuring users see the version they preferred.
This walkthrough illustrated how CI/CD pipelines integrate GitOps with ArgoCD to automate the entire release process – from code modification and Jenkins-driven builds to deployment updates and rollbacks. By leveraging tools like Jenkins for build automation and ArgoCD for deployment management, teams can ensure rapid, reliable, and reversible releases.For more insights into CI/CD and GitOps, check out the following resources: