2020-08-10 20:44:11 +03:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
# Install deps
|
2021-08-24 17:01:24 +03:00
|
|
|
gobinpath="$(go env GOPATH)/bin"
|
2023-03-10 12:12:09 +02:00
|
|
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b "$gobinpath" v1.51.2
|
2020-09-03 15:02:35 +03:00
|
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
2020-08-10 20:44:11 +03:00
|
|
|
|
2021-12-02 12:34:18 +02:00
|
|
|
curl -sfL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -s -- --version v3.7.1
|
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
|
|
|
|
|
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-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-26 10:50:59 +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}
|
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
|