Testar grátis
7 min leitura Guide 526 of 877

Integrando Pipelines CI/CD com GitScrum

Pipelines CI/CD automatizam build e deployment, mas desconectados do gerenciamento de projeto criam lacunas de visibilidade. As integrações CI/CD do GitScrum atualizam automaticamente status de tarefas baseado em eventos do pipeline, fornecendo visibilidade de deployment em tempo real e conectando mudanças de código ao progresso do projeto.

Pontos de Integração CI/CD

Estágio PipelineAção GitScrumBenefício
Branch criadoVincular à tarefaRastreabilidade
PR abertoComentar na tarefaVisibilidade
Build falhaComentar + alertarFix rápido
Build passaAtualizar statusRastreamento progresso
Deploy em stagingTransicionar tarefaPronto para teste
Deploy em produçãoCompletar tarefaRastreamento release

Arquitetura de Integração

FLUXO CI/CD PARA GITSCRUM

┌─────────────────────────────────────────────────┐
│                DESENVOLVIMENTO                  │
│                                                 │
│  1. Desenvolvedor cria branch                   │
│     Branch: feature/TASK-234-busca-usuario      │
│                 │                               │
│                 ▼                               │
│  2. Commits referenciam tarefa                  │
│     "TASK-234: Implementar API de busca"        │
│                 │                               │
│                 ▼                               │
│  3. Abre Pull Request                           │
│     → GitScrum: Comentário adicionado TASK-234  │
│       "PR #567 aberto: [link]"                  │
└─────────────────────────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│                PIPELINE CI                      │
│                                                 │
│  4. Build & Teste                               │
│     ├── Se FALHA → Comentar na TASK-234         │
│     │              "Build falhou: [logs]"       │
│     │                                           │
│     └── Se PASSA → Comentar na TASK-234         │
│                   "Build passou ✓"              │
│                 │                               │
│                 ▼                               │
│  5. Code Review Aprovado                        │
│     → GitScrum: TASK-234 → "Em Review"          │
│                 │                               │
│                 ▼                               │
│  6. Merge para main                             │
│     → GitScrum: TASK-234 → "Pronto para Deploy" │
└─────────────────────────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│                PIPELINE CD                      │
│                                                 │
│  7. Deploy para Staging                         │
│     → GitScrum: TASK-234 → "Em Staging"         │
│       Comentário: "Deploy em staging [link]"    │
│                 │                               │
│                 ▼                               │
│  8. Deploy para Produção                        │
│     → GitScrum: TASK-234 → "Done"               │
│       Comentário: "Lançado em v2.3.4"           │
└─────────────────────────────────────────────────┘

Configuração de Webhooks

SETUP DE WEBHOOKS

WEBHOOKS DE ENTRADA (CI/CD → GitScrum):
┌─────────────────────────────────────────────────┐
│  Endpoint: /api/webhooks/ci-cd                  │
│                                                 │
│  Eventos a enviar:                              │
│  ├── build.started                              │
│  ├── build.completed                            │
│  ├── build.failed                               │
│  ├── deploy.started                             │
│  ├── deploy.completed                           │
│  └── deploy.failed                              │
│                                                 │
│  Estrutura do payload:                          │
│  {                                              │
│    "event": "build.completed",                  │
│    "task_id": "TASK-234",                       │
│    "status": "success",                         │
│    "details": {                                 │
│      "build_url": "...",                        │
│      "commit": "abc123",                        │
│      "duration": "3m 42s"                       │
│    }                                            │
│  }                                              │
└─────────────────────────────────────────────────┘

WEBHOOKS DE SAÍDA (GitScrum → CI/CD):
┌─────────────────────────────────────────────────┐
│  Trigger: Mudança de status da tarefa para      │
│           "Deploy"                              │
│                                                 │
│  Ação: Iniciar pipeline de deployment           │
│                                                 │
│  Payload:                                       │
│  {                                              │
│    "task_id": "TASK-234",                       │
│    "environment": "staging",                    │
│    "initiated_by": "joao@empresa.com"           │
│  }                                              │
└─────────────────────────────────────────────────┘

Automação de Status

Regras de Transição

