CI/CD Pipelines

Set up automated build and deployment pipelines for your applications.

Create a Pipeline

curl -X POST http://localhost:8080/api/v1/pipelines \
  -H "Content-Type: application/json" \
  -d '{
    "name": "deploy-on-push",
    "app_id": "app_your_id",
    "trigger": "push",
    "branch": "main",
    "steps": ["build", "test", "deploy"]
  }'

Trigger Types

TriggerDescription
pushAutomatically runs on git push to the specified branch
manualOnly runs when manually triggered
scheduleRuns on a cron schedule

Manual Trigger

curl -X POST http://localhost:8080/api/v1/pipelines/pipe_your_id/runs

View Pipeline Runs

curl http://localhost:8080/api/v1/pipelines/pipe_your_id/runs
[
  {
    "id": "run_001",
    "status": "success",
    "duration_ms": 45000,
    "started_at": "2024-01-15T10:30:00Z",
    "finished_at": "2024-01-15T10:30:45Z"
  }
]

Webhook-Based Triggers

Combine pipelines with webhooks for event-driven deployments:
  1. Create a webhook for app.deployed events
  2. Trigger downstream pipelines or notifications
  3. Use event rules for complex automation workflows
# Create an event rule that triggers a pipeline
curl -X POST http://localhost:8080/api/v1/event-rules \
  -H "Content-Type: application/json" \
  -d '{
    "name": "notify-on-deploy",
    "event": "app.deployed",
    "action": "webhook",
    "action_config": {
      "url": "https://slack.com/api/webhook/your-hook"
    }
  }'

Pipeline Status Reference

StatusDescription
pendingQueued for execution
runningCurrently executing steps
successAll steps completed
failedA step failed
cancelledManually stopped

Best Practices

  1. Use main branch for production — trigger deploys only from stable branches
  2. Add a test step — catch issues before deployment
  3. Set up notifications — use webhooks to alert on failures
  4. Review pipeline logs — check run history for debugging