A green pipeline that deployed nothing
The worst CI outcome is not a failing build. It is a passing build that did nothing and looked correct. Here is one way to get there, and it takes a single missing line of YAML. The setup A pipeline that deploys only what changed. It diffs against the parent commit, maps changed paths onto folders, and conditions each deployment stage on the result. files = run_git ([ " diff " , " --name-only " ,…
A pipeline that only deploys changes can appear green even when it does nothing at all. This happens when the pipeline lacks a single line of YAML code. Azure DevOps can perform a shallow clone of a repository, which has no parent commit. When a shallow clone is used, git diff HEAD~1 HEAD returns nothing, indicating no changes to deploy. Consequently, every stage skips, resulting in a green build. However, no one is alerted because it looks identical to a run triggered by editing a README file.
The issue arises when something that should be in production is missing. The fix involves two parts: making the pipeline correct and making the script refuse to assume. To make the pipeline correct, set checkout: self fetchDepth: 0. Additionally, include a check that raises a GitError if a shallow clone is detected. This ensures that a red build is triggered with an instruction attached, preventing the silent failure mode.
Testing the configuration is crucial, as the line can be removed accidentally. The test verifies that the fetchDepth is set to 0, ensuring full history is available for change detection.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.