πΌ Pipeline Template Philosophy¶
π― Template vs ConfiguraciΓ³n EspecΓfica¶
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β AQUΓ (INFRA) β EN MΓDULOS ESPECΓFICOS β β βββββββββββββββββββββββββββββββͺβββββββββββββββββββββββββββββββββββββββββββββ£ β Estructura de stages β QuΓ© hace cada stage β β Variables parametrizadas β Valores especΓficos β β Steps genΓ©ricos β Comandos especΓficos β β Trigger patterns β Branch rules especΓficas β β Artifact handling pattern β Artifacts especΓficos a subir β β Runner/agent requirements β Runners especΓficos (GPU, audio, etc) β β Notification skeleton β Notificaciones especΓficas β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π DiseΓ±o de Templates¶
Principios Core¶
-
Parametrizable con Variables
-
Extensible vΓa Includes
-
Reusable entre Proyectos
- No asumir estructura de directorios especΓfica
- Variables para todas las paths
-
Sin dependencias de herramientas especΓficas hardcoded
-
Self-Documenting
- Comentarios explican cada secciΓ³n
- Variables claramente nombradas
- Ejemplos de uso incluidos
π Uso Pattern¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FLUJO DE TRABAJO β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 1. Copiar template relevante β
β cp pipeline_templates/github_workflows_template.yml β
β .github/workflows/build.yml β
β β
β 2. Rellenar variables β
β $DEFAULT_BRANCH β main β
β $BUILD_TYPE β Release β
β $RUNNER_OS β ubuntu-latest β
β β
β 3. Customizar stages necesarios β
β - Agregar stage de packaging β
β - Agregar stage de code signing β
β - Agregar stage de deployment β
β β
β 4. Commit en mΓ³dulo especΓfico β
β git add .github/workflows/build.yml β
β git commit -m "Add CI pipeline for module X" β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Templates Disponibles¶
1. GitHub Actions Template¶
Archivo: github_workflows_template.yml
CaracterΓsticas: - Multi-OS build matrix - Artifact upload/download - Cache dependencies - PR comments - Status badges
Uso ideal para: - Open source projects - Public repositories - Projects using GitHub ecosystem
2. GitLab CI Template¶
Archivo: gitlab_ci_template.yml
CaracterΓsticas: - Pipeline stages - Job dependencies - Artifact passing between stages - GitLab-specific features (merge request pipelines)
Uso ideal para: - Self-hosted GitLab - Enterprise projects - Projects requiring complex DAG pipelines
3. Jenkins Template¶
Archivo: jenkins_template.groovy
CaracterΓsticas: - Declarative pipeline syntax - Agent selection - Post-build actions - Workspace cleanup
Uso ideal para: - Legacy CI/CD infrastructure - Complex enterprise builds - On-premise build servers
π§ Customization Guide¶
Nivel 1: Variables BΓ‘sicas¶
Solo reemplazar variables $VARIABLE_NAME:
Nivel 2: Agregar Steps¶
Insertar steps adicionales en stages existentes:
# Template
- name: Build
run: echo "Build commands here"
# Customizado
- name: Setup Audio Drivers
run: sudo apt-get install libasound2-dev
- name: Build
run: cmake --build build --config Release
Nivel 3: Agregar Stages¶
Agregar stages completamente nuevos:
# Agregar despuΓ©s de 'test' stage
- name: Package
run: cpack -G DEB
- name: Code Sign
run: codesign --sign "$CERT" build/AudioLab.vst3
Nivel 4: Modificar LΓ³gica¶
Cambiar triggers, conditions, matrix builds:
# Template
on:
push:
branches: [ $DEFAULT_BRANCH ]
# Customizado para release automation
on:
push:
tags:
- 'v*.*.*'
π¨ Template Variables Convention¶
Naming Convention¶
$UPPER_SNAKE_CASE - Para reemplazo manual
${env.CamelCase} - Para variables de entorno (GitHub Actions)
$CI_VARIABLE_NAME - Para variables CI built-in (GitLab)
${params.variable} - Para parΓ‘metros de build (Jenkins)
Common Variables¶
| Variable | Description | Example Value |
|---|---|---|
$DEFAULT_BRANCH |
Main branch name | main, master, develop |
$BUILD_TYPE |
CMake build type | Release, Debug, RelWithDebInfo |
$CMAKE_VERSION |
CMake version | 3.25, 3.28 |
$RUNNER_OS |
CI runner OS | ubuntu-latest, macos-13, windows-2022 |
$ARTIFACT_PATH |
Build artifacts | build/*.vst3, dist/* |
$AGENT_LABEL |
Jenkins agent | linux-audio, windows-build |
$TEST_COMMAND |
Test execution | ctest, pytest, npm test |
π Security Best Practices¶
β DO in Templates:¶
-
Use Secrets for Sensitive Data
-
Pin Action Versions
-
Minimal Permissions
-
Validate Inputs
β DON'T in Templates:¶
-
No Hardcoded Secrets
-
No Overly Broad Triggers
-
No Arbitrary Code Execution
π Template Maintenance¶
Versioning Strategy¶
pipeline_templates/
βββ v1/
β βββ github_workflows_template.yml
β βββ gitlab_ci_template.yml
βββ v2/ # Breaking changes
β βββ github_workflows_template.yml # Updated
β βββ gitlab_ci_template.yml
βββ latest/ # Symlink to current version
βββ github_workflows_template.yml -> ../v2/github_workflows_template.yml
Update Policy¶
- Patch updates: Bug fixes, documentation improvements
- Minor updates: New features, backward-compatible
- Major updates: Breaking changes, require migration
Migration Guides¶
When templates change significantly, provide migration docs:
# Migrating from v1 to v2
## Breaking Changes
- Variable naming: `$BRANCH` β `$DEFAULT_BRANCH`
- Stage renamed: `build` β `compile`
## Migration Steps
1. Update variable names in your pipeline
2. Rename stage references
3. Test in feature branch
4. Deploy to production
π§ͺ Testing Templates¶
Validation Checklist¶
Before committing template changes:
- Syntax validation (yamllint, shellcheck)
- Variable placeholders clearly marked
- Comments explain non-obvious sections
- Example usage provided
- Works on all target platforms
- Security review completed
- Documentation updated
Example Test¶
# Validate GitHub Actions YAML
yamllint github_workflows_template.yml
# Check for common mistakes
grep -r "hardcoded_password" .
grep -r "TODO" .
π Documentation Requirements¶
Each template must include:
- Header Comment - Purpose, usage, variables
- Inline Comments - Explain each major section
- Variable Documentation - What each variable controls
- Example - Complete working example
π Related Documents¶
- Individual template files in this directory
- Module-specific pipeline configs (in respective modules)
- CI/CD Best Practices (if exists)
- Secrets Management