From 394bf188024df77884ed55930ac49ddf8e7fe8d8 Mon Sep 17 00:00:00 2001
From: jackgr <jackgr@google.com>
Date: Mon, 4 Apr 2016 19:55:09 -0700
Subject: [PATCH] Update push and get-install.sh

---
 Makefile          | 23 ++++++++++++++++-------
 cmd/helm/Makefile | 39 +++++++++++++++++++++++++++++++++++++++
 docs/pushing.md   | 21 +++++++--------------
 get-install.sh    | 28 ++++++++++++++++++++--------
 hack/dm-push.sh   | 43 -------------------------------------------
 rootfs/include.mk |  7 ++++---
 scripts/common.sh |  4 ++--
 7 files changed, 88 insertions(+), 77 deletions(-)
 create mode 100644 cmd/helm/Makefile
 delete mode 100755 hack/dm-push.sh

diff --git a/Makefile b/Makefile
index 6c023ffa5..aba820c6b 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+GO_DIRS ?= $(shell glide nv -x )
+GO_PKGS ?= $(shell glide nv)
+
+ROOTFS := rootfs
+CLIENT := cmd/helm
+
 .PHONY: info
 info:
 	$(MAKE) -C $(ROOTFS) $@
@@ -21,11 +27,6 @@ ifndef GOPATH
 	$(error No GOPATH set)
 endif
 
-GO_DIRS ?= $(shell glide nv -x )
-GO_PKGS ?= $(shell glide nv)
-
-ROOTFS := rootfs
-
 .PHONY: build
 build: gocheck
 	@scripts/build-go.sh
@@ -55,8 +56,16 @@ quicktest: test-style
 	go test $(GO_PKGS)
 
 .PHONY: push
-push: build-static
-	$(MAKE) -C $(ROOTFS) $@
+push: push-server push-client
+
+.PHONY: push-server
+push-server: build-static
+	$(MAKE) -C $(ROOTFS) push
+
+.PHONY: push-client
+push-client: gocheck
+	@BUILD_TYPE=CROSS scripts/build-go.sh $(CLIENT)
+	$(MAKE) -C $(CLIENT) push
 
 .PHONY: container
 container: build-static
diff --git a/cmd/helm/Makefile b/cmd/helm/Makefile
new file mode 100644
index 000000000..30cfef5a5
--- /dev/null
+++ b/cmd/helm/Makefile
@@ -0,0 +1,39 @@
+# Copyright 2015 The Kubernetes Authors All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+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 ./../..)
+BIN_DIR := $(ROOT_DIR)/bin
+
+DEFAULT_BUCKET := gs://get-helm
+STORAGE_BUCKET ?= $(DEFAULT_BUCKET)
+
+DEFAULT_TAG := git-$(shell git rev-parse --short HEAD)
+TAG ?= $(DEFAULT_TAG)
+
+all: push
+
+push:
+	for platform in ${GOLANG_CROSSPLATFORMS}; do \
+		echo $$platform; \
+		PLATFORM=$${platform%/*} && ARCH=$${platform##*/} && \
+		BINARY=$${PLATFORM}-$${ARCH} && \
+		ZIP=${TAG}-helm-$${BINARY}.zip && \
+		zip -j $${ZIP} ${BIN_DIR}/$${BINARY}/helm* && \
+		gsutil cp $${ZIP} ${STORAGE_BUCKET} && \
+		rm $${ZIP} ; \
+	done
diff --git a/docs/pushing.md b/docs/pushing.md
index 3f614fcce..4f5ab9bfe 100644
--- a/docs/pushing.md
+++ b/docs/pushing.md
@@ -1,10 +1,10 @@
-# Pushing DM
+# Pushing Helm
 
-This details the requirements and steps for doing a DM push.
+This details the requirements and steps for doing a `helm` push.
 
 ## Prerequisites
 
-In order to build and push DM, you must:
+In order to build and push `helm`, you must:
 
 * be an editor or owner on the GCP project `kubernetes-helm`
 * have `docker` installed and runnable in your current environment
@@ -13,17 +13,10 @@ In order to build and push DM, you must:
 
 ## Pushing
 
-To build and push the service containers:
+To build and push the service containers and the client binaries for all 
+supported platforms and architectures, checkout the branch and tag you intend to release, 
+and then run the following:
 
 ```
-$ cd ${GOPATH}/src/github.com/kubernetes/helm
-$ make push
+$ PROJECT=kubernetes-helm make push
 ```
