A Buildkite plugin for deploying and rolling back ArgoCD applications with comprehensive health monitoring, log collection, and notification capabilities.
The plugin requires the following tools to be pre-installed on your Buildkite agents:
- ArgoCD CLI (
argocd
) - Installation Guide - jq - JSON processor
The plugin requires ArgoCD authentication via environment variables. You must set these before your ArgoCD plugin steps:
ARGOCD_SERVER
- ArgoCD server URL (can be set in the plugin step)ARGOCD_USERNAME
- ArgoCD username (can be set in the plugin step)ARGOCD_PASSWORD
- ArgoCD password (use your desired 3rd party secret management solution and fetched before the ArgoCD plugin steps)
steps:
# Fetch secrets once for entire pipeline
- label: "π Fetch ArgoCD Credentials"
key: "fetch-argocd-secrets"
plugins:
# Choose your secret management solution:
- secrets#v1.0.0: # Buildkite Secrets
env:
ARGOCD_PASSWORD: your-secret-key
# OR
- vault-secrets#v2.2.1: # HashiCorp Vault
server: ${VAULT_ADDR}
secrets:
- path: secret/argocd/password
field: ARGOCD_PASSWORD
# OR
- aws-sm#v1.0.0: # AWS Secrets Manager
secrets:
- name: ARGOCD_PASSWORD
key: argocd/password
# OR
- aws-ssm#v1.0.0: # AWS SSM Parameter Store
parameters:
ARGOCD_PASSWORD: /argocd/password
# All ArgoCD steps use the fetched credentials
- label: "π Deploy Application"
depends_on: "fetch-argocd-secrets"
plugins:
- argocd_deployment#v1.0.0:
app: "my-app"
argocd_server: "https://argocd.example.com" # if not set in environment variables
argocd_username: "admin" # if not set in environment variables
- π Deploy and Rollback: Support for both deployment and rollback operations
- π₯ Health Monitoring: Real-time application health checks via ArgoCD API
- π Log Collection: Automatic collection of ArgoCD application and pod logs
- π€ Artifact Upload: Upload deployment logs and artifacts to Buildkite
- π Notifications: Slack notifications via Buildkite integration
- π§ Manual Rollback Workflow: Interactive block steps for manual rollback decisions
- β‘ Auto Rollback: Automatic rollback on deployment failures
- π― Smart Rollback Logic: Temporarily disables auto-sync during rollbacks to prevent conflicts
- π Comprehensive Annotations: Beautiful success/failure annotations with detailed information
- Validation: Plugin validates ArgoCD connectivity and application existence
- Pre-deployment: Captures current application state and revision for rollback
- Deployment: Executes ArgoCD sync operation
- Auto mode: Completes full health check cycle, then automatic rollback to a previous deployment on failure
- Manual mode: Fails immediately on first health check failure to save time, then interactive block step
- Log Collection: Collects ArgoCD app logs and pod logs (if enabled)
- Artifact Upload: Uploads logs and deployment artifacts to Buildkite
- Notifications: Sends Slack notifications on rollback events
- Annotations: Creates beautiful success/failure annotations with detailed information
- Validation: Plugin validates ArgoCD connectivity and target revision
- Rollback Execution:
- Auto mode: Executes ArgoCD rollback to a previous deployment if auto mode is used
- Manual mode: Executes ArgoCD rollback to specified revision if manual mode is used
- Log Collection: Collects ArgoCD app logs and pod logs (if enabled)
- Artifact Upload: Uploads logs and deployment artifacts to Buildkite
- Notifications: Sends Slack notifications on rollback events
- Annotations: Creates beautiful success/failure annotations with detailed information
The name of the ArgoCD application to deploy or rollback.
Operation mode. Defaults to "deploy"
.
deploy
: Deploy the applicationrollback
: Rollback the application
Rollback mode for handling deployment failures.
- For
mode: "deploy"
: Defaults to"auto"
auto
: Automatic rollback to previous version on health check failuremanual
: Manual rollback with interactive block step for user decision
- For
mode: "rollback"
: Required, no defaultauto
: Rollback to previous versionmanual
: Rollback to specific revision with user confirmation
Timeout in seconds for ArgoCD operations. Defaults to 300
. Must be between 30 and 3600 seconds.
ArgoCD server URL. Can also be set via ARGOCD_SERVER
environment variable. Supports:
- Full URL:
https://argocd.example.com
- ELB DNS name:
a84b3c9fe815e4047a19a04966cc5ff1-2002834036.us-east-1.elb.amazonaws.com:443
- ELB IP address:
52.206.16.12:443
- Kubernetes service:
argocd-server.argocd.svc.cluster.local:443
ArgoCD username. Can also be set via ARGOCD_USERNAME
environment variable.
Target revision for rollback operations. Accepts ArgoCD History IDs or Git commit SHAs.
π‘ Important: ArgoCD only returns the last 10 deployment history entries by default. For manual rollbacks, use recent History IDs (visible in
argocd app history <app-name>
) or commit SHAs from recent deployments. Older deployments may not be available for rollback.
Health check interval in seconds. Defaults to 30
. Must be between 10 and 300 seconds.
Health check timeout in seconds. Defaults to 300
. Must be between 60 and 1800 seconds.
Collect application logs on deployment. Defaults to false
.
Number of log lines to collect. Defaults to 1000
. Must be between 100 and 10000.
Upload logs and deployment artifacts. Defaults to false
.
Notification settings for rollback events.
Slack channel, username, or user ID for notifications using Buildkite's native Slack integration. Supports:
- Channel names:
#deployments
,#alerts
- Usernames:
@username
,@devops-team
- User IDs:
U123ABC456
Safe deployments with automatic rollback on health check failures:
steps:
- label: "π Deploy Application"
plugins:
- secrets#v1.0.0:
variables:
ARGOCD_PASSWORD: argocd_password
- argocd_deployment#v1.0.0:
app: "my-app"
argocd_server: "https://argocd.example.com"
argocd_username: "admin"
mode: "deploy"
rollback_mode: "auto" # Default: also enabled if unset
collect_logs: true
upload_artifacts: true
Manual rollback workflow with interactive block steps for user decision:
steps:
- label: "π« Deploy with Manual Rollback"
plugins:
- secrets#v1.0.0:
variables:
ARGOCD_PASSWORD: argocd_password
- argocd_deployment#v1.0.0:
app: "my-app"
argocd_server: "https://argocd.example.com"
argocd_username: "admin"
mode: "deploy"
rollback_mode: "manual" # Interactive rollback decision
collect_logs: true
upload_artifacts: true
notifications:
slack_channel: "#deployments"
Explicit rollback to a specific revision:
steps:
- label: "π Manual Rollback"
plugins:
- secrets#v1.0.0:
variables:
ARGOCD_PASSWORD: argocd_password
- argocd_deployment#v1.0.0:
app: "my-app"
argocd_server: "https://argocd.example.com"
argocd_username: "admin"
mode: "rollback"
rollback_mode: "manual"
target_revision: "370" # Recent ArgoCD History ID
collect_logs: true
upload_artifacts: true
Elastic Stack | Agent Stack K8s | Local Agents (Mac/Linux) | Hosted Agents (Mac/Linux) |
---|---|---|---|
β | β | β | β |
- β Fully supported - Tested and verified; all agent types require the ArgoCD CLI to be pre-installed. Hosted Agents may require installation via pipeline.
To run linting and shellchecks, use bk run
with the Buildkite CLI:
We welcome contributions! Please follow these guidelines:
- Fork the repository and create a feature branch
- Write tests for any new functionality
- Run linting with
bk run
before submitting - Follow shell best practices - use shellcheck-compliant code
- Update documentation - keep README and CHANGELOG current
- Submit a pull request with a clear description of changes
For bug reports and feature requests, please open an issue.
The package is available as open source under the terms of the MIT License.