Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jason DeTiberus <[email protected]>
  • Loading branch information
hakman and detiber authored Nov 25, 2020
1 parent 85a12ed commit 17dae92
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions cluster-autoscaler/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
all: build-arch-amd64 build-arch-arm64
ALL_ARCH = amd64 arm64
all: $(addprefix build-arch-,$(ALL_ARCH))

TAG?=dev
FLAGS=
LDFLAGS?=-s
ENVVAR=CGO_ENABLED=0 GO111MODULE=off
GOOS?=linux
GOARCH?=amd64
GOARCH?=$(shell go env GOARCH)
REGISTRY?=staging-k8s.gcr.io
DOCKER_NETWORK?=default
ifdef BUILD_TAGS
Expand All @@ -28,26 +29,24 @@ else
RM_FLAG=
endif

build: build-arch-amd64
build: build-arch-$(GOARCH)

build-arch-%: clean-arch-%
$(ENVVAR) GOOS=$(GOOS) GOARCH=$* go build ${LDFLAGS_FLAG} ${TAGS_FLAG} ./...
$(ENVVAR) GOOS=$(GOOS) GOARCH=$* go build -o cluster-autoscaler-$* ${LDFLAGS_FLAG} ${TAGS_FLAG}

build-binary: build-binary-arch-amd64
build-binary: build-binary-arch-$(GOARCH)

build-binary-arch-%: clean-arch-%
$(ENVVAR) GOOS=$(GOOS) GOARCH=$* go build -o cluster-autoscaler-$* ${LDFLAGS_FLAG} ${TAGS_FLAG}

test-unit: clean build
GO111MODULE=off go test --test.short -race ./... ${TAGS_FLAG}

dev-release: dev-release-arch-amd64
dev-release: $(addprefix build-binary-arch-,$(ALL_ARCH)) execute-release

dev-release-arch-%: build-binary-arch-% execute-release-arch-%
@echo "Release ${TAG}${FOR_PROVIDER}-$* completed"

make-image: make-image-arch-amd64
make-image: make-image-arch-$(GOARCH)

make-image-arch-%:
ifdef BASEIMAGE
Expand All @@ -61,22 +60,24 @@ else
endif
@echo "Image ${TAG}${FOR_PROVIDER}-$* completed"

push-image: push-image-arch-amd64
push-image: push-image-arch-$(GOARCH)

push-image-arch-%:
./push_image.sh ${REGISTRY}/cluster-autoscaler${PROVIDER}:${TAG}-$*

create-manifest:
docker manifest create --amend ${REGISTRY}/cluster-autoscaler${PROVIDER}:${TAG} $(addprefix $(REGISTRY)/cluster-autoscaler$(PROVIDER):$(TAG)-, $(ALL_ARCH))

push-manifest:
./push_image.sh ${REGISTRY}/cluster-autoscaler${PROVIDER}:${TAG} \
${REGISTRY}/cluster-autoscaler${PROVIDER}:${TAG}-amd64 \
${REGISTRY}/cluster-autoscaler${PROVIDER}:${TAG}-arm64

execute-release: execute-release-arch-amd64
execute-release: $(addprefix make-image-arch-,$(ALL_ARCH)) $(addprefix push-image-arch-,$(ALL_ARCH)) create-manifest push-manifest
@echo "Release ${TAG}${FOR_PROVIDER} completed"

execute-release-arch-%: make-image-arch-% push-image-arch-%
@echo "Release ${TAG}${FOR_PROVIDER}-$* completed"

clean: clean-arch-amd64
clean: clean-arch-$(GOARCH)

clean-arch-%:
rm -f cluster-autoscaler-$*
Expand All @@ -91,18 +92,17 @@ format:
docker-builder:
docker build --network=${DOCKER_NETWORK} -t autoscaling-builder ../builder

build-in-docker: build-in-docker-arch-amd64
build-in-docker: build-in-docker-arch-$(GOARCH)

build-in-docker-arch-%: clean-arch-% docker-builder
docker run ${RM_FLAG} -v `pwd`:/gopath/src/k8s.io/autoscaler/cluster-autoscaler/:Z autoscaling-builder:latest \
bash -c 'cd /gopath/src/k8s.io/autoscaler/cluster-autoscaler && BUILD_TAGS=${BUILD_TAGS} LDFLAGS="${LDFLAGS}" make build-binary-arch-$*'

release: release-arch-amd64
release: $(addprefix build-in-docker-arch-,$(ALL_ARCH) execute-release
@echo "Full in-docker release ${TAG}${FOR_PROVIDER} completed"
release-arch-%: build-in-docker-arch-% execute-release-arch-%
@echo "Full in-docker release ${TAG}${FOR_PROVIDER}-$* completed"
container: container-arch-amd64
container: container-arch-$(GOARCH)
container-arch-%: build-in-docker-arch-% make-image-arch-%
@echo "Full in-docker image ${TAG}${FOR_PROVIDER}-$* completed"
Expand Down

0 comments on commit 17dae92

Please sign in to comment.