-
-To push the client binaries, run the following for both Mac OS X and Linux
-environments:
-
-```
-$ hack/dm-push.sh
-```
-
diff --git a/get-install.sh b/get-install.sh
index 84bce786d..f975840ae 100755
--- a/get-install.sh
+++ b/get-install.sh
@@ -13,15 +13,28 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# Run this from the root of your clone of the kubernetes/helm repository.
+# Be sure to checkout the release you want to install before running it,
+# since it will attempt to pull the version from HEAD on the current branch.
+
 set -euo pipefail
 
-DEFAULT_TAG=v1.2
-DEFAULT_BINARY=${GOPATH}/bin/helm
+DEFAULT_TAG=git-$(git rev-parse --short HEAD)
 DEFAULT_PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
 DEFAULT_ARCH=$(uname -m)
 
-STORAGE_URL=http://get-dm.storage.googleapis.com
-ZIP=helm-${TAG:-${DEFAULT_TAG}}-${PLATFORM:-${DEFAULT_PLATFORM}}-${ARCH:-${DEFAULT_ARCH}}.zip
+if [[ "${DEFAULT_ARCH}" == x86_64 ]]; then
+	DEFAULT_ARCH=amd64
+fi
+
+PLATFORM=${PLATFORM:-${DEFAULT_PLATFORM}}
+ARCH=${ARCH:-${DEFAULT_ARCH}}
+TAG=${TAG:-${DEFAULT_TAG}}
+
+BINARY=helm-${PLATFORM}-${ARCH}
+ZIP=${TAG}-${BINARY}.zip
+
+STORAGE_URL=http://get-helm.storage.googleapis.com
 
 echo "Downloading ${ZIP}..."
 curl -Ls "${STORAGE_URL}/${ZIP}" -O
@@ -35,14 +48,13 @@ cat <<EOF
 
 helm is now available in your current directory.
 
-Before using it, please install the Helm service in your
+Before using it, please install the Deployment Manager service in your
 kubernetes cluster by running
 
-  $ helm server install
+$ ./helm server install
 
 To get started, run:
 
-  $ helm help
+$ ./helm help
 
 EOF
-
diff --git a/hack/dm-push.sh b/hack/dm-push.sh
deleted file mode 100755
index bf894612e..000000000
--- a/hack/dm-push.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright 2015 The Kubernetes Authors All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Run this from helm root to build and push the dm client plus
-# kubernetes install config into the publicly readable GCS bucket gs://get-dm.
-#
-# Must have EDIT permissions on the kubernetes-helm GCP project.
-
-set -euo pipefail
-
-DEFAULT_TAG=v1.2
-DEFAULT_BINARY=${GOPATH}/bin/dm
-DEFAULT_PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
-DEFAULT_ARCH=$(uname -m)
-
-STORAGE_BUCKET=gs://get-dm
-ZIP=dm-${TAG:-DEFAULT_TAG}-${PLATFORM:-DEFAULT_PLATFORM}-${ARCH:-DEFAULT_ARCH}.zip
-
-echo "Building..."
-make
-
-echo "Zipping ${ZIP}..."
-zip -j ${ZIP} ${BINARY:-DEFAULT_BINARY} install.yaml
-
-echo "Uploading ${ZIP} to ${STORAGE_BUCKET}..."
-gsutil cp ${ZIP} ${STORAGE_BUCKET}
-rm ${ZIP}
-
-echo "Done."
-
diff --git a/rootfs/include.mk b/rootfs/include.mk
index dc0c4253d..804c660ce 100644
--- a/rootfs/include.mk
+++ b/rootfs/include.mk
@@ -14,10 +14,11 @@
 
 # If you update this image please check the tag value before pushing.
 
-DOCKER_REGISTRY ?= gcr.io
+DEFAULT_REGISTRY := gcr.io
+DOCKER_REGISTRY ?= $(DEFAULT_REGISTRY)
 
-# Legacy support for $PROJECT
-DOCKER_PROJECT ?= $(PROJECT)
+DEFAULT_PROJECT := kubernetes-helm
+DOCKER_PROJECT ?= $(DEFAULT_PROJECT)
 
 # Support both local and remote repos, and support no project.
 ifeq ($(DOCKER_PROJECT),)
diff --git a/scripts/common.sh b/scripts/common.sh
index 285653999..f596fb401 100644
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -71,8 +71,8 @@ build_binary_cross() {
   echo "Building ${target}"
   gox -verbose \
     -ldflags="${LDFLAGS}" \
-    -os="linux darwin" \
-    -arch="amd64 386" \
+    -os="linux darwin freebsd windows" \
+    -arch="amd64 386 arm" \
     -output="bin/{{.OS}}-{{.Arch}}/{{.Dir}}" \
     "${REPO}/${target}"
 }
-- 
GitLab