AUTOMAÇÃO DE STATUS DE TAREFAS:
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│ REGRAS DE TRANSIÇÃO BASEADAS EM EVENTOS:                    │
│                                                             │
│ Evento               │ De           │ Para                 │
│ ─────────────────────┼──────────────┼──────────────────────│
│ Branch criado        │ Backlog      │ Em Progresso         │
│ PR aberto            │ Em Progresso │ Em Review            │
│ Build passa          │ Em Review    │ Em Review            │
│ Review aprovado      │ Em Review    │ Pronto Deploy        │
│ Deploy staging       │ Pronto Deploy│ Em Staging           │
│ Deploy produção      │ Em Staging   │ Done                 │
│                                                             │
│ COMENTÁRIOS AUTOMÁTICOS:                                    │
│                                                             │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ 🔄 Build #1234 iniciado                                ││
│ │    Commit: abc123                                       ││
│ │    Branch: feature/TASK-234-busca                       ││
│ │    Iniciado por: @joao                                  ││
│ └─────────────────────────────────────────────────────────┘│
│                                                             │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ ✅ Build #1234 passou                                   ││
│ │    Duração: 3m 42s                                      ││
│ │    Testes: 234/234 passaram                            ││
│ │    Cobertura: 85%                                       ││
│ │    [Ver logs]                                           ││
│ └─────────────────────────────────────────────────────────┘│
│                                                             │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ 🚀 Deployado em Staging                                 ││
│ │    Versão: v2.3.4-rc1                                   ││
│ │    URL: https://staging.app.com                         ││
│ │    Deploy #567                                          ││
│ └─────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────┘

Convenções de Nomenclatura

Vinculando Código a Tarefas

CONVENÇÕES DE VINCULAÇÃO:
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│ NOME DE BRANCH:                                             │
│ ═══════════════                                             │
│ feature/TASK-234-descricao-curta                           │
│ bugfix/BUG-567-corrigir-login                              │
│ hotfix/TASK-890-patch-critico                              │
│                                                             │
│ MENSAGEM DE COMMIT:                                         │
│ ═══════════════════                                         │
│ TASK-234: Implementar endpoint de busca                    │
│ BUG-567: Corrigir validação de sessão                      │
│ TASK-234: [WIP] Adicionar testes unitários                 │
│                                                             │
│ TÍTULO DE PR:                                               │
│ ══════════════                                              │
│ [TASK-234] Implementar API de busca de usuários            │
│ [BUG-567] Corrigir bug de autenticação                     │
│                                                             │
│ PARSING NO CI/CD:                                           │
│ ══════════════════                                          │
│ # Extrair ID da tarefa do nome da branch                   │
│ TASK_ID=$(echo $BRANCH | grep -oE 'TASK-[0-9]+')           │
│                                                             │
│ # Extrair da mensagem de commit                            │
│ TASK_ID=$(git log -1 --format=%s | grep -oE 'TASK-[0-9]+') │
│                                                             │
│ # Atualizar GitScrum                                       │
│ curl -X POST "https://api.gitscrum.com/tasks/$TASK_ID" \   │
│      -H "Authorization: Bearer $TOKEN" \                   │
│      -d '{"comment": "Build passou ✓"}'                    │
└─────────────────────────────────────────────────────────────┘

Dashboard de Deployment

Visibilidade de Release

DASHBOARD DE VISIBILIDADE DE DEPLOYMENT:
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│ DEPLOYMENTS RECENTES                                        │
│ ════════════════════                                        │
│                                                             │
│ PRODUÇÃO (v2.3.4)                                           │
│ └── 15 Jan 2024, 14:30 UTC                                 │
│     ├── TASK-234: Busca de usuários                        │
│     ├── TASK-567: Melhoria de performance                  │
│     └── BUG-890: Fix de login                              │
│                                                             │
│ STAGING (v2.3.5-rc1)                                        │
│ └── 15 Jan 2024, 16:45 UTC                                 │
│     ├── TASK-891: Dashboard de analytics                   │
│     └── TASK-892: Export de relatório                      │
│                                                             │
│ PIPELINE STATUS:                                            │
│ ════════════════                                            │
│ Build #1234: ✅ Passou (3m 42s)                            │
│ Tests:       ✅ 234/234 passaram                           │
│ Staging:     ✅ Deployado                                  │
│ Produção:    ⏳ Aguardando aprovação                       │
│                                                             │
│ TAREFAS POR AMBIENTE:                                       │
│ ═══════════════════════                                     │
│ Em Desenvolvimento: 5                                      │
│ Em Review:          3                                      │
│ Em Staging:         2                                      │
│ Em Produção:        127                                    │
└─────────────────────────────────────────────────────────────┘

Benefícios

BenefícioSem IntegraçãoCom Integração
Atualização statusManual, esqueceAutomático
RastreabilidadePerdidaCompleta
VisibilidadeLimitadaTempo real
Tempo gastoAlto overheadZero overhead

Soluções Relacionadas