ci: gate redeploy step on workflow_dispatch.deploy=true #4

Merged
root merged 2 commits from feat/portainer-redeploy-step into main 2026-07-10 13:12:04 +02:00
Owner

Resumen

  • ci-cd.yaml: añade un 4º step 'Redeploy stack on Portainer' que solo se ejecuta cuando el workflow se dispara manualmente con deploy=true.
  • docs/ci-optimization-proposal.md: documento nuevo que describe la anatomía del CI, métricas a capturar en el primer deploy, cuellos de botella hipotéticos y propuestas de optimización rankeadas por ROI. Marcado como Draft: los huecos [METRIC] se rellenarán tras el primer deploy real.

Cambios

  • .gitea/workflows/ci-cd.yaml: build empuja tanto :latest como :0.0.1. El step 3 (redeploy) hace DELETE+CREATE idempotente contra la API de Portainer y smoke-testea el puerto interno.
  • docs/ci-optimization-proposal.md: nuevo.

Secrets requeridos (ya creados en este repo)

  • PORTAINER_URL=http://192.168.1.30:9000
  • PORTAINER_TOKEN=***
  • PORTAINER_ENDPOINT_ID=2
  • PORTAINER_STACK_ID=139

Plan de deploy

  1. Merge a main tras aprobación.
  2. Disparar primer run sin deploy=true (solo build+push).
  3. Verificar imagen gitlab.impresion3d.pro/root/davidaragon-portfolio:0.0.1 en el registry.
  4. Disparar segundo run con deploy=true → primer redeploy real.

Riesgo

Bajo. El step de deploy es idempotente (DELETE devuelve 404 si ya no existe y sigue con CREATE). El primer run sin deploy=true no toca Portainer en absoluto.

## Resumen - **ci-cd.yaml**: añade un 4º step 'Redeploy stack on Portainer' que solo se ejecuta cuando el workflow se dispara manualmente con `deploy=true`. - **docs/ci-optimization-proposal.md**: documento nuevo que describe la anatomía del CI, métricas a capturar en el primer deploy, cuellos de botella hipotéticos y propuestas de optimización rankeadas por ROI. Marcado como Draft: los huecos `[METRIC]` se rellenarán tras el primer deploy real. ## Cambios - `.gitea/workflows/ci-cd.yaml`: build empuja tanto `:latest` como `:0.0.1`. El step 3 (redeploy) hace DELETE+CREATE idempotente contra la API de Portainer y smoke-testea el puerto interno. - `docs/ci-optimization-proposal.md`: nuevo. ## Secrets requeridos (ya creados en este repo) - `PORTAINER_URL=http://192.168.1.30:9000` - `PORTAINER_TOKEN=***` - `PORTAINER_ENDPOINT_ID=2` - `PORTAINER_STACK_ID=139` ## Plan de deploy 1. Merge a main tras aprobación. 2. Disparar primer run sin `deploy=true` (solo build+push). 3. Verificar imagen `gitlab.impresion3d.pro/root/davidaragon-portfolio:0.0.1` en el registry. 4. Disparar segundo run con `deploy=true` → primer redeploy real. ## Riesgo Bajo. El step de deploy es idempotente (DELETE devuelve 404 si ya no existe y sigue con CREATE). El primer run sin deploy=true no toca Portainer en absoluto.
root added 2 commits 2026-07-10 13:11:46 +02:00
- Build pushes both :latest and :0.0.1 tags so the redeploy step uses the
  pinned version regardless of how the runner happened to be tagged before.
- Add a 4th step 'Redeploy stack on Portainer' that runs ONLY when the
  workflow is manually dispatched with deploy=true.
- Step does idempotent DELETE+CREATE on the existing stack via Portainer REST
  (PUT-edit would require more plumbing for a single-service stack).
- Smoke-tests http://<host>:3001/ after the stack recreates; logs the code
  but does not hard-fail the job (network-proxy reachable via NPM upstream).

Required new secrets (in addition to existing DOCKER_USERNAME/DOCKER_PASSWORD):
- PORTAINER_URL         e.g. http://192.168.1.30:9000
- PORTAINER_TOKEN       API access token from a Portainer user
- PORTAINER_ENDPOINT_ID numeric endpoint ID (usually 1)
- PORTAINER_STACK_ID    numeric stack ID to delete before recreating
docs: add CI/CD optimization proposal (draft, post-first-deploy to refine)
CI/CD Pipeline / Build & Deploy (pull_request) Successful in 1m7s
70129b1e9f
Documents the current pipeline anatomy, the metrics to capture on the
first real run, hypothesised bottlenecks, and ranked optimisation
proposals. Placeholders for real numbers; to be filled in after the
first deploy lands.

Companion to the Portainer redeploy step in .gitea/workflows/ci-cd.yaml
on the same branch.
root merged commit fc1fd96145 into main 2026-07-10 13:12:04 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: root/davidaragon-portfolio#4