DynTek, rSolutions, and Arctiq Consolidate Under a Unified Brand: Arctiq
Visit Arctiq.com
An outlined icon of an X
left arrow icon
Back to Blogs
January 18, 2021
Author:
ArctiqTeam Member

CICD Pipelines using Gitlab CI & Argo CD with Anthos Config Management

Last year I posted a demo of using GitLab CI and ArgoCD with Anthos Config Management. It's been a popular video on our YouTube Channel.

{% include video name="iUjXbNzaMl8" %}

{% include image name="gitlabargoblogcomments_rnewiu.jpg" size="M" position="right" alt="" %}

But, every comment has been asking for the configuration files 😄

Unfortunately, I can't make the repos public so I will use this blog to go over the configuration.

CI Workflow

{% include image name="GitLab_CI_-_Argo_CD-_arch-diagram_xcwdxp.png" size="XXL" alt="" %}

The architecture for this workflow separates CI and CD into two different streams and repositories. When a developer checks in code against the source repository, a GitLab CI job is triggered. This can be achieved using only and except specs in GitLab CI.

An example of building the app where the image is built with the commit SHA everytime there is a merge request against the dev branch.

Update tags

Once the image is pushed to the registry (in my case its GCR), our GitLab workflow needs to know the updated image tag. The image tag is stored as an environment variable in GitLab CI. Using GitLab's API, this variable can be updated.

CD Workflow

Once the image is updated in GitLab CI environment variables, the image is updated and committed to the Anthos Config Management repository. This ACM repository is hooked to Anthos clusters to automatically deploy configurations from Git. I am using envsubst to achieve this. Other tools can also be used.

Deployment to Dev

The ArgoCD application within ACM looks like this:

Where the image tag is replaced with commit short SHA. Once this change is commited to ACM, ArgoCD will detect the change, synchronize the application and deploy to the dev cluster which is specified with configmanagement.gke.io/cluster-selector: selector-env-dev in ACM.

At this point, the application can be verified in dev. Once, happy with the change, the merge request can be merged to master which will trigger the production deployment.

Deployment to Prod

And as dev, once this change is detected, ACM updates ArgoCD and ArgoCD deploys the new instance in prod.

Hope this blog summarizes the workflow covered in the video. If you want to discuss this topic further please feel free to reach out, we would love to hear from you.

//take the first step

Related Posts