From a6b0e41d6bfe07a110ea01dba736cf37f930a2b9 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Mon, 4 Sep 2017 04:22:11 +0000 Subject: [PATCH] Add release tar. Signed-off-by: Lantao Liu --- .travis.yml | 2 ++ Makefile | 8 ++++++++ hack/install-deps.sh | 36 +++++++++++++++++++++++++----------- hack/release.sh | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 11 deletions(-) create mode 100755 hack/release.sh diff --git a/.travis.yml b/.travis.yml index dd6102f94..d43c1a20e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,12 +29,14 @@ jobs: - make .gitvalidation - make verify - make binaries + - make release go: 1.8.x - script: - make install.tools - make .gitvalidation - make verify - make binaries + - make release go: tip - stage: Test script: diff --git a/Makefile b/Makefile index 4ca355072..fef989b7b 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ BUILD_DIR ?= _output VERSION := $(shell git describe --tags --dirty) # strip the first char of the tag if it's a `v` VERSION := $(VERSION:v%=%) +TARBALL ?= cri-containerd-$(VERSION).tar.gz BUILD_TAGS:= -ldflags '-X $(PROJECT)/pkg/version.criContainerdVersion=$(VERSION)' SOURCES := $(shell find . -name '*.go') @@ -36,6 +37,7 @@ help: @echo " * 'install' - Install binaries to system locations" @echo " * 'binaries' - Build cri-containerd" @echo " * 'static-binaries - Build static cri-containerd" + @echo " * 'release' - Build release tarball" @echo " * 'test' - Test cri-containerd" @echo " * 'test-cri' - Test cri-containerd with cri validation test" @echo " * 'test-e2e-node' - Test cri-containerd with Kubernetes node e2e test" @@ -92,6 +94,11 @@ install: binaries uninstall: rm -f $(BINDIR)/cri-containerd +$(BUILD_DIR)/$(TARBALL): $(BUILD_DIR)/cri-containerd hack/versions + @BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) ./hack/release.sh + +release: $(BUILD_DIR)/$(TARBALL) + .PHONY: install.deps install.deps: @@ -121,6 +128,7 @@ install.tools: .install.gitvalidation .install.gometalinter .PHONY: \ binaries \ static-binaries \ + release \ boiler \ clean \ default \ diff --git a/hack/install-deps.sh b/hack/install-deps.sh index 85ae1c3ee..a66dba164 100755 --- a/hack/install-deps.sh +++ b/hack/install-deps.sh @@ -30,10 +30,27 @@ set -o pipefail ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/.. . ${ROOT}/hack/versions +# DESTDIR is the dest path to install dependencies. +DESTDIR=${DESTDIR:-"/"} +# Convert to absolute path if it's relative. +if [[ ${DESTDIR} != /* ]]; then + DESTDIR=${ROOT}/${DESTDIR} +fi + +# NOSUDO indicates not to use sudo during installation. +NOSUDO=${NOSUDO:-false} +sudo="sudo" +if ${NOSUDO}; then + sudo="" +fi + +CONTAINERD_DIR=${DESTDIR}/usr/local +RUNC_DIR=${DESTDIR} +CNI_DIR=${DESTDIR}/opt/cni +CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d + RUNC_PKG=github.com/opencontainers/runc CNI_PKG=github.com/containernetworking/plugins -CNI_DIR=/opt/cni -CNI_CONFIG_DIR=/etc/cni/net.d CONTAINERD_PKG=github.com/containerd/containerd # Check GOPATH @@ -52,8 +69,7 @@ git fetch --all git checkout ${RUNC_VERSION} BUILDTAGS=${BUILDTAGS:-seccomp apparmor} make BUILDTAGS="$BUILDTAGS" -sudo make install -which runc +${sudo} make install -e DESTDIR=${RUNC_DIR} # Install cni go get -d ${CNI_PKG}/... @@ -61,10 +77,10 @@ cd ${GOPATH}/src/${CNI_PKG} git fetch --all git checkout ${CNI_VERSION} ./build.sh -sudo mkdir -p ${CNI_DIR} -sudo cp -r ./bin ${CNI_DIR} -sudo mkdir -p ${CNI_CONFIG_DIR} -sudo bash -c 'cat >'${CNI_CONFIG_DIR}'/10-containerd-net.conflist <'${CNI_CONFIG_DIR}'/10-containerd-net.conflist <