Skip to content

Commit

Permalink
ci and cd push all arches; ability to exclude specific
Browse files Browse the repository at this point in the history
  • Loading branch information
deitch committed Jul 24, 2018
1 parent caaf9f0 commit be83289
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ ifeq ($(ARCH),x86_64)
override ARCH=amd64
endif




# list of arches *not* to build when doing *-all
# until s390x works correctly
EXCLUDEARCH ?= s390x
VALIDARCHES = $(filter-out $(EXCLUDEARCH),$(ARCHES))


# Determine which OS.
OS?=$(shell uname -s | tr A-Z a-z)
###############################################################################
Expand Down Expand Up @@ -82,7 +91,7 @@ clean:
# Building the binary
###############################################################################
build: bin/kube-controllers-linux-$(ARCH) bin/check-status-linux-$(ARCH)
build-all: $(addprefix sub-build-,$(ARCHES))
build-all: $(addprefix sub-build-,$(VALIDARCHES))
sub-build-%:
$(MAKE) build ARCH=$*

Expand Down Expand Up @@ -159,13 +168,13 @@ bin/check-status-linux-$(ARCH): vendor $(SRCFILES)
###############################################################################
## Builds the controller binary and docker image.
image: image.created-$(ARCH)
image-all: $(addprefix sub-image-,$(ARCHES))
image-all: $(addprefix sub-image-,$(VALIDARCHES))
sub-image-%:
$(MAKE) image ARCH=$*

image.created-$(ARCH): bin/kube-controllers-linux-$(ARCH) bin/check-status-linux-$(ARCH)
# Build the docker image for the policy controller.
docker build -t $(CONTAINER_NAME):latest-$(ARCH) -f Dockerfile.$(ARCH) .
docker build -t $(CONTAINER_NAME):latest-$(ARCH) --build-arg QEMU_IMAGE=$(CALICO_BUILD) -f Dockerfile.$(ARCH) .
ifeq ($(ARCH),amd64)
# Need amd64 builds tagged as :latest because Semaphore depends on that
docker tag $(CONTAINER_NAME):latest-$(ARCH) $(CONTAINER_NAME):latest
Expand All @@ -187,7 +196,7 @@ ifeq ($(ARCH),amd64)
docker push quay.io/$(CONTAINER_NAME):$(IMAGETAG)
endif

push-all: imagetag $(addprefix sub-push-,$(ARCHES))
push-all: imagetag $(addprefix sub-push-,$(VALIDARCHES))
sub-push-%:
$(MAKE) push ARCH=$* IMAGETAG=$(IMAGETAG)

Expand All @@ -201,7 +210,7 @@ ifeq ($(ARCH),amd64)
endif

## tag images of all archs
tag-images-all: imagetag $(addprefix sub-tag-images-,$(ARCHES))
tag-images-all: imagetag $(addprefix sub-tag-images-,$(VALIDARCHES))
sub-tag-images-%:
$(MAKE) tag-images ARCH=$* IMAGETAG=$(IMAGETAG)

Expand Down Expand Up @@ -262,7 +271,7 @@ tests/fv/fv.test: $(shell find ./tests -type f -name '*.go' -print)
# CI
###############################################################################
.PHONY: ci
ci: clean image static-checks ut fv
ci: clean image-all static-checks ut fv

###############################################################################
# CD
Expand All @@ -276,8 +285,8 @@ endif
ifndef BRANCH_NAME
$(error BRANCH_NAME is undefined - run using make <target> BRANCH_NAME=var or set an environment variable)
endif
$(MAKE) tag-images push IMAGETAG=${BRANCH_NAME}
$(MAKE) tag-images push IMAGETAG=$(shell git describe --tags --dirty --always --long)
$(MAKE) tag-images-all push-all IMAGETAG=${BRANCH_NAME} EXCLUDEARCH="$(EXCLUDEARCH)"
$(MAKE) tag-images-all push-all IMAGETAG=$(shell git describe --tags --dirty --always --long) EXCLUDEARCH="$(EXCLUDEARCH)"

###############################################################################
# Release
Expand Down

0 comments on commit be83289

Please sign in to comment.