Skip to content

Commit 392ef7d

Browse files
fix(Makefile): update deploy target to use deployments (#424)
Also clean up the makefile in general
1 parent 0e50147 commit 392ef7d

1 file changed

Lines changed: 8 additions & 22 deletions

File tree

Makefile

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
99
DEV_ENV_PREFIX := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR}
1010
DEV_ENV_CMD := ${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE}
1111

12-
# Get the component informtation to a tmp location and get replica count
13-
KUBE := $(shell which kubectl)
14-
ifdef KUBE
15-
$(shell kubectl get rc deis-$(SHORT_NAME) --namespace deis -o yaml > /tmp/deis-$(SHORT_NAME))
16-
DESIRED_REPLICAS=$(shell kubectl get -o template rc/deis-$(SHORT_NAME) --template={{.status.replicas}} --namespace deis)
17-
endif
18-
1912
# SemVer with build information is defined in the SemVer 2 spec, but Docker
2013
# doesn't allow +, so we use -.
2114
BINARY_DEST_DIR := rootfs/usr/bin
@@ -28,9 +21,6 @@ DEIS_REGISTRY ?= ${DEV_REGISTRY}/
2821

2922
GOTEST := go test --race
3023

31-
all:
32-
@echo "Use a Makefile to control top-level building of the project."
33-
3424
bootstrap:
3525
${DEV_ENV_CMD} glide install
3626

@@ -55,21 +45,17 @@ test-unit:
5545
test-cover:
5646
${DEV_ENV_CMD} test-cover.sh
5747

58-
update-changelog:
59-
${DEV_ENV_PREFIX} -e RELEASE=${WORKFLOW_RELEASE} ${DEV_ENV_IMAGE} gen-changelog.sh \
60-
| cat - CHANGELOG.md > tmp && mv tmp CHANGELOG.md
61-
6248
docker-build: build
6349
docker build --rm -t ${IMAGE} rootfs
6450
docker tag ${IMAGE} ${MUTABLE_IMAGE}
6551

66-
# Push to a registry that Kubernetes can access.
67-
docker-push:
68-
docker push ${IMAGE}
52+
check-kubectl:
53+
@if [ -z $$(which kubectl) ]; then \
54+
echo "kubectl binary could not be located"; \
55+
exit 2; \
56+
fi
6957

70-
deploy: docker-build docker-push
71-
sed 's#\(image:\) .*#\1 $(IMAGE)#' /tmp/deis-$(SHORT_NAME) | kubectl apply --validate=true -f -
72-
kubectl scale rc deis-$(SHORT_NAME) --replicas 0 --namespace deis
73-
kubectl scale rc deis-$(SHORT_NAME) --replicas $(DESIRED_REPLICAS) --namespace deis
58+
deploy: check-kubectl docker-build docker-push
59+
kubectl --namespace=deis patch deployment deis-$(SHORT_NAME) --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"$(IMAGE)"}]'
7460

75-
.PHONY: all build docker-compile kube-up kube-down deploy
61+
.PHONY: bootstrap glideup build docker-build test test-style test-unit test-cover deploy

0 commit comments

Comments
 (0)