From ef538906eaca18de86adb4575ddb5f4842d51f2f Mon Sep 17 00:00:00 2001 From: jackgr Date: Mon, 7 Mar 2016 15:05:10 -0800 Subject: [PATCH 1/2] Fix TAG value --- expandybird/Makefile | 3 ++- include.mk | 3 ++- manager/Makefile | 3 ++- resourcifier/Makefile | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/expandybird/Makefile b/expandybird/Makefile index 16f0c7882..c1c26c08e 100644 --- a/expandybird/Makefile +++ b/expandybird/Makefile @@ -31,7 +31,8 @@ else endif container: - docker build -t $(PREFIX)/$(IMAGE):$(TAG) -f Dockerfile $(DIR) + docker build -t $(PREFIX)/$(IMAGE):latest -f Dockerfile $(DIR) + docker tag -f $(PREFIX)/$(IMAGE):latest $(PREFIX)/$(IMAGE):$(TAG) clean: -docker rmi $(PREFIX)/$(IMAGE):$(TAG) diff --git a/include.mk b/include.mk index fca436983..36c1e1df6 100644 --- a/include.mk +++ b/include.mk @@ -5,7 +5,8 @@ info: @echo "Project: ${PROJECT}" @echo "Image: ${IMAGE}" -TAG ?= $(shell echo `date +"%s"`_`date +"%N"`) +DEFAULT_TAG := git-$(shell git rev-parse --short HEAD) +TAG ?= ${DEFAULT_TAG} .PHONY: test-unit test-unit: diff --git a/manager/Makefile b/manager/Makefile index 209c874f2..325e82a08 100644 --- a/manager/Makefile +++ b/manager/Makefile @@ -31,7 +31,8 @@ else endif container: - docker build -t $(PREFIX)/$(IMAGE):$(TAG) -f Dockerfile $(DIR) + docker build -t $(PREFIX)/$(IMAGE):latest -f Dockerfile $(DIR) + docker tag -f $(PREFIX)/$(IMAGE):latest $(PREFIX)/$(IMAGE):$(TAG) clean: -docker rmi $(PREFIX)/$(IMAGE):$(TAG) diff --git a/resourcifier/Makefile b/resourcifier/Makefile index 9d6eebe1a..e3cdd410c 100644 --- a/resourcifier/Makefile +++ b/resourcifier/Makefile @@ -33,7 +33,8 @@ else endif container: - docker build -t $(PREFIX)/$(IMAGE):$(TAG) -f Dockerfile $(DIR) + docker build -t $(PREFIX)/$(IMAGE):latest -f Dockerfile $(DIR) + docker tag -f $(PREFIX)/$(IMAGE):latest $(PREFIX)/$(IMAGE):$(TAG) clean: -docker rmi $(PREFIX)/$(IMAGE):$(TAG) From f7bf698bf223c40dd1ceff324b205ae3cb62babd Mon Sep 17 00:00:00 2001 From: jackgr Date: Mon, 7 Mar 2016 18:24:08 -0800 Subject: [PATCH 2/2] Update release label in build scripts --- dm/Dockerfile | 12 +++++++----- dm/Makefile | 22 ++++++++++++++++++++-- get-install.sh | 16 +++++++++++++--- hack/dm-push.sh | 43 ------------------------------------------- install.yaml | 6 +++--- 5 files changed, 43 insertions(+), 56 deletions(-) delete mode 100755 hack/dm-push.sh diff --git a/dm/Dockerfile b/dm/Dockerfile index 8590cd65a..34b7476e8 100644 --- a/dm/Dockerfile +++ b/dm/Dockerfile @@ -15,21 +15,23 @@ FROM golang:1.6 ENV GOLANG_CROSSPLATFORMS \ - darwin/amd64 \ + darwin/386 darwin/amd64 \ freebsd/386 freebsd/amd64 freebsd/arm \ linux/386 linux/amd64 linux/arm \ windows/386 windows/amd64 -RUN mkdir -p "$GOPATH/src/github.com" && chmod -R 777 "$GOPATH/src/github.com" +RUN mkdir -p "$GOPATH"/src/github.com/kubernetes/deployment-manager/dm && chmod -R 777 "$GOPATH" -COPY . "$GOPATH"/src/dm +COPY . "$GOPATH"/src/github.com/kubernetes/deployment-manager -WORKDIR "$GOPATH"/src/dm +WORKDIR "$GOPATH"/src/github.com/kubernetes/deployment-manager/dm" RUN go-wrapper download RUN set -ex \ && for platform in $GOLANG_CROSSPLATFORMS; do \ + echo ${platform} ; \ GOOS=${platform%/*} \ GOARCH=${platform##*/} \ - go build -v -o dm-${platform%/*}-${platform##*/}; \ + go build -v -o dm-${platform%/*}-${platform##*/} ; \ + echo ; \ done diff --git a/dm/Makefile b/dm/Makefile index aa771203b..e1cd28c87 100644 --- a/dm/Makefile +++ b/dm/Makefile @@ -16,10 +16,16 @@ SHELL := /bin/bash GOLANG_CROSSPLATFORMS := darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm windows/386 windows/amd64 +ROOT_DIR := $(abspath ./..) +DIR := $(ROOT_DIR) + +STORAGE_BUCKET=gs://get-dm +TAG=v1.2.1 + all: build binary build: - docker build -t dm . + docker build -t dm -f Dockerfile $(DIR) binary: - docker stop dm @@ -27,7 +33,19 @@ binary: docker run --name dm dm for platform in ${GOLANG_CROSSPLATFORMS}; do \ echo $$platform; \ - docker cp dm:/go/src/dm/dm-$${platform%/*}-$${platform##*/} .; \ + docker cp dm:/go/src/github.com/kubernetes/deployment-manager/dm/dm-$${platform%/*}-$${platform##*/} .; \ + done + +push: + for platform in ${GOLANG_CROSSPLATFORMS}; do \ + echo $$platform; \ + PLATFORM=$${platform%/*} && \ + ARCH=$${platform##*/} && \ + BINARY=dm-$${PLATFORM}-$${ARCH} && \ + ZIP=dm-${TAG}-$${PLATFORM}-$${ARCH}.zip && \ + zip -j $${ZIP} $${BINARY} ../install.yaml && \ + gsutil cp $${ZIP} ${STORAGE_BUCKET} && \ + rm $${ZIP} ; \ done clean: diff --git a/get-install.sh b/get-install.sh index df53665ef..6f002e848 100755 --- a/get-install.sh +++ b/get-install.sh @@ -15,13 +15,22 @@ set -euo pipefail -DEFAULT_TAG=v1.2 -DEFAULT_BINARY=${GOPATH}/bin/dm +DEFAULT_TAG=v1.2.1 DEFAULT_PLATFORM=$(uname | tr '[:upper:]' '[:lower:]') DEFAULT_ARCH=$(uname -m) +if [[ "${DEFAULT_ARCH}" == x86_64 ]]; then + DEFAULT_ARCH=amd64 +fi + +PLATFORM=${PLATFORM:-${DEFAULT_PLATFORM}} +ARCH=${ARCH:-${DEFAULT_ARCH}} +TAG=${TAG:-${DEFAULT_TAG}} + +BINARY=dm-${PLATFORM}-${ARCH} +ZIP=dm-${TAG}-${PLATFORM}-${ARCH}.zip + STORAGE_URL=http://get-dm.storage.googleapis.com -ZIP=dm-${TAG:-DEFAULT_TAG}-${PLATFORM:-DEFAULT_PLATFORM}-${ARCH:-DEFAULT_ARCH}.zip echo "Downloading ${ZIP}..." curl -Ls "${STORAGE_URL}/${ZIP}" -O @@ -29,6 +38,7 @@ curl -Ls "${STORAGE_URL}/${ZIP}" -O unzip -qo ${ZIP} rm ${ZIP} +mv ${BINARY} dm chmod +x dm cat <