Complete Ovillo CI/CD guide — the /hv:cicd-* workflows and all their variants
For developers. How Ovillo's four CI/CD workflows work and how they behave according to your adoption phase, stack, entrypoints (multi-entrypoint), branching strategy and deployment model.
Platform: Azure DevOps Server 2020 on-premise, with the configured agent pool. Runtime rules: the G1-G19 invariants live in
.claude/skills/cicd-runtime/SKILL.md; the platform's constraints are declared inecosystem.config.json(cicd.platform+cicd.variant).
0. The mental model (read this first)
Three ideas that explain everything else:
- Build ≠ deploy. A push to the base branch builds (compile + test + artifact), but it does not deploy. Deploying is a later decision and on demand (
/hv:cicd-deploy). "Releasing" a version (/hv:cicd-release) does not deploy either: it only creates the tag and triggers the build. - The agent deploys, not your machine. The commands only queue the pipeline over REST; the MSDeploy to the target IIS runs on a deploy agent that lives on the server itself. Never copy files by hand.
- One solution = one repository, but N entrypoints. Each deployable project (Web, API, Console) gets its own pipeline (R25). Routing to the application or services servers is decided by the entrypoint's type.
The four workflows at a glance
| Command | What it does | When |
|---|---|---|
/hv:cicd-init | Generates or updates the pipeline (azure-pipelines.yml + the Azure DevOps definition). A wizard, by phases. | Once per project/entrypoint, and when promoting a phase or updating the template. |
/hv:cicd-status | Shows the state: latest builds, time per stage, coverage, last deployment per environment, template drift. | Whenever you want to see how the pipeline is doing. |
/hv:cicd-release | Creates a semver tag + push → triggers the build. It does NOT deploy. | When you mark a version as ready. |
/hv:cicd-deploy | Requests the deployment to dev/pre/pro on demand (Azure: the DeployEnv variable · GitHub: gh workflow run -f environment=). | When you promote an artifact to an environment. |
1. Cross-cutting concepts (this is where "the variants" come from)
1.1 Adoption phases (0 / 1 / 2)
/hv:cicd-init asks for the adoption level (P0). It decides what gets generated:
| Phase | Name | What it generates | CD |
|---|---|---|---|
| 0 | Local only | Just the docs and manual runbook (RUNBOOK_DEPLOY_MANUAL.md). No Azure DevOps pipeline. | No |
| 1 | Build validation | A minimal azure-pipelines.yml: build + test + publish the artifact. One pipeline for the whole solution (CI only). | No |
| 2 | Full CD | The complete pipeline: build + test + gates + one pipeline per entrypoint with deploy stages, triple rollback, variable groups. | Yes |
Phase 1 = one build pipeline for the solution. The per-entrypoint pipelines with CD (Web→app, API→svc) are phase 2. Promoting 1→2 does not recreate from scratch (idempotence, R14): run
/hv:cicd-initagain and choose "promote".
See the detail in GUIA_FASES_ADOPCION.md.
1.2 Supported stacks (4 variants)
/hv:cicd-init detects the stack in PHASE 0.1 and generates the right template:
| Stack | Detection | CD to | Key notes |
|---|---|---|---|
.NET SDK-style (dotnet) | An SDK-style .csproj, net8/9/10 | IIS (MSDeploy) | Coverage gate G7/R18 (coverage-gate.ps1); per-environment config = a secrets vault or VG injection (R23). |
Classic .NET Framework (netfx) | packages.config + MVC5/WebApi2, net48 | IIS (MSDeploy) | MSBuild (NuGetCommand@2+VSBuild@1+VSTest@2); per-environment config = Web.<Cfg>.config transforms (R23). |
Vue + Vite + TS (vue) | package.json + vite | IIS (static files) | Best-effort smoke (R11); TakeAppOffline:false (R10); always to applications. |
.NET tool (nettool) | A NuGet tool or library | Not IIS | Publishes the .nupkg to an internal feed; no deploy stage (the security gate is informational, R22 N/A). |
The table of canonical task versions per stack is in R4.
1.3 Entrypoints and application-vs-services routing (R25)
Each repository = one solution, but it can have several entrypoint projects. /hv:cicd-init detects ALL of them (PHASE 0.1-ter) and generates one pipeline per deployable entrypoint:
| Entrypoint type | Detection | CI | CD | Target server |
|---|---|---|---|---|
| Web (UI) | Microsoft.NET.Sdk.Web with views (or MVC5 netfx) | yes | yes | Applications (public by nature) |
| Web API | Microsoft.NET.Sdk.Web without views | yes | yes | Services if private (default) · Applications if marked public |
| Console / Worker | OutputType=Exe without SDK.Web, IHostedService | yes | yes | configurable (scheduled task; the real pool's DeployTarget, with no fixed app/svc type) |
- In P1-bis the wizard shows the classification and, for each Web/API, asks whether it is public; it stores that in
_hilo/ESTADO_PROYECTO.json.infraestructura.cicd[].publico. - Routing →
serverType(app/svc) → the capabilityDeployTarget=<env>-<app|svc>(R1, R25). - Naming: one entrypoint →
azure-pipelines.yml+ the definition<PROJECT>(backwards compatible). More than one →azure-pipelines.<slug>.yml+ the definition<PROJECT>-<slug>, withtrigger.pathsnarrowed to that entrypoint's subtree.
The real
DeployTargetis derived from the pool (R1/FB-002):/hv:cicd-initqueries the agents' actual capabilities and maps each environment × type to an existing value (it does not hardcode<env>-<app|svc>if the infrastructure team used a different scheme).
The server inventory (Dev dev01/svc01, Pre demo01/demosvc01, Prod APPNODE*/SVCNODE*) and the capability scheme: the table in R1 plus the handoff in PERMISOS_CICD.md.
1.4 Deployment models (auto / on-demand / branch-gated)
/hv:cicd-init P2-bis asks for the deployment model (phase 2 only). The default is suggested by your branching strategy:
| Model | Deployment gate | When (default) |
|---|---|---|
| Auto | DEV automatic on push; PRE/PROD with ManualValidation/approval | Continuous CD to DEV, a single branch. |
| On-demand (R20) | DeployEnv=<env> (a push does not deploy) | 100% on-demand deployment, a single branch (github-flow, trunk-based, ...). |
| Branch-gated (R24) | DeployEnv plus Build.SourceBranch | On demand with branches per environment (gitlab-flow, gitflow). |
1.5 Branching strategy → trigger + branch policy (R21)
/hv:cicd-init reads configuracion.branching.estrategia and derives trigger.branches, plus whether to recommend the "Build validation" branch policy (which runs the build on PRs):
| Strategy | trigger.branches.include | Build-validation branch policy | Suggested deploy model |
|---|---|---|---|
github-flow-simplificado | [main] | NO (it would block the direct push) | on-demand |
trunk-based | [main] | optional | on-demand |
developer-branch | [{ramaBase}] | NO | on-demand |
github-flow | [main] | YES (PR gate to main) | on-demand |
gitflow | [main, develop, release/*] | YES | branch-gated |
release-flow / oneflow | [main, release/*] | YES | on-demand/branch-gated |
gitlab-flow | [main, pre-production, production] | YES | branch-gated |
The golden rule: direct-push strategies (
github-flow-simplificado,trunk-based,developer-branch) → base branch only +pr: none+ no policy (it warns: "do NOT enable build validation, it blocks your direct push"). Strategies with PRs → add the branches and recommend the policy. Alwayspr: nonein the YAML (in Azure DevOps Git the PR triggers are the branch policy, not the YAML'spr:).
1.6 Per-environment configuration and secrets
| Stack / case | How | Rule |
|---|---|---|
| Secrets (all of them) | An Azure DevOps variable group (<PIPELINE>-secrets, isSecret) + a pre-build fail-fast | R16 |
| netfx, per-environment configuration | Web.<Cfg>.config transforms (one build per environment) + a variable group for the secrets | R23 |
| .NET SDK-style with a secrets vault | AddAzureKeyVault(...); the deployment injects nothing | R23 (P4-bis) |
| .NET SDK-style without a secrets vault | Variable group + injection at deploy time through PowerShell (NOT FileTransform@1: it breaks with JSONC and with keys containing dots) | R23 (P4-bis) |
| The quality record's service key | Zero-touch: /hv:cicd-init PHASE 2.7 issues it through the Hub and leaves it isSecret in the variable group (it is never printed) | R16 |
1.7 Quality and security gates
- Coverage (R18): a gate with
ops/cicd/scripts/coverage-gate.ps1 -ThresholdLine/-ThresholdBranch(Ovillo's own script, no external tools;dotnet-reportgenerator-globaltool). WARN-first by default (it warns, it does not take the build down); the team raises it to BLOCK once their coverage is stable. ReportGenerator also publishes theCoverageReportHTML as an artifact; CRAP and hotspots go to the Hub's quality record. - Security (R22): the verdict-file pattern — the scan runs once in Build (vulnerable dependencies, secrets in config, hardening, Roslyn SAST) and each deploy stage decides: DEV=WARN, DEMO/PROD=BLOCK if the severity is ≥
High.
2. /hv:cicd-init — generate or update the pipeline
This is the central command. An idempotent wizard (R14): running it again breaks nothing.
2.1 Syntax and when to use it
/hv:cicd-init # interactive wizard (detects stack, entrypoints, phase)
Use it to: create the pipeline, promote a phase (0→1→2), add or modify a stage, or re-render the YAML to the latest template. Do NOT use it to deploy (/hv:cicd-deploy) or to version (/hv:cicd-release).
2.2 The flow (what happens inside)
PHASE 0 — Detection and pre-validation
- 0.1 Detects the stack (4 variants). If it is a Classic (XAML)
.xamlbuild → it aborts (not supported). - 0.1-ter Enumerates all the entrypoints of the solution and classifies them (Web/API/Console).
- 0.3-bis Brownfield: if there are pre-existing secrets in versioned config, the security gate is generated in
mode: warnfor PRE/PROD too (it does not block the first pipeline because of older debt; it recordsSEC-XXX). - 0.4 Pre-flight against Azure DevOps: the configured pool (
cicd.buildPool) visible, the queue authorized, and so on (the pool'sUsepermission is granted by the infrastructure team to the project's group — seePERMISOS_CICD.md). - 0.5 Idempotence: if
azure-pipelines.ymlalready exists, it goes into edit mode (five options, see 2.3).
PHASE 1 — The wizard (P0-P5)
- P0 Adoption phase (0/1/2).
- P1 / P1-bis Confirms the project + the entrypoints, and asks whether each Web/API is public (it stores all N).
- P2 Environments (phase ≥ 1).
- P2-bis The deployment model (auto/on-demand/branch-gated; the default follows the branching strategy).
- P3 A consolidated checklist (trigger, naming, smoke URL, ...) with inferred defaults → you confirm.
- P4 / P4-bis Variable groups / secrets + per-environment configuration (.NET SDK-style: vault versus VG injection).
- P5 Summary and final confirmation.
PHASE 2 — Generation
- Renders the stack's
*.yml.template, one pipeline per deployable entrypoint (Console included: CD through a scheduled task). - 2.5/2.6 Registers one Azure DevOps definition and one Hub record per entrypoint (
register_pipeline, UPSERT). - 2.7 (optional, yes by default) Wires up the quality record to the dashboard.
- 2.8 Self-check (
validate-pipeline-complete.ps1) + a template stamp in the YAML header (# Ovillo cicd-architect <stack> @ vX.Y.Z (tpl <hash>)) so drift can be detected later.
2.3 Edit mode (running it again on an already initialized project)
Before the options, it reconciles the entrypoints: it re-detects them and adds to cicd[] any that are missing. Then:
| Option | Action |
|---|---|
| 1 | Add a stage |
| 2 | Modify a stage |
| 3 | Regenerate the docs (runbook) |
| 4 | Update the whole YAML = a FULL re-render from the template (NOT a patch), preserving the # CUSTOM: blocks and the tests' --filter; it ends with the self-check (PHASE 2.8) |
| 5 | Exit |
If
/hv:cicd-statuswarns you about template drift, option 4 is the right way to get up to date.
3. /hv:cicd-status — seeing the state
/hv:cicd-status [--entrypoint <slug>] [--watch] [--last N] [--format json|csv] [--stage <name>]
- Reads
cicd.pipelines[](R25: one entry per entrypoint) and the platform (cicd.plataforma). By default it shows all of them;--entrypointnarrows it to one. - Phase 0: it reminds you of the manual deployment (the runbook).
- Phase ≥ 1: it asks the Hub MCP for
get_cicd_status; if that does not answer, it falls back straight to the platform:/_apis/build/builds(Azure DevOps) orgh run list+ deployments per environment (GitHub). It shows: the latest builds, time per stage, the coverage trend, and the last deployment per environment (phase 2). - 1.5 Template drift: it compares the YAML's
tpl <hash>stamp with the current hash of your stack's template. If it changed → it suggests/hv:cicd-initoption 4. (Informational, it does not block.) --watch: refreshes every 30s (useful during a deployment); on GitHub it follows the running job withgh run watch.
4. /hv:cicd-release — versioning and triggering the build
/hv:cicd-release [--major|--minor|--patch|--version X.Y.Z] [--deploy <dev|pre|pro>] [--no-push] [--no-gh-release] [--dry-run]
- It checks the working tree is clean and you are on the base branch. It computes the next semver. It creates an annotated tag (
-a) and pushes it. - The push triggers the build (compile + test + artifact). The deploy stages/jobs do NOT run (Azure: the
DeployEnvvariable is empty · GitHub: thedeploy-*jobs only run onworkflow_dispatch). On GitHub it also creates the tag's GitHub Release with generated notes (--no-gh-releaseskips it). For the .NET tool stack, av*tag does publish the package. --deploy <env>is an explicit shortcut (release → then/hv:cicd-deploy), never the default behaviour.- Do not confuse it with the ecosystem builder's own publishing command, which publishes the ecosystem's template.
5. /hv:cicd-deploy — deploying on demand
/hv:cicd-deploy --env <dev|pre|pro> [--entrypoint <slug>] [--tag vX.Y.Z | --commit <sha>] [--watch] [--dry-run] [--yes]
- Requires phase 2 (below phase 2 it aborts and suggests promoting).
--entrypoint: if there is more than one and it is omitted → it lists them and asks. Each entrypoint queues its own definition; itsDeployTarget=<env>-<app|svc>is already baked into the YAML.- Confirmation per environment (configurable in
cicd[].deployConfirm): Dev and Pre go straight through by default, Prod asks for confirmation (a double check).--yesforces it through (unless the project setsdeployConfirm[env]=true). - Azure: queues over REST with
parameters={DeployEnv:<env>}(R3 + R2 TLS 1.2); theDeploy<Env>stage only runs because of itscondition. GitHub:gh workflow run cd-<slug>.yml --ref <branch|tag> -f environment=<env>; only thedeploy-<env>job runs, and if the environment has reviewers the run waits for their approval on GitHub (the second gate). - Branch-gated (R24): the branch is derived from the environment (
dev/pre→develop,pro→main). Asking for--env profrom develop will not deploy (the per-branchconditiondoes not match) — the command warns you before queueing.
6. Complete flows (recipes)
6.1 A new .NET project, one entrypoint, github-flow
1. /hv:cicd-init → P0=phase 1 (build validation). Generates azure-pipelines.yml + the <PROJECT> definition.
Recommends enabling the build-validation branch policy (PR to main).
2. (push / PR) → the build runs and validates.
3. /hv:cicd-init → promotes to phase 2 (on-demand model). Generates the DeployDev/Pre/Prod stages + the secrets VG.
4. /hv:cicd-release --minor → tag v1.1.0 + build.
5. /hv:cicd-deploy --env pre → deploy to Pre (straight through). Verify.
6. /hv:cicd-deploy --env pro → deploy to Prod (asks for confirmation).
6.2 A multi-entrypoint solution (Web + private API + Console), gitflow
1. /hv:cicd-init → detects 3 entrypoints. P1-bis: Web=public(app), API=private(svc), Console=CD through a scheduled task.
P2-bis: branch-gated (the default for gitflow). Generates:
azure-pipelines.web.yml + def <PROJECT>-web (CD to applications)
azure-pipelines.api.yml + def <PROJECT>-api (CD to services)
azure-pipelines.console.yml + def <PROJECT>-console (CD, scheduled task)
2. push to develop → all three definitions build; the deployment does NOT run (DeployEnv empty).
3. /hv:cicd-deploy --env pre --entrypoint web → DeployDemo of Web, gated by DeployEnv=pre + the develop branch (R24).
4. (merge to main) /hv:cicd-deploy --env pro --entrypoint api → DeployProd of the API, gated by the main branch.
The Console has CD (R25) through a scheduled task (
schtasks; the deployment is a file sync,robocopy /MIR /XF appsettings). ItsDeployTargetis derived from the real pool (FB-002). The always-on Windows Service variant is deferred.
6.3 Legacy netfx (MVC5, .NET 4.8), per-environment configuration
1. /hv:cicd-init → detects netfx. Generates the MSBuild pipeline (NuGet+VSBuild+VSTest+MSDeploy).
Per-environment config = Web.<Cfg>.config transforms (one VSBuild and one package per environment).
Secrets in a variable group with XmlVariableSubstitution.
2. The rest is the same as 6.1 (release + on-demand deploy).
7. Quick table: "which command for what"
| I want to... | Command |
|---|---|
| Create the pipeline / promote a phase / re-render | /hv:cicd-init |
| See builds, coverage, the last deployment, drift | /hv:cicd-status |
| Mark a version and build it | /hv:cicd-release |
| Deploy to an environment | /hv:cicd-deploy |
| Audit the YAML against G1-G19 | the cicd-pipeline-reviewer agent (AUDITAR_PIPELINE.md) |
| Edit the YAML with suggestions | the cicd-architect skill |
| Deploy without a pipeline (phase 0) | RUNBOOK_DEPLOY_MANUAL.md |
8. Troubleshooting (consolidated)
| Symptom | Likely cause | Action |
|---|---|---|
/hv:cicd-deploy says requires phase 2 | The pipeline is in phase 0/1 | /hv:cicd-init → promote to phase 2 |
/hv:cicd-deploy (GitHub) says Workflow does not have 'workflow_dispatch' trigger, or a 404 | The workflow is not on the default branch, or it has no such trigger | Merge cd-<slug>.yml into main; /hv:cicd-init option 4 if the trigger is missing |
/hv:cicd-deploy (GitHub) leaves the run in waiting | The pre/pro environment has required reviewers | A reviewer approves it in Actions → Review deployments |
DeployEnv not valid at queue time | The YAML has no on-demand model | /hv:cicd-init option 4 (re-render) |
| The build queues but the Deploy stage is skipped | The condition (DeployEnv, or the branch when branch-gated) does not match | Check the environment and, when branch-gated, the environment's branch |
The build stays in notStarted | No agent meets the demand (the real capability ≠ the template) or the pipeline is not authorized (TEC-003) | /hv:cicd-init derives the demand from the real pool; the pool authorization is granted by the infrastructure team |
cicd-batch HTTP 400 in /hv:hub-client | (fixed in Hub ≥ 1.7.3) PS 5.1 serializes a one-element array as a scalar | Update the Hub; it now tolerates both a scalar and an array |
| The build is not triggered after a push | Azure DevOps Server 2020 path filters (R7) | trigger.paths with the double pattern ** and **/* |
/hv:cicd-status reports template drift | Your stack's template changed | /hv:cicd-init option 4 (re-render + self-check) |
| A green deployment but the app is down | An app bug / an external dependency / a bad secret | RUNBOOK § "App down after a green deployment"; automatic R15 rollback in pre/pro |
9. References
| Document | Contents |
|---|---|
.claude/skills/cicd-runtime/SKILL.md | The 25 rules G1-G19 (inventory, deploy models, routing, gates) |
_patron/08_CICD/GUIA_FASES_ADOPCION.md | The detail of phases 0/1/2 |
_patron/08_CICD/PERMISOS_CICD.md | The handoff to the infrastructure team: the configured pool (cicd.buildPool), capabilities, deploy agents |
_patron/08_CICD/AUDITAR_PIPELINE.md | Auditing the YAML with the cicd-pipeline-reviewer agent |
_patron/08_CICD/RUNBOOK_DEPLOY_MANUAL.md | Manual deployment (phase 0) |
_patron/08_CICD/RUNBOOK_ACTUALIZAR_PIPELINE.md | A safe re-render of the YAML (drift) |
Ovillo — complete CI/CD guide. The /hv:cicd-* family + the one solution / N entrypoints model + application/services routing + Console/Worker CD through a scheduled task. Rules G1-G19 in cicd-runtime.
Fuente: ovillo/_patron/08_CICD/GUIA_COMPLETA_CICD_EN.md