Urgent.News

What's breaking now, across thousands of outlets.

Tech

The shell step that could not fail no matter what we did to it

Our integration suite had been green for eleven weeks. That is not a boast, it is the symptom. A colleague onboarding to the repo wrote a deliberately broken test to see what a failure looked like, pushed it, and the pipeline went green in the usual four minutes. The stage was a single shell step, npm run test:integration | tee integration.log || true , and it contains two separate mistakes, both…

Our integration suite had remained green for eleven weeks, indicating a healthy state. However, a colleague deliberately created a broken test to understand what a failure looked like. They pushed the changes, and the pipeline remained green. This single shell step, `npm run test:integration | tee integration.log || true`, contained two mistakes.

The pipe was used to upload the log as an artifact, while `set -o pipefail` was not employed, causing the pipeline exit status to always be zero. The `|| true` command, added fourteen months ago, aimed to prevent occasional cleanup commands from returning an error. This combination of errors left failures hidden. While investigating, seven more steps were found across four repositories that could not report failure.

Three had the same pipe issue, two had `|| true`, one ran the real command inside a subshell with discarded status, and one used a for loop over services that overlooked each iteration's result. The fixes were straightforward; all script steps now began with `set -euo pipefail`, enforced by a lint job that flagged any workflow YAML without `run:` blocks. `|| true` was banned outside a limited allowlist, and every allowed use required a comment explaining its necessity.

Additionally, a canary job was introduced in every pipeline, running a command that always exits with an error status. This job asserts its failure, runs on every build, and costs only two seconds. The author believes that this single change could have caught the issue much sooner, rather than uncovering it after eleven weeks.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to add country icons to a Vue 3 app

Vue has no shortage of icon sets. Carets and chevrons come in every pack. Geography is the thin part of the shelf: where a set covers countries at all, it usually means flag squares rather than map…

Two Sources of Truth Will Always Disagree

Somewhere in your system the same fact is stored twice. A count in a column and the rows it is counting. A status on the order and a status on the payment.

  • Two sources of data for the same fact will inevitably diverge over time
  • Discrepancies can result from write failures, off-peak jobs, or partial migrations
  • Systems must identify the accurate source, as both are considered truth

More from Friday 11 September →