server/build/ca-bundle-checker.sh
Daniel Kesselberg 75337ff621
DRONE_BRANCH is the target branch. DRONE_COMMIT_REFSPEC should work.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-03-05 15:20:47 +01:00

22 lines
604 B
Bash
Executable file

#!/usr/bin/env bash
echo
if [[ -n ${DRONE_COMMIT_REFSPEC} && ! ${DRONE_COMMIT_REFSPEC} =~ version\/noid\/.+ ]]; then
echo "Skip CA bundle check"
exit 0
fi
echo "Fetching latest ca-bundle.crt ..."
curl -o resources/config/ca-bundle.crt https://curl.haxx.se/ca/cacert.pem
echo
outdated=$(git diff --name-only | grep "resources/config/ca-bundle.crt")
if [ "${outdated}" = "resources/config/ca-bundle.crt" ]; then
echo "CA bundle is not up to date."
echo "Please run: bash build/ca-bundle-checker.sh"
echo "And commit the result"
exit 1
fi
echo "CA bundle is up to date."
exit 0