Merge pull request #3558 from zhijianli88/GOBIN

Makefile: check and use GOBIN environment variable first
This commit is contained in:
Kubernetes Prow Robot
2021-03-31 10:01:01 -07:00
committed by GitHub
15 changed files with 60 additions and 20 deletions

View File

@@ -3,8 +3,11 @@
#
# Makefile for kustomize CLI and API.
MYGOBIN := $(shell go env GOPATH)/bin
SHELL := /usr/bin/env bash
MYGOBIN = $(shell go env GOBIN)
ifeq ($(MYGOBIN),)
MYGOBIN = $(shell go env GOPATH)/bin
endif
export PATH := $(MYGOBIN):$(PATH)
MODULES := '"cmd/config" "api/" "kustomize/" "kyaml/"'

View File

@@ -3,7 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy clean
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
$(GOBIN)/addlicense:
go get github.com/google/addlicense

View File

@@ -1,4 +1,7 @@
MYGOBIN := $(shell go env GOPATH)/bin
MYGOBIN = $(shell go env GOBIN)
ifeq ($(MYGOBIN),)
MYGOBIN = $(shell go env GOPATH)/bin
endif
$(MYGOBIN)/gorepomod: usage.go
go install .

View File

@@ -3,7 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy image
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
build:
(cd image && go build -v -o $(GOBIN)/config-function .)

View File

@@ -3,7 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy image
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
build:
(cd image && go build -v -o $(GOBIN)/config-function .)

View File

@@ -3,7 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy image
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
build:
(cd image && go build -v -o $(GOBIN)/config-function .)

View File

@@ -3,7 +3,10 @@
.PHONY: license image
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
license:
(which $(GOBIN)/addlicense || go get github.com/google/addlicense)

View File

@@ -3,7 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy image
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
build:
(cd image && go build -v -o $(GOBIN)/config-function .)

View File

@@ -3,7 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy image
GOBIN := $(shell go env GOPATH)/bin
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
build:
(cd image && go build -v -o $(GOBIN)/config-function .)

View File

@@ -14,9 +14,11 @@ version=$1
echo "Installing kustomize ${version}"
MYGOBIN=$(go env GOBIN)
MYGOBIN="${MYGOBIN:-$(go env GOPATH)/bin}"
# Always rebuild, never assume the installed verion is
# the right one to test.
rm -f $(go env GOPATH)/bin/kustomize
rm -f $MYGOBIN/kustomize
if [ "$version" == "HEAD" ]; then
(cd kustomize; go install .)
else
@@ -35,7 +37,7 @@ if onLinuxAndNotOnRemoteCI; then
echo "On linux, and not on remote CI. Running expensive tests."
# Requires helm.
make $(go env GOPATH)/bin/helm
make $MYGOBIN/helm
mdrip --mode test --label helmtest examples/chart.md
fi
@@ -43,6 +45,6 @@ fi
# rely on whatever this script just did. Tests should
# be order independent.
echo "Removing kustomize ${version}"
rm $(go env GOPATH)/bin/kustomize
rm $MYGOBIN/kustomize
echo "Example tests passed against ${version}."

View File

@@ -14,6 +14,9 @@ set -o pipefail
rcAccumulator=0
MYGOBIN=$(go env GOBIN)
MYGOBIN="${MYGOBIN:-$(go env GOPATH)/bin}"
# All hack scripts should run from top level.
. hack/shellHelpers.sh
@@ -49,10 +52,10 @@ function scanDir {
if onLinuxAndNotOnRemoteCI; then
# Some of these tests have special deps.
make $(go env GOPATH)/bin/helmV2
make $(go env GOPATH)/bin/helmV3
make $(go env GOPATH)/bin/helm
make $(go env GOPATH)/bin/kubeval
make $MYGOBIN/helmV2
make $MYGOBIN/helmV3
make $MYGOBIN/helm
make $MYGOBIN/kubeval
fi
for goMod in $(find ./plugin -name 'go.mod' -not -path "./plugin/untested/*"); do

View File

@@ -1,7 +1,10 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
MYGOBIN := $(shell go env GOPATH)/bin
MYGOBIN = $(shell go env GOBIN)
ifeq ($(MYGOBIN),)
MYGOBIN = $(shell go env GOPATH)/bin
endif
export PATH := $(MYGOBIN):$(PATH)
.PHONY: generate license fix vet fmt test lint tidy clean

View File

@@ -1,7 +1,10 @@
# Copyright 2020 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
MYGOBIN := $(shell go env GOPATH)/bin
MYGOBIN = $(shell go env GOBIN)
ifeq ($(MYGOBIN),)
MYGOBIN = $(shell go env GOPATH)/bin
endif
API_VERSION := "v1.19.1"
.PHONY: all

View File

@@ -2,7 +2,8 @@
# Copyright 2020 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
MYGOBIN=$(go env GOPATH)/bin
MYGOBIN=$(go env GOBIN)
MYGOBIN="${MYGOBIN:-$(go env GOPATH)/bin}"
VERSION=$1
cp $HOME/.kube/config /tmp/kubeconfig.txt | true

View File

@@ -2,7 +2,8 @@
# Copyright 2020 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
MYGOBIN=$(go env GOPATH)/bin
MYGOBIN=$(go env GOBIN)
MYGOBIN="${MYGOBIN:-$(go env GOPATH)/bin}"
VERSION=$1
$MYGOBIN/go-bindata \