k3s/scripts/validate

47 lines
877 B
Text
Raw Normal View History

2019-01-01 03:23:01 -05:00
#!/bin/bash
set -e
export GIT_PAGER=cat
if [ -n "$SKIP_VALIDATE" ]; then
echo Skipping validation
exit
fi
2019-01-01 03:23:01 -05:00
cd $(dirname $0)/..
echo Running: install script signature checks
sha256sum -c install.sh.sha256sum
echo Running: go mod tidy
go mod tidy
echo Running validation
. ./scripts/version.sh
if [ -n "$DIRTY" ]; then
echo Source dir is dirty
git status --porcelain --untracked-files=no
git diff
exit 1
fi
echo Running: go version
if ! go version | grep -s "go version ${VERSION_GOLANG} "; then
echo "Unexpected $(go version) - Kubernetes ${VERSION_K8S} should be built with go version ${VERSION_GOLANG}"
exit 1
2019-03-25 00:50:02 -04:00
fi
echo Running: go mod verify
go mod verify
2019-01-01 03:23:01 -05:00
if [ ! -e build/data ];then
mkdir -p build/data
fi
if [ -z "$SKIP_LINT" ] && command -v golangci-lint; then
echo Running: golangci-lint
golangci-lint run --timeout=5m
fi