Skip to content

Commit

Permalink
Add release tar.
Browse files Browse the repository at this point in the history
Signed-off-by: Lantao Liu <lantaol@google.com>
  • Loading branch information
Random-Liu committed Sep 4, 2017
1 parent 59e75d8 commit a6b0e41
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -121,6 +128,7 @@ install.tools: .install.gitvalidation .install.gometalinter
.PHONY: \
binaries \
static-binaries \
release \
boiler \
clean \
default \
Expand Down
36 changes: 25 additions & 11 deletions hack/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -52,19 +69,18 @@ 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}/...
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 <<EOF
${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 <<EOF
{
"cniVersion": "0.3.1",
"name": "containerd-net",
Expand Down Expand Up @@ -96,6 +112,4 @@ cd ${GOPATH}/src/${CONTAINERD_PKG}
git fetch --all
git checkout ${CONTAINERD_VERSION}
make
sudo make install
which containerd
which containerd-shim
${sudo} make install -e DESTDIR=${CONTAINERD_DIR}
38 changes: 38 additions & 0 deletions hack/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# Copyright 2017 The Kubernetes Authors.
#
# 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.

set -o errexit
set -o nounset
set -o pipefail

ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
cd ${ROOT}

# BUILD_DIR is the directory to generate release tar.
# TARBALL is the name of the release tar.
BUILD_DIR=${BUILD_DIR:-"_output"}
TARBALL=${TARBALL:-"cri-containerd.tar.gz"}

destdir=${BUILD_DIR}/release-stage

# Install dependencies into release stage.
NOSUDO=true DESTDIR=${destdir} ./hack/install-deps.sh

# Install cri-containerd into release stage.
make install -e DESTDIR=${destdir}

# Create release tar
tar -zcvf ${BUILD_DIR}/${TARBALL} -C ${destdir} .

0 comments on commit a6b0e41

Please sign in to comment.