Merge pull request #34415 from colemickens/colemickens-hack-hyperkube

Automatic merge from submit-queue

Fix hack/dev-push-hyperkube.sh

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**: This fixes `hack/dev-push-hyperkube.sh`. It simplifies/standardizes its usage and fixes it for the changes to the build system.
This commit is contained in:
Kubernetes Submit Queue 2016-10-11 03:15:38 -07:00 committed by GitHub
commit 894d8605dc
2 changed files with 21 additions and 25 deletions

View File

@ -36,9 +36,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -y \
RUN cp /usr/bin/nsenter /nsenter RUN cp /usr/bin/nsenter /nsenter
# Copy the hyperkube binary
COPY hyperkube /hyperkube
# Manifests for the docker guide # Manifests for the docker guide
COPY static-pods/master.json \ COPY static-pods/master.json \
static-pods/etcd.json \ static-pods/etcd.json \
@ -78,3 +75,7 @@ RUN ln -s /hyperkube /apiserver \
&& ln -s /hyperkube /kubelet \ && ln -s /hyperkube /kubelet \
&& ln -s /hyperkube /proxy \ && ln -s /hyperkube /proxy \
&& ln -s /hyperkube /scheduler && ln -s /hyperkube /scheduler
# Copy the hyperkube binary
COPY hyperkube /hyperkube

View File

@ -14,15 +14,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# This script will build the hyperkube image and push it to the repository # This script builds hyperkube and then the hyperkube image.
# referred to by KUBE_DOCKER_REGISTRY and KUBE_DOCKER_OWNER. The image will # REGISTRY and VERSION must be set.
# be given a version tag with the value from KUBE_DOCKER_VERSION. # Example usage:
# e.g. run as: # $ export REGISTRY=gcr.io/someone
# KUBE_DOCKER_REGISTRY=localhost:5000 KUBE_DOCKER_OWNER=liyi \ # $ export VERSION=v1.4.0-testfix
# KUBE_DOCKER_VERSION=1.3.0-dev ./hack/dev-push-hyperkube.sh # ./hack/dev-push-hyperkube.sh
# # That will build and push gcr.io/someone/hyperkube-amd64:v1.4.0-testfix
# will build image localhost:5000/liyi/hyperkube-amd64:1.3.0-dev
set -o errexit set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
@ -30,25 +29,21 @@ set -o pipefail
KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.." KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
source "${KUBE_ROOT}/build/common.sh" source "${KUBE_ROOT}/build/common.sh"
if [[ -z "${KUBE_DOCKER_REGISTRY:-}" ]]; then if [[ -z "${REGISTRY:-}" ]]; then
echo "KUBE_DOCKER_REGISTRY must be set" echo "REGISTRY must be set"
exit -1 exit -1
fi fi
if [[ -z "${KUBE_DOCKER_OWNER:-}" ]]; then if [[ -z "${VERSION:-}" ]]; then
echo "KUBE_DOCKER_OWNER must be set" echo "VERSION must be set"
exit -1
fi
if [[ -z "${KUBE_DOCKER_VERSION:-}" ]]; then
echo "KUBE_DOCKER_VERSION must be set"
exit -1 exit -1
fi fi
IMAGE="${REGISTRY}/hyperkube-amd64:${VERSION}"
kube::build::verify_prereqs kube::build::verify_prereqs
kube::build::build_image kube::build::build_image
kube::build::run_build_command make WHAT=cmd/hyperkube kube::build::run_build_command make WHAT=cmd/hyperkube
kube::build::copy_output
REGISTRY="${KUBE_DOCKER_REGISTRY}/${KUBE_DOCKER_OWNER}" \ make -C "${KUBE_ROOT}/cluster/images/hyperkube" build
VERSION="${KUBE_DOCKER_VERSION}" \ docker push "${IMAGE}"
make -C "${KUBE_ROOT}/cluster/images/hyperkube" build
docker push "${KUBE_DOCKER_REGISTRY}/${KUBE_DOCKER_OWNER}/hyperkube-amd64:${KUBE_DOCKER_VERSION}"