You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add dry-run validation step to publish pipeline templates
The publish pipelines generated by �piops init now include a dry-run
validation gate before the actual publish. If the dry-run fails (e.g.,
connectivity issues, invalid resources, permission errors), the pipeline
halts immediately — preventing partial failures from leaving APIM in an
inconsistent state.
Changes:
- GitHub Actions workflow template: added dry-run validation steps
- Azure DevOps pipeline template: added dry-run validation tasks
- Unit tests for both templates
- Updated CI/CD and dry-run documentation
Closes#116
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6. **Runs a dry-run validation** — Executes `apiops publish --dry-run` to verify the publish would succeed. If this step fails, the pipeline halts and the real publish is never attempted, preventing partial failures from leaving APIM in an inconsistent state.
Copy file name to clipboardExpand all lines: docs/ci-cd/github-actions.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,7 +101,8 @@ The workflow runs automatically when changes are pushed to `main` in these paths
101
101
2. **Checks out the repository** with `fetch-depth: 2` (needed for git diff).
102
102
3. **Authenticates with Azure** using OIDC federated credentials.
103
103
4. **Substitutes tokens** — replaces `{#[TOKEN_NAME]#}` placeholders in `configuration.<env>.yaml` with pipeline secret values.
104
-
5. **Runs `apiops publish`** in one of two modes:
104
+
5. **Runs a dry-run validation** — executes `apiops publish --dry-run` to verify the publish would succeed. If this fails, the workflow halts and the real publish is never attempted. This prevents partial failures from leaving APIM in an inconsistent state.
105
+
6. **Runs `apiops publish`** in one of two modes:
105
106
- **Incremental** (default): uses `--commit-id` to publish only changed files.
106
107
- **Full**: publishes all artifacts in the repository (useful for recovery or initial setup).
Copy file name to clipboardExpand all lines: docs/guides/dry-run-workflow.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,6 +237,33 @@ This lets reviewers see _"this PR will create 2 APIs and update 1 backend"_ dire
237
237
238
238
---
239
239
240
+
## Built-in Pipeline Validation Gate
241
+
242
+
The publish pipelines generated by `apiops init` include an **automatic dry-run validation step** before every publish. This prevents partial failures from leaving your APIM instance in an inconsistent state.
243
+
244
+
### How it works
245
+
246
+
1. The pipeline runs `apiops publish --dry-run` with the same arguments as the real publish
247
+
2. If the dry-run exits with a non-zero code (connectivity issues, invalid resources, permission errors), the pipeline **halts immediately**
248
+
3. The real publish step only executes if the dry-run succeeds
249
+
250
+
This means APIM is never modified unless the full operation is validated first.
251
+
252
+
### What triggers a dry-run failure?
253
+
254
+
| Scenario | Result |
255
+
|----------|--------|
256
+
| Resource group or APIM service doesn't exist | Pre-flight validation fails |
257
+
| Invalid credentials or expired token | Authentication error |
| Network connectivity issues | API call timeout/failure |
260
+
261
+
### Opting out
262
+
263
+
If you want to skip the dry-run gate (e.g., for faster iteration in dev), remove the "Dry-run validation" step from your generated pipeline file. The publish step works independently.
264
+
265
+
---
266
+
240
267
## Related
241
268
242
269
- [apiops publish](../commands/publish.md) — Full command reference
0 commit comments