ADR-002: Feature Branch Strategy

Status

Accepted

Context

Development teams need isolated environments for testing features without impacting shared dev environment. Creating/destroying these environments must be self-service.

Decision

Implement dynamic feature branch environments using:

  1. Naming convention: feature-<ticket-id>

  2. Automated creation via script

  3. ArgoCD applications with 7-day TTL

  4. Minimal resource allocation

  5. Automatic cleanup after expiry

./scripts/create-feature-env.sh TICKET-123 mysql
# Creates: namespace=feature-ticket-123
#          ArgoCD app=feature-ticket-123
#          Ingress=feature-ticket-123.rd.friendly-tech.com

Consequences

Positive

  • Self-service environment creation (5 minutes)

  • No waiting for DevOps

  • Parallel feature development

  • Isolated testing

  • Automatic cleanup prevents waste

  • Scales to 50+ concurrent feature branches

Negative

  • Additional cluster resources needed

  • More complex monitoring

  • Developers must remember to clean up

  • Name collision possible (mitigated by lowercasing + sanitization)

Implementation Details

  • Resource quotas limit feature branch resources

  • TTL annotations trigger auto-cleanup

  • Reduced replicas and resource limits vs dev

  • Network policies isolate namespaces

  • Shared ArgoCD project manages all feature apps

Alternatives Considered

  1. Shared dev environment - Rejected, too many conflicts

  2. Long-lived staging environments - Rejected, not enough for all teams

  3. Local docker-compose only - Rejected, doesn’t match production

  4. VM per feature - Rejected, too slow to provision

References

Decision date: 2024-11