build: Add -tags=nautilus to go test and go build

Build `GO_TAGS` based on the `CEPH_VERSION` from build.env. In case the
version is non-empty, pass `-tags=${CEPH_VERSION}` to any of the go
commandline and script that call go programs.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2020-06-24 14:28:02 +02:00
committed by mergify[bot]
parent 58bf45a13e
commit c02413a663
6 changed files with 19 additions and 10 deletions

View File

@ -6,7 +6,7 @@ if [[ -x "$(command -v gosec)" ]]; then
# gosec does not support -mod=vendor, so fallback to non-module support and
# assume all dependencies are available in ./vendor already
export GO111MODULE=off
find cmd internal -type d -print0 | xargs --null gosec
find cmd internal -type d -print0 | xargs --null gosec "${GO_TAGS}"
else
echo "WARNING: gosec not found, skipping security tests" >&2
fi

View File

@ -6,7 +6,7 @@ COVERFILE="${GO_COVER_DIR}/profile.cov"
# no special options, exec to go test w/ all pkgs
if [[ ${TEST_EXITFIRST} != "yes" && -z ${TEST_COVERAGE} ]]; then
# shellcheck disable=SC2086
exec go test -mod=vendor -v ${GOPACKAGES}
exec go test "${GO_TAGS}" -mod=vendor -v ${GOPACKAGES}
fi
# our options are set so we need to handle each go package one
@ -20,7 +20,7 @@ failed=0
for gopackage in ${GOPACKAGES}; do
echo "--- testing: ${gopackage} ---"
# shellcheck disable=SC2086
go test -mod=vendor -v ${GOTESTOPTS} "${gopackage}" || ((failed += 1))
go test "${GO_TAGS}" -mod=vendor -v ${GOTESTOPTS} "${gopackage}" || ((failed += 1))
if [[ -f cover.out ]]; then
# Append to coverfile
grep -v "^mode: count" cover.out >>"${COVERFILE}"

View File

@ -39,7 +39,7 @@ if [[ "${KUBE_MAJOR}" -ge 1 ]] && [[ "${KUBE_MINOR}" -ge 17 ]]; then
fi
# functional tests
go test github.com/ceph/ceph-csi/e2e --deploy-timeout=10 -timeout=30m --cephcsi-namespace=cephcsi-e2e-$RANDOM -v -mod=vendor
go test "${GO_TAGS}" github.com/ceph/ceph-csi/e2e --deploy-timeout=10 -timeout=30m --cephcsi-namespace=cephcsi-e2e-$RANDOM -v -mod=vendor
if [[ "${KUBE_MAJOR}" -ge 1 ]] && [[ "${KUBE_MINOR}" -ge 17 ]]; then
# delete snapshot CRD

View File

@ -49,7 +49,7 @@ scripts/install-helm.sh up
# install cephcsi helm charts
scripts/install-helm.sh install-cephcsi ${NAMESPACE}
# functional tests
go test github.com/ceph/ceph-csi/e2e -mod=vendor --deploy-timeout=10 -timeout=30m --cephcsi-namespace=${NAMESPACE} --deploy-cephfs=false --deploy-rbd=false -v
go test "${GO_TAGS}" github.com/ceph/ceph-csi/e2e -mod=vendor --deploy-timeout=10 -timeout=30m --cephcsi-namespace=${NAMESPACE} --deploy-cephfs=false --deploy-rbd=false -v
#cleanup
# skip snapshot operation if kube version is less than 1.17.0