Add release tar.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
59e75d8c5e
commit
a6b0e41d6b
@ -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:
|
||||
|
8
Makefile
8
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 \
|
||||
|
@ -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 <<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",
|
||||
@ -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
hack/release.sh
Executable file
38
hack/release.sh
Executable file
@ -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} .
|
Loading…
Reference in New Issue
Block a user