Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

A Command That Matched Zero Files Still Exits 0: How to Catch Silent CI Failures

Описание и применение

Команды, которые не находят файлов, но завершаются с кодом 0, могут скрыть ошибки в CI‑пайплайнах. Добавление проверок количества совпадений или использование специальных защитных действий, как zero‑match‑guard, позволяет обнаруживать такие «тихие» сбои и повышать надёжность сборок.

Задача

CI pipelines can falsely report success when file‑matching commands like find, grep, or sed process zero items, allowing broken artifacts to reach production.

Результат

Adding explicit match count checks or guard actions prevents silent CI failures caused by zero‑match file operations, improving pipeline reliability.

Рабочий процесс

  • 1. Run a file operation (e.g., find, grep, sed) with a glob pattern.
  • 2. If the command exits 0 but matches zero files, the pipeline silently succeeds.
  • 3. Add a pre‑check: capture the glob expansion into an array and verify its length is >0.
  • 4. Alternatively, use a dedicated action like zero‑match‑guard to assert a minimum match count.
  • 5. If the check fails, exit the job with an error and diagnostic message.

Доказательства

If src/ contains no files matching *.legacy.js, what does find return? It exits with 0.

Источник

If your build step changed the output directory structure or filename extensions, dist/**/*.bundle.js might expand to a literal string or match nothing.

Источник

To stop silent zero‑match failures, you must enforce strict assertions on file operations before and after execution.

Источник

Using zero‑match‑guard in your CI workflow ensures that any file operation or glob expansion explicitly fails the build if the match count falls below an expected threshold.

Источник

  • Дата записи: 2026-10-05T11:55:47.992Z