Menu

1 / 9

GNU comm in CI: fail when a required artifact is missing

DEV Community: cicd·Pobiru·2 days ago
#c6PEAvmn
#devtocicd#devto#dev#built#comm
Long article (640 words) — no AI summary yet.
Reading 0:00
15s threshold

Use GNU comm to check a release artifact list in CI and give the job three outcomes: complete, missing an artifact, or unable to compare. Suppose your release needs an api and a worker binary but built only api . The raw comparison prints worker and still exits with status 0 , because the comparison itself succeeded.

The missing artifact is on stdout, even though the status is zero.

Put the expected artifact names in required.txt and the names that actually built in built.txt .

printf '%s\n' api worker \ > required.txt printf '%s\n' api > built.txt LC_ALL = C comm --check-order \ -23 required.txt built.txt printf 'status: %s\n' "$?"

Enter fullscreen mode

Exit fullscreen mode

worker status: 0

Enter fullscreen mode

Exit fullscreen mode

The first column contains the names that only appear in the required list.

-23 hides the second and third columns. The first column, which remains, lists lines found only in the first file.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.