@codigodoleo/wp-kit 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,127 +1,85 @@
1
- # Pipeline CI/CD - {{projectTitle}} Website
1
+ # Deploy Pipeline
2
2
 
3
- ## Visão Geral
3
+ CI/CD flow for **{{projectTitle}}** — what runs on each push, where it
4
+ deploys, and how to debug a failed run.
4
5
 
5
- Pipeline automatizado para deploy do WordPress da {{projectTitle}} com integração ao fluxo de desenvolvimento da equipe.
6
+ ## Stack
6
7
 
7
- ## Ambientes e Triggers
8
+ - **CI/CD platform**: {{ciSystem}}
9
+ - **Repository**: [{{repositoryPath}}]({{repositoryWebUrl}})
10
+ - **Deploy strategy**: `{{ "{{TODO: Docker push + remote pull / SSH rsync / Kubernetes apply / serverless deploy}}" }}`
8
11
 
9
- ### Development
12
+ ## Environments and triggers
10
13
 
11
- - **Trigger**: Push na branch `develop`
12
- - **Namespace**: `website-dev`
13
- - **URL Cache**: `assets-site.static{{projectName}}.com/development/`
14
+ | Branch | Environment | URL | Auto-deploy |
15
+ | --- | --- | --- | --- |
16
+ | `development` | Development | https://{{projectDevDomain}} | Yes |
17
+ | `staging` | Staging | https://{{projectStagingDomain}} | Yes |
18
+ | `main` | Production | https://{{projectProductionDomain}} | `{{ "{{TODO: yes / requires manual approval}}" }}` |
14
19
 
15
- ### Staging
20
+ Tags (`vX.Y.Z`) cut releases. `{{ "{{TODO: clarify whether tags promote to production or just create artefacts}}" }}`
16
21
 
17
- - **Trigger**: Push na branch `staging`
18
- - **Namespace**: `website-stg`
19
- - **URL Cache**: `assets-site.static{{projectName}}.com/staging/`
22
+ ## Pipeline stages
20
23
 
21
- ### Production
24
+ ```mermaid
25
+ graph LR
26
+ A[Push / {{prTermShort}}] --> B[Lint]
27
+ B --> C[Test]
28
+ C --> D[Build]
29
+ D --> E{Branch?}
30
+ E -- development --> F[Deploy dev]
31
+ E -- staging --> G[Deploy staging]
32
+ E -- main --> H[Deploy production]
33
+ F --> I[Smoke check]
34
+ G --> I
35
+ H --> I
36
+ ```
22
37
 
23
- - **Trigger**: Push na branch `master` (apenas de branches `release/*` ou `hotfix/*`)
24
- - **Namespace**: `website-prod`
25
- - **URL Cache**: `assets-site.static{{projectName}}.com/production/`
38
+ ### Lint
26
39
 
