Move go build to image-utils

pull/6/head
Manjunath A Kumatagi 2017-06-28 19:19:25 +05:30
parent c8a08afc8c
commit 60778cdaa4
18 changed files with 89 additions and 104 deletions

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=clusterapi-tester
SRCS = clusterapi-tester
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/clusterapi-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN)"
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=ep
SRCS=ep
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/entrypoint-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,17 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=fakegitserver
SRCS = fakegitserver
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
IGNORE := $(shell git rev-parse HEAD > $(TARGET)/GITHASH.txt)
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/fakegitserver && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
@echo $(shell git rev-parse HEAD) > $(TARGET)/GITHASH.txt
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=goproxy
SRCS=goproxy
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/goproxy && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -21,6 +21,8 @@ set -o pipefail
TASK=$1
IMAGE=$2
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE}")/../.." && pwd -P)"
# Mapping of go ARCH to actual architectures shipped part of multiarch/qemu-user-static project
declare -A QEMUARCHS=( ["amd64"]="x86_64" ["arm"]="arm" ["arm64"]="aarch64" ["ppc64le"]="ppc64le" ["s390x"]="s390x" )
@ -109,4 +111,18 @@ push() {
done
}
eval ${TASK}
# This function is for building the go code
bin() {
for SRC in $@;
do
docker run --rm -it -v ${TARGET}:${TARGET}:Z -v ${KUBE_ROOT}:/go/src/k8s.io/kubernetes:Z \
golang:${GOLANG_VERSION} \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/${SRC_DIR} && \
CGO_ENABLED=0 GOARM=${GOARM} GOARCH=${ARCH} go build -a -installsuffix cgo --ldflags '-w' -o ${TARGET}/${SRC} ./$(dirname ${SRC})"
done
}
shift
eval ${TASK} "$@"

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=logs-generator
SRCS=logs-generator
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/logs-generator && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=mounttest
SRCS=mounttest
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/mount-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=n-way-http
SRCS=n-way-http
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/n-way-http && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=net
SRCS=net
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/net && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=netexec
SRCS=netexec
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/netexec && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=nettest
SRCS=nettest
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/network-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=no-snat-test-proxy
SRCS=no-snat-test-proxy
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/no-snat-test-proxy && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN)"
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=no-snat-test
SRCS=no-snat-test
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/no-snat-test && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN)"
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=portforwardtester
SRSC=portforwardtester
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/port-forward-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=porter
SRCS=porter
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/porter && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
SRCS = consumer consume-cpu/consume-cpu
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/resource-consumer && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/consume-cpu/consume-cpu ./consume-cpu/consume_cpu.go && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/consumer ."
../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=controller
SRCS=controller
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = resource-consumer/$(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/resource-consumer/controller && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BIN=serve_hostname
SRCS=serve_hostname
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/serve_hostname && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
../image-util.sh bin $(SRCS)
.PHONY: bin