5 min lectura • Guide 523 of 877
Integrando Pipelines CI/CD con GitScrum
Los pipelines CI/CD automatizan build y deployment, pero desconectados de la gestión de proyectos crea gaps de visibilidad. Las integraciones CI/CD de GitScrum actualizan automáticamente el estado de tareas basado en eventos del pipeline, proporcionando visibilidad de deployment en tiempo real y conectando cambios de código con progreso del proyecto.
Puntos de Integración CI/CD
| Etapa del Pipeline | Acción GitScrum | Beneficio |
|---|---|---|
| Branch creado | Enlazar a tarea | Trazabilidad |
| PR abierto | Comentar en tarea | Visibilidad |
| Build falla | Comentar + alertar | Fix rápido |
| Build pasa | Actualizar estado | Tracking de progreso |
| Deploy a staging | Transicionar tarea | Listo para testing |
| Deploy a producción | Completar tarea | Tracking de release |
Arquitectura de Integración
FLUJO CI/CD A GITSCRUM
┌─────────────────────────────────────────────────┐
│ DESARROLLO │
│ │
│ 1. Developer crea branch │
│ Branch: feature/TASK-234-user-search │
│ │ │
│ ▼ │
│ 2. Commits referencian tarea │
│ "TASK-234: Implementar API de búsqueda" │
│ │ │
│ ▼ │
│ 3. Abre Pull Request │
│ → GitScrum: Comentario agregado a TASK-234 │
│ "PR #567 abierto: [enlace]" │
└─────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ PIPELINE CI │
│ │
│ 4. Build & Test │
│ ├── Si FALLA → Comentar en TASK-234 │
│ │ "Build falló: [logs]" │
│ │ │
│ └── Si PASA → Comentar en TASK-234 │
│ "Build pasó ✓" │
│ │ │
│ ▼ │
│ 5. Code Review Aprobado │
│ → GitScrum: TASK-234 → "En Review" │
│ │ │
│ ▼ │
│ 6. Merge a main │
│ → GitScrum: TASK-234 → "Listo para Deploy" │
└─────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ PIPELINE CD │
│ │
│ 7. Deploy a Staging │
│ → GitScrum: TASK-234 → "En Staging" │
│ Comentario: "Deployado a staging [link]" │
│ │ │
│ ▼ │
│ 8. Deploy a Producción │
│ → GitScrum: TASK-234 → "Done" │
│ Comentario: "Released en v2.3.4" │
└─────────────────────────────────────────────────┘
Configuración de Webhooks
CONFIGURACIÓN DE WEBHOOKS
WEBHOOKS ENTRANTES (CI/CD → GitScrum):
┌─────────────────────────────────────────────────┐
│ Endpoint: /api/webhooks/ci-cd │
│ │
│ Eventos a enviar: │
│ ├── build.started │
│ ├── build.completed │
│ ├── build.failed │
│ ├── deploy.started │
│ ├── deploy.completed │
│ └── deploy.failed │
│ │
│ Estructura del payload: │
│ { │
│ "event": "build.completed", │
│ "task_id": "TASK-234", │
│ "status": "success", │
│ "details": { │
│ "build_url": "...", │
│ "commit": "abc123", │
│ "duration": "3m 42s" │
│ } │
│ } │
└─────────────────────────────────────────────────┘
WEBHOOKS SALIENTES (GitScrum → CI/CD):
┌─────────────────────────────────────────────────┐
│ Trigger: Cambio de estado de tarea a "Deploy" │
│ │
│ Acción: Iniciar pipeline de deployment │
│ │
│ Payload: │
│ { │
│ "task_id": "TASK-234", │
│ "environment": "staging", │
│ "initiated_by": "jane@company.com" │
│ } │
└─────────────────────────────────────────────────┘
Convenciones de Branch y Commit
CONVENCIONES DE ENLACE A TAREAS
NOMENCLATURA DE BRANCH:
┌─────────────────────────────────────────────────┐
│ Patrón: <tipo>/TASK-<id>-<descripcion> │
│ │
│ Ejemplos: │
│ feature/TASK-234-user-search │
│ bugfix/TASK-567-login-timeout │
│ hotfix/TASK-890-payment-fix │
│ │
│ CI extrae: TASK-234 del nombre del branch │
└─────────────────────────────────────────────────┘
MENSAJE DE COMMIT:
┌─────────────────────────────────────────────────┐
│ Patrón: TASK-<id>: <mensaje> │
│ │
│ Ejemplos: │
│ TASK-234: Agregar endpoint de búsqueda │
│ TASK-234: Agregar paginación de resultados │
│ TASK-234: Corregir inyección en query │
│ │
│ Múltiples tareas: │
│ TASK-234, TASK-235: Refactorizar módulo │
└─────────────────────────────────────────────────┘
TÍTULO DE PR:
┌─────────────────────────────────────────────────┐
│ Patrón: [TASK-<id>] <descripción> │
│ │
│ Ejemplo: │
│ [TASK-234] Implementar búsqueda de usuarios │
└─────────────────────────────────────────────────┘
Ejemplo de GitHub Actions
# .github/workflows/build-notify.yml
name: Build and Notify GitScrum
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract Task ID
id: task
run: |
TASK_ID=$(echo "${{ github.head_ref }}" | grep -oP 'TASK-\d+')
echo "task_id=$TASK_ID" >> $GITHUB_OUTPUT
- name: Build
run: npm run build
- name: Notify GitScrum - Success
if: success()
run: |
curl -X POST "$GITSCRUM_API/tasks/${{ steps.task.outputs.task_id }}/comments" \
-H "Authorization: Bearer ${{ secrets.GITSCRUM_TOKEN }}" \
-d '{"text": "✅ Build passed for PR #${{ github.event.number }}"}'
- name: Notify GitScrum - Failure
if: failure()
run: |
curl -X POST "$GITSCRUM_API/tasks/${{ steps.task.outputs.task_id }}/comments" \
-H "Authorization: Bearer ${{ secrets.GITSCRUM_TOKEN }}" \
-d '{"text": "❌ Build failed. Check logs: ${{ github.run_url }}"}'
Mejores Prácticas
- Convención consistente de nombres de branch/commit
- Parsear ID de tarea automáticamente en CI
- Comentar en tareas para builds y deploys
- Transicionar estados automáticamente
- Enlazar artefactos (PRs, builds, deploys)
- No spamear - filtrar notificaciones importantes