CI/CD Task Automation and Real-Time Monitoring Based on Argo Workflows
On a GitOps-based platform, every intermediate step, from the moment a developer clicks the build or deploy button until the actual Pod is running and receiving traffic, must be automated and shown in real time. This article covers an architecture that standardizes Tasks with Argo Workflows and streams progress through Server-Sent Events.
Task Type Classification
Section titled “Task Type Classification”Tasks handled by the platform are broadly divided into two categories.
| Type | Details | Description |
|---|---|---|
| CI | Build | Source checkout, image build, registry push |
| CD | Deploy | Namespace, Deployment, Service, Ingress, HPA |
| CD | Resource | Resource changes after deployment (replicas, resource limits) |
| CD | Helm | Helm chart deployment and upgrade |
| CD | Job | One-time Jobs and CronJob schedule changes |
| CD | Storage | PVC creation |
All Tasks are defined as Argo WorkflowTemplates. CD manifests are managed in a Git repository and synchronized with the cluster through ArgoCD Applications. This ensures that both Task execution history and deployment status remain declarative.
Task Runner List
Section titled “Task Runner List”| Runner | Argo Type | Created Resources | Role |
|---|---|---|---|
| Project CD | Application | Namespace, ServiceAccount, RoleBinding, Secret | Creates project boundaries |
| App Service CI | Workflow | - | Builds source and pushes images |
| App Service CD | Application | Deployment, Service, Ingress, HPA | Deploys and modifies applications |
| Helm CD | Application | Helm manifest, values | Deploys and upgrades Helm charts |
| Job CD | Application | Job | Creates one-time Jobs |
| CronJob CD | Application | CronJob | Creates scheduled Jobs and changes schedules |
| Volume CD | Application | PVC | Provisions storage |
| Application Management | Workflow | Application | Deletes resources based on ArgoCD Apps |
Real-Time Status Streaming with Server-Sent Events
Section titled “Real-Time Status Streaming with Server-Sent Events”When a user starts a build, Workflow logs, Pod status, and Events must be displayed on screen in real time. To achieve this, the SSE (Server-Sent Events) pattern is used.
SSE Request Flow
Section titled “SSE Request Flow”- The Router API is deployed in the internal cluster (IC) and calls the SSE Service.
- The SSE API is deployed in the CQ (Control/Query) cluster and converts Kubernetes/Argo streams into SSE responses.
- The browser maintains a connection through an
EventSourceobject and receives server-sent events in real time.
APIs Provided Through SSE
Section titled “APIs Provided Through SSE”| API | Target | Purpose |
|---|---|---|
| Pipeline Log | Argo Workflow log stream | CI/CD process logs (Workflow main logs) |
| Pod List | k8s pod list watch | Retrieves the application Pod list |
| Pod Metric | k8s pod status stream | Retrieves Pod CPU/Memory and status in real time |
| Pod Log | k8s pod log stream | Streams logs for an individual Pod |
| Pod Event | k8s event watch | Pod creation, restart, and error events (for future use) |
Service Architecture: Separating Task, Monitoring, and Summary
Section titled “Service Architecture: Separating Task, Monitoring, and Summary”The platform API is divided into three responsibilities.
Task Service: Workflow Execution and Control
Section titled “Task Service: Workflow Execution and Control”
- Create Workflows (
submit_workflow) - Retrieve the Workflow list (
list_workflows) - Retrieve the archived Workflow list (logs for each step)
- Cancel Workflows (
stop_workflow)
Monitoring Service: SSE Streaming
Section titled “Monitoring Service: SSE Streaming”- Workflow log streams
- Archived Workflow log files
- Workflow status streams
- Pod list watch
- Pod metric streams
- Pod log streams
Summary Service: Asynchronous Aggregation
Section titled “Summary Service: Asynchronous Aggregation”- Watches Workflow events and stores the final CI/CD status in Redis.
- Watches Pod status and stores the running status in Redis.
- For views that must display a large amount of data at once, such as the application list page, individual REST APIs cannot provide sufficient performance; instead, pre-aggregated data is served from Redis.
Next Steps
Section titled “Next Steps”The actual Platform API design built on this Task automation architecture is covered next in GitOps Platform API Design Patterns. Repository structure and deployment strategy are covered in GitOps Repository Structure Design.