hack/moby-sync-release: Avoid SIGPIPE during note extraction

The second grep exits after finding the next release heading, which
can close the pipe while the first grep is still writing. With
pipefail, that SIGPIPE is reported as if the requested release notes
were missing.

Read the release file directly with awk and stop at the next level-two
heading so early termination cannot fail an upstream process.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski committed 2026-07-27 22:32:02 +02:00
1 parent cf508182bf
commit ec89fdea0f
1 file changed
+6 -3
+6 -3
View File
@@ -18,9 +18,12 @@ docs_notes=$(mktemp -t new)
github_notes=$(mktemp -t old)
# Get the release notes from the docs.
grep -A 10000 "## ${version}" "content/manuals/engine/release-notes/${major_version}.md" | \
grep -m 2 -A 0 -B 10000 '^## ' | \
sed '$d' | \
awk -v heading="## ${version}" '
$0 == heading { found = 1; print; next }
found && /^## / { exit }
found { print }
END { if (!found) exit 1 }
' "content/manuals/engine/release-notes/${major_version}.md" | \
sed '/{{< release-date /{N;d;}' \
> "$docs_notes" || { echo "Release notes for ${version} not found" && exit 1; }