27
- ## Stages do Pipeline
40
+ - ESLint, Stylelint, Prettier (from the `lint` module of wp-kit).
41
+ {{#if useSage}}- Laravel Pint on the Sage theme.
42
+ {{/if}}- Commitlint on the {{prTermShort}} title and commits.
28
43
 
29
- ### 1. Validation
44
+ ### Test
30
45
 
31
- - **kubeval**: Valida arquivos Kubernetes antes do deploy
46
+ - `{{ "{{TODO: Pest / PHPUnit suite}}" }}`
47
+ - Playwright E2E specs under `tests/e2e/`.
32
48
 
33
- ### 2. Compiler
49
+ ### Build
34
50
 
35
- - **build-wordpress**: Compila tema e plugins WordPress
51
+ - `composer install --no-dev --optimize-autoloader`
52
+ {{#if useSage}}- `npm ci && npm run build` inside `content/themes/{{projectName}}`
53
+ {{/if}}- Image build: `{{ "{{TODO: docker build / no image, deploy artefact directly}}" }}`
36
54
 
37
- ### 3. Image Build
55
+ ### Deploy
38
56
 
39
- - **image-build**: Constrói imagem Docker com tag do commit
57
+ `{{ "{{TODO: describe deploy mechanism per environment. Examples:}}" }}`
40
58
 
41
- ### 4. Deploy
59
+ - *Docker push + remote pull*: build, push to `{{ "{{TODO: registry}}" }}`, SSH to remote, `docker compose pull && docker compose up -d`.
60
+ - *Kubernetes*: `kubectl apply -f k8s/<env>/` (or `helm upgrade --install`).
61
+ - *Cloud-managed (ECS / Cloud Run / App Runner)*: trigger service update with new image tag.
62
+ - *SSH rsync*: `rsync -av --delete ./ user@host:/var/www/{{projectName}}/`.
42
63
 
43
- - **deploy**: Deploy no ambiente (manual)
44
- - **clear-cache**: Limpa cache do Cloudflare
64
+ ## Secrets
45
65
 
46
- ### 5. Tests
66
+ `{{ "{{TODO: list secret variable names used by the pipeline and where they live (GitHub Secrets / GitLab CI variables / Vault / cloud secret manager). Do NOT paste secret values into this file.}}" }}`
47
67
 
48
- - **smoke-stg-website**: Testes de fumaça no staging
49
- - **smoke-prod-website**: Testes de fumaça na produção
68
+ ## Debugging a failed run
50
69
 
51
- ### 6. Rollback
70
+ 1. Open the run in {{ciSystem}}.
71
+ 2. Find the first failing step — later steps usually fail as a consequence.
72
+ 3. For test/lint failures: reproduce locally with the same command from the workflow file.
73
+ 4. For deploy failures: check the target environment's logs (`{{ "{{TODO: link to log dashboard}}" }}`).
74
+ 5. For flaky failures: re-run the failed job. If it passes, file a ticket — flakiness compounds.
52
75
 
53
- - **rollback**: Executado automaticamente em caso de falha
76
+ ## Rolling back
54
77
 
55
- ## Fluxo de Desenvolvimento Integrado
78
+ `{{ "{{TODO: describe rollback procedure. Common patterns:}}" }}`
56
79
 
57
- ### Feature Development
80
+ - Re-run the deploy job pinned to the previous tag / image SHA.
81
+ - Re-deploy by clicking "redeploy" on the prior successful run in {{ciSystem}}.
82
+ - `kubectl rollout undo deployment/<name>` for Kubernetes.
83
+ - Restore from the most recent database backup if the rollback also reverts data.
58
84
 
59
- 1. Desenvolver na branch `feature/*`
60
- 2. Merge para `develop` → Deploy automático no Development
61
- 3. Teste no ambiente de desenvolvimento
62
-
63
- ### Release Process
64
-
65
- 1. Criar branch `release/*` a partir de `develop`
66
- 2. Merge para `staging` → Deploy no Staging
67
- 3. Testes de aceitação no staging
68
- 4. Merge para `master` → Deploy manual na Production
69
-
70
- ### Hotfix Process
71
-
72
- 1. Criar branch `hotfix/*` a partir de `master`
73
- 2. Deploy direto na production após aprovação
74
- 3. Backport para `develop` e `staging`
75
-
76
- ## Jobs Principais
77
-
78
- | Job | Objetivo | Quando Executa |
79
- | ----------------- | ------------------------ | --------------------- |
80
- | `build-wordpress` | Compila código WordPress | Todos os pushes |
81
- | `image-build` | Cria imagem Docker | Após compilação |
82
- | `deploy` | Deploy no K8s | Manual (staging/prod) |
83
- | `clear-cache` | Limpa cache CDN | Após deploy |
84
- | `smoke-tests` | Valida deploy | Após deploy |
85
-
86
- ## Configurações Importantes
87
-
88
- - **Registry**: `$CI_REGISTRY_IMAGE:latest`
89
- - **Kubernetes**: Oracle Cloud Infrastructure (OCI)
90
- - **CDN**: Cloudflare
91
- - **Storage**: PVC com `ReadWriteMany`
92
-
93
- ## Monitoramento
94
-
95
- - Logs disponíveis no GitLab CI/CD
96
- - Métricas de performance via smoke tests
97
- - Notificações de falha automáticas
98
-
99
- ## ⚠️ Restauração de Banco de Dados (Staging)
100
-
101
- > **🚨 AÇÃO DESTRUTIVA - ACESSO RESTRITO**
102
- > Este processo substitui completamente o banco de dados do staging pelos dados de produção.
103
- > **Permitido apenas para:** Desenvolvedores Seniores e Owners
104
- > **Consequência:** Todos os dados atuais do staging serão **perdidos permanentemente**
105
-
106
- ### 📋 Processo de Restauração
107
-
108
- 1. **🎯 Acesse o GitLab:**
109
- - Navegue até [CI/CD → Schedules]({{repositoryWebUrl}}/-/pipeline_schedules)
110
-
111
- 2. **📥 Backup do Banco de Produção:**
112
- - Clique no botão ▶️ **Play** no pipeline agendado `Download Prod Database`
113
- - ⏱️ Aguarde a conclusão (cria backup e armazena no bucket S3)
114
-
115
- 3. **🔄 Replicação para Staging:**
116
- - Após finalizar o step anterior, clique no botão ▶️ **Play** no pipeline `Replicate Production DB into Staging DB`
117
- - 📦 Este job utiliza o backup armazenado no bucket S3
118
-
119
- 4. **✅ Finalização:**
120
- - Staging atualizado com dados de produção
121
- - 🧪 Execute testes para validar a integridade dos dados
122
-
123
- ### ⚡ Importante
124
-
125
- - ⏰ O processo pode levar alguns minutos dependendo do tamanho do banco
126
- - 🔍 Monitore os logs dos jobs para identificar possíveis erros
127
- - 📞 Em caso de problemas, contate imediatamente a equipe de infraestrutura
85
+ Document the rollback you actually used in the post-mortem.