From 39781f92b3cbc52334ff1e2effab528c0dee3c21 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 12 Dec 2016 17:59:41 +0100 Subject: [PATCH] Merge pull request #29208 from andrewhsu/validate-changelog validate CHANGELOG.md is well-formed (cherry picked from commit 59ba895a0f610f5bf34ef6748540af1509910bea) Signed-off-by: Sebastiaan van Stijn --- CHANGELOG.md | 2 +- hack/validate/changelog-well-formed | 25 +++++++++++++++++++++++++ hack/validate/default | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 hack/validate/changelog-well-formed diff --git a/CHANGELOG.md b/CHANGELOG.md index 15be47537c..74f983dacf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1473,7 +1473,7 @@ that allows to add build-time environment variables (#15182) - devicemapper: Implement deferred deletion capability (#16381) -## Networking +### Networking + `docker network` exits experimental and is part of standard release (#16645) + New network top-level concept, with associated subcommands and API (#16645) diff --git a/hack/validate/changelog-well-formed b/hack/validate/changelog-well-formed new file mode 100755 index 0000000000..d75c1dd215 --- /dev/null +++ b/hack/validate/changelog-well-formed @@ -0,0 +1,25 @@ +#!/bin/bash + +changelogFile=${1:-CHANGELOG.md} + +if [ ! -r "$changelogFile" ]; then + echo "Unable to read file $changelogFile" >&2 + exit 1 +fi + +changelogWellFormed=1 + +# e.g. "## 1.12.3 (2016-10-26)" +VER_LINE_REGEX='^## [0-9]+\.[0-9]+\.[0-9]+ \([0-9]+-[0-9]+-[0-9]+\)$' +while read -r line; do + if ! [[ "$line" =~ $VER_LINE_REGEX ]]; then + echo "Malformed changelog $changelogFile line \"$line\"" >&2 + changelogWellFormed=0 + fi +done < <(grep '^## ' $changelogFile) + +if [[ "$changelogWellFormed" == "1" ]]; then + echo "Congratulations! Changelog $changelogFile is well-formed." +else + exit 2 +fi diff --git a/hack/validate/default b/hack/validate/default index 29b96ca9a3..fdd23ffe18 100755 --- a/hack/validate/default +++ b/hack/validate/default @@ -14,3 +14,4 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $SCRIPTDIR/test-imports . $SCRIPTDIR/toml . $SCRIPTDIR/vet +. $SCRIPTDIR/changelog-well-formed