2017-06-13 08:30:07 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-09-13 21:21:11 +00:00
|
|
|
. $(dirname $0)/util
|
2017-06-13 08:30:07 +00:00
|
|
|
set -eu -o pipefail -x
|
|
|
|
|
2018-10-02 17:03:32 +00:00
|
|
|
: ${CONTINUOUS_INTEGRATION=}
|
|
|
|
|
|
|
|
progressFlag=""
|
|
|
|
if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi
|
|
|
|
|
2018-09-13 21:21:11 +00:00
|
|
|
lintDocker() {
|
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX)
|
2019-10-18 07:36:14 +00:00
|
|
|
docker build --iidfile $iidfile -f ./hack/dockerfiles/lint.Dockerfile --force-rm .
|
2018-09-13 21:21:11 +00:00
|
|
|
iid=$(cat $iidfile)
|
|
|
|
docker rmi $iid
|
|
|
|
rm -f $iidfile
|
|
|
|
}
|
|
|
|
|
|
|
|
lint() {
|
2018-10-02 17:03:32 +00:00
|
|
|
buildctl build $progressFlag --frontend=dockerfile.v0 \
|
2018-09-13 21:21:11 +00:00
|
|
|
--local context=. --local dockerfile=. \
|
2019-10-18 07:36:14 +00:00
|
|
|
--opt filename=./hack/dockerfiles/lint.Dockerfile
|
2018-09-13 21:21:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case $buildmode in
|
2020-07-25 03:36:55 +00:00
|
|
|
"buildkit")
|
|
|
|
lint
|
|
|
|
;;
|
|
|
|
"docker-buildkit")
|
|
|
|
lintDocker
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unsupported build mode: $buildmode" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2018-09-13 21:21:11 +00:00
|
|
|
esac
|