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.…