2020-08-10 20:44:11 +03:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2023-05-31 15:58:23 +03:00
|
|
|
this_dir=`dirname $0`
|
|
|
|
|
2020-08-10 20:44:11 +03:00
|
|
|
# Install deps
|
2021-08-24 17:01:24 +03:00
|
|
|
gobinpath="$(go env GOPATH)/bin"
|
2024-04-24 15:17:47 +03:00
|
|
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b "$gobinpath" v1.57.2
|
2020-09-03 15:02:35 +03:00
|
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
2020-08-10 20:44:11 +03:00
|
|
|
|
2024-02-12 12:19:39 +02:00
|
|
|
curl -sfL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -s -- --version v3.14.0
|
2021-02-26 06:56:36 +02:00
|
|
|
|
2021-08-24 17:01:24 +03:00
|
|
|
kubectl="$gobinpath/kubectl"
|
|
|
|
curl -L https://dl.k8s.io/release/v1.22.1/bin/linux/amd64/kubectl -o "$kubectl"
|
|
|
|
chmod 755 "$kubectl"
|
|
|
|
|
2023-03-20 15:46:27 +02:00
|
|
|
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
|
|
|
|
curl -Os https://uploader.codecov.io/latest/linux/codecov
|
|
|
|
chmod +x codecov
|
|
|
|
|
2024-02-12 12:23:47 +02:00
|
|
|
go install sigs.k8s.io/logtools/logcheck@v0.8.1
|
2023-05-31 15:58:23 +03:00
|
|
|
|
2020-08-10 20:44:11 +03:00
|
|
|
# Run verify steps
|
2022-09-08 11:53:07 +03:00
|
|
|
echo "Checking gofmt"
|
2020-09-15 11:53:50 +03:00
|
|
|
make gofmt-verify
|
2022-09-08 11:53:07 +03:00
|
|
|
|
|
|
|
echo "Running golangci-lint"
|
2020-09-15 11:53:50 +03:00
|
|
|
make ci-lint
|
2022-09-08 11:53:07 +03:00
|
|
|
|
|
|
|
echo "Running Helm lint"
|
2021-02-26 06:56:36 +02:00
|
|
|
make helm-lint
|
2020-11-18 11:35:20 +02:00
|
|
|
|
2023-05-31 15:58:23 +03:00
|
|
|
echo "Running logcheck"
|
|
|
|
logcheck -config "${this_dir}/logcheck.conf" ./cmd/... ./pkg/... ./source/...
|
|
|
|
|
2023-02-02 01:00:32 +02:00
|
|
|
echo "Running unit tests"
|
|
|
|
make test
|
|
|
|
|
2023-03-20 15:46:27 +02:00
|
|
|
# Upload coverage report
|
2023-04-28 13:04:44 +03:00
|
|
|
./codecov -t "${CODECOV_TOKEN}" \
|
|
|
|
-C "${PULL_PULL_SHA}" \
|
|
|
|
-r "${REPO_OWNER}/${REPO_NAME}" \
|
|
|
|
-P "${PULL_NUMBER}" \
|
|
|
|
-b "${BUILD_ID}" \
|
|
|
|
-B "${PULL_BASE_REF}" \
|
|
|
|
-N "${PULL_BASE_SHA}"
|
2023-03-20 15:46:27 +02:00
|
|
|
|
2020-11-18 11:35:20 +02:00
|
|
|
# Check that repo is clean
|
|
|
|
if ! git diff --quiet; then
|
|
|
|
echo "Repository is dirty!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check that templates are up-to-date
|
|
|
|
make templates
|
|
|
|
if ! git diff --quiet; then
|
|
|
|
echo "Deployment templates are not up-to-date. Run 'make templates' to update"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-08-24 17:01:24 +03:00
|
|
|
|
|
|
|
# Check that the kustomize overlays are buildable
|
|
|
|
for d in `ls deployment/overlays/* -d`; do
|
|
|
|
if [ "`basename $d`" = "samples" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Verifying $d"
|
|
|
|
kubectl kustomize $d > /dev/null
|
|
|
|
done
|