github.com/rumpl/bof@v23.0.0-rc.2+incompatible/hack/buildkit-ref (about) 1 #!/usr/bin/env bash 2 # This script returns the current BuildKit ref being used in moby. 3 4 : "${BUILDKIT_REPO=moby/buildkit}" 5 : "${BUILDKIT_REF=}" 6 7 if [ -n "$BUILDKIT_REF" ]; then 8 echo "$BUILDKIT_REF" 9 exit 0 10 fi 11 12 # get buildkit version from vendor.mod 13 BUILDKIT_REF=$(./hack/with-go-mod.sh go list -mod=mod -modfile=vendor.mod -u -m -f '{{.Version}}' "github.com/${BUILDKIT_REPO}") 14 if [[ "${BUILDKIT_REF}" == *-*-* ]]; then 15 # if pseudo-version, figure out just the uncommon sha (https://github.com/golang/go/issues/34745) 16 BUILDKIT_REF=$(echo "${BUILDKIT_REF}" | awk -F"-" '{print $NF}' | awk 'BEGIN{FIELDWIDTHS="7"} {print $1}') 17 # use github api to return full sha to be able to use it as ref 18 BUILDKIT_REF=$(curl -s "https://api.github.com/repos/${BUILDKIT_REPO}/commits/${BUILDKIT_REF}" | jq -r .sha) 19 fi 20 21 echo "$BUILDKIT_REF"