ca-bundle-checker.sh 606 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. if [[ -n ${DRONE_SOURCE_BRANCH} && ! ${DRONE_SOURCE_BRANCH} =~ version(\/noid)?\/([0-9.]+) ]]; then
  3. echo "Skip CA bundle check"
  4. exit 0
  5. fi
  6. echo "Fetching latest ca-bundle.crt ..."
  7. curl -o resources/config/ca-bundle.crt https://curl.haxx.se/ca/cacert.pem
  8. echo
  9. outdated=$(git diff --name-only | grep "resources/config/ca-bundle.crt")
  10. if [ "${outdated}" = "resources/config/ca-bundle.crt" ]; then
  11. echo "CA bundle is not up to date."
  12. echo "Please run: bash build/ca-bundle-checker.sh"
  13. echo "And commit the result"
  14. exit 1
  15. fi
  16. echo "CA bundle is up to date."
  17. exit 0