From 41425af4289d7d521c5cc7e5fb83babb24aa4c75 Mon Sep 17 00:00:00 2001 From: Pierre Beitz Date: Thu, 23 Jul 2020 22:37:39 +0200 Subject: [PATCH 1/2] Add CI validation for the release drafter configuration --- .gitignore | 2 ++ Jenkinsfile | 5 +++++ .../validateReleaseDrafterConfiguration.sh | 21 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100644 Jenkinsfile create mode 100755 scripts/validateReleaseDrafterConfiguration.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3aaa132 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.iml +.idea/* \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..66b918a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,5 @@ +node('node') { + stage('Release drafter configuration validation') { + sh './scripts/validateReleaseDrafterConfiguration.sh' + } +} \ No newline at end of file diff --git a/scripts/validateReleaseDrafterConfiguration.sh b/scripts/validateReleaseDrafterConfiguration.sh new file mode 100755 index 0000000..9d383e3 --- /dev/null +++ b/scripts/validateReleaseDrafterConfiguration.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +HERE="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +RELEASE_DRAFTER_CONFIG="$HERE/../.github/release-drafter.yml" + +AJV_VERSION='3.2.0' + +pushd $TMPDIR || exit +echo "Installing AJV" +npm install -s -g "ajv-cli@${AJV_VERSION}" + +# TODO the schema should come from json schema once https://github.com/release-drafter/release-drafter/pull/600 is fixed +echo "Downloading the release drafter validation schema" +curl -Lso schema.json 'https://raw.githubusercontent.com/release-drafter/release-drafter/cec90728b088fe0fbc42bc15dd3d21bc59db34c6/schema.json' + +echo "Validating release drafter configuration" +ajv validate -s schema.json -d "${RELEASE_DRAFTER_CONFIG}" + +popd || exit From 721b585c2a62fda25f4a49b4346c527b7c7a0f34 Mon Sep 17 00:00:00 2001 From: Pierre Beitz Date: Fri, 23 Apr 2021 12:25:42 +0200 Subject: [PATCH 2/2] Use the official release drafter url --- scripts/validateReleaseDrafterConfiguration.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/validateReleaseDrafterConfiguration.sh b/scripts/validateReleaseDrafterConfiguration.sh index 9d383e3..d14a3d6 100755 --- a/scripts/validateReleaseDrafterConfiguration.sh +++ b/scripts/validateReleaseDrafterConfiguration.sh @@ -11,9 +11,8 @@ pushd $TMPDIR || exit echo "Installing AJV" npm install -s -g "ajv-cli@${AJV_VERSION}" -# TODO the schema should come from json schema once https://github.com/release-drafter/release-drafter/pull/600 is fixed echo "Downloading the release drafter validation schema" -curl -Lso schema.json 'https://raw.githubusercontent.com/release-drafter/release-drafter/cec90728b088fe0fbc42bc15dd3d21bc59db34c6/schema.json' +curl -Lso schema.json 'https://raw.githubusercontent.com/release-drafter/release-drafter/master/schema.json' echo "Validating release drafter configuration" ajv validate -s schema.json -d "${RELEASE_DRAFTER_CONFIG}"