#!/usr/bin/env bash

printenv

if [[ -n ${DRONE_COMMIT_REFSPEC} &&  ! ${DRONE_COMMIT_REFSPEC} =~ version(\/noid)?\/([0-9.]+) ]]; 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

#!/usr/bin/env bash

if [[ -n ${DRONE_SOURCE_BRANCH} &&  ! ${DRONE_SOURCE_BRANCH} =~ version(\/noid)?\/([0-9.]+) ]]; 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

Use DRONE_SOURCE_BRANCH instead of DRONE_COMMIT_REFSPEC
Use DRONE_SOURCE_BRANCH instead of DRONE_COMMIT_REFSPEC

Looks like DRONE_COMMIT_REFSPEC is not available anymore on Drone 1.x

Signed-off-by: Daniel Kesselberg <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@danielkesselberg.de>
