Lewati ke konten utama
menjadi.dev
Chapter 21.5 DevOps Lanjutan

Team Workflow dan Best Practices

Kolaborasi efektif dalam tim development

Tujuan Pembelajaran

  • Mengerti semantic versioning
  • Bisa menggunakan Git tags dan releases
  • Mengerti team collaboration best practices

Analogi

Diagram

      Team Workflow:
├── Semantic Versioning (MAJOR.MINOR.PATCH)
├── Git Tags & Releases
├── Conventional Commits
└── Documentation culture
    

Kolaborasi yang efektif membutuhkan convention, dokumentasi, dan komunikasi yang jelas

Penjelasan Konsep

Bekerja dalam tim tidak hanya tentang coding — ini tentang komunikasi, convention, dan budaya kolaborasi.

Chapter ini menutup modul Git dengan best practices untuk bekerja dalam tim.

Semantic Versioning (SemVer)

Format versi: MAJOR.MINOR.PATCH

  • MAJOR: Breaking changes (incompatible API changes)
  • MINOR: New features (backward compatible)
  • PATCH: Bug fixes (backward compatible)

Contoh: v2.1.3 → MAJOR=2, MINOR=1, PATCH=3

Kenapa SemVer penting?

Developer lain yang menggunakan library-mu bisa tahu apakah upgrade aman atau perlu perubahan kode.

Git Tags dan Releases

Tag menandai commit tertentu sebagai versi:

git tag -a v1.0.0 -m “Release version 1.0.0” git push origin v1.0.0

atau push semua tags:

git push origin —tags

GitHub otomatis membuat Release dari tag — bisa attach binary, changelog,

Dan notes.

Conventional Commits

Format commit message yang standar:

<type>(<scope>): <description>

[optional body]

[optional footer]

Tipe commit:

  • feat: Fitur baru
  • fix: Bug fix
  • docs: Dokumentasi
  • style: Formatting (tidak mempengaruhi kode)
  • refactor: Refactor kode
  • test: Menambah test
  • chore: Maintenance

Contoh:

feat(auth): add JWT token refresh mechanism

  • Implement refresh token rotation
  • Add token expiry check middleware
  • Update login response to include refresh token

Closes #234

Team Collaboration Best Practices

  1. Communication:
  • Over-communicate daripada under-communicate
  • Update status secara regular
  • Tanya kalau tidak yakin — jangan asumsi
  1. Code Ownership:
  • CODEOWNERS file untuk assign reviewer otomatis
  • Tidak ada ‘my code’ — semua code adalah team code
  1. Documentation:
  • README dengan setup instructions
  • Architecture Decision Records (ADR)
  • API documentation
  1. Meetings:
  • Daily standup: apa yang dikerjakan, blockers
  • Sprint planning: commit untuk sprint
  • Retrospective: apa yang berjalan baik, apa yang perlu diperbaiki
  1. Onboarding:
  • Dokumentasi setup environment
  • Pair programming untuk minggu pertama
  • Checklist onboarding

Conflict Resolution

Git conflict tidak bisa dihindari dalam tim.

Strategi:

  1. Pull sebelum push — selalu
  2. Rebase branch secara regular
  3. Komunikasi kalau mengerjakan file yang sama
  4. Resolve conflict segera — jangan biarkan menumpuk

Contoh Kode

bash
# Semantic Versioning in practice
# Current version: v1.2.3

# Bug fix → v1.2.4
git commit -m "fix(api): handle null response from external service"
git tag -a v1.2.4 -m "Patch: fix null pointer exception"

# New feature → v1.3.0
git commit -m "feat(dashboard): add monthly revenue chart"
git commit -m "feat(dashboard): export chart to PNG"
git tag -a v1.3.0 -m "Minor: add dashboard charts and export"

# Breaking change → v2.0.0
git commit -m "feat(api)!: remove deprecated v1 endpoints

BREAKING CHANGE: /api/v1/users removed. Use /api/v2/users instead."
git tag -a v2.0.0 -m "Major: API v2 with breaking changes"

# GitHub CODEOWNERS example
# .github/CODEOWNERS
/src/auth/     @security-lead
/src/api/      @backend-team
/src/ui/       @frontend-team
*.config.ts    @devops-lead
/docs/         @tech-writer

Penjelasan Kode

BREAKING CHANGE: footer flag untuk commit yang merusak backward compatibility. CODEOWNERS memastikan PR ke area tertentu direview oleh expert yang sesuai.

Prompt AI

Implementasikan Conventional Commits di proyek-mu. Buat changelog otomatis dari commit history menggunakan tool seperti 'git-cliff' atau 'semantic-release'.

Pertanyaan Reflektif

Tim yang bagus bukan tim yang tidak pernah punya konflik — tapi tim yang tahu cara resolve konflik dengan konstruktif.