diff --git a/Makefile b/Makefile index 535ec3533..fe82323d7 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ ARCHS = amd64 arm arm64 LDFLAGS=-ldflags "-X ${LDFLAG_LOCATION}.version=${VERSION} -X ${LDFLAG_LOCATION}.buildDate=${BUILD} -X ${LDFLAG_LOCATION}.gitbranch=${BRANCH} -X ${LDFLAG_LOCATION}.gitsha1=${SHA1}" GOLANGCI_VERSION := v1.30.0 -HAS_GOLANGCI := $(shell ls _output/bin/golangci-lint) +HAS_GOLANGCI := $(shell ls _output/bin/golangci-lint 2> /dev/null) # REGISTRY is the container registry to push # into. The default is to push to the staging @@ -43,7 +43,7 @@ IMAGE_GCLOUD:=$(REGISTRY)/descheduler:$(VERSION) # In the future binaries can be uploaded to # GCS bucket gs://k8s-staging-descheduler. -HAS_HELM := $(shell which helm) +HAS_HELM := $(shell which helm 2> /dev/null) all: build @@ -135,11 +135,13 @@ ifndef HAS_GOLANGCI endif ./_output/bin/golangci-lint run -lint-chart: -ifndef HAS_HELM - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 && chmod 700 ./get_helm.sh && ./get_helm.sh -endif +lint-chart: ensure-helm-install helm lint ./charts/descheduler -test-helm: +test-helm: ensure-helm-install ./test/run-helm-tests.sh + +ensure-helm-install: +ifndef HAS_HELM + curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 && chmod 700 ./get_helm.sh && ./get_helm.sh +endif \ No newline at end of file diff --git a/test/run-e2e-tests.sh b/test/run-e2e-tests.sh index a60542bb6..19c30d539 100755 --- a/test/run-e2e-tests.sh +++ b/test/run-e2e-tests.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Copyright 2017 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -x set -o errexit set -o nounset diff --git a/test/run-helm-tests.sh b/test/run-helm-tests.sh index 0ed114171..0d8bd80cd 100755 --- a/test/run-helm-tests.sh +++ b/test/run-helm-tests.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Copyright 2021 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash set -o errexit set -o nounset set -o pipefail diff --git a/test/run-unit-tests.sh b/test/run-unit-tests.sh index 95cf199a5..70656e094 100755 --- a/test/run-unit-tests.sh +++ b/test/run-unit-tests.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Copyright 2017 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -x set -o errexit set -o nounset