Add build-containerd.sh to build containerd from existing repo

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2018-03-16 06:40:14 +00:00
parent 0b8e9060d7
commit a69f3555da
18 changed files with 412 additions and 200 deletions

View File

@ -161,7 +161,7 @@ proto:
.PHONY: install.deps .PHONY: install.deps
install.deps: install.deps:
@./hack/install-deps.sh @./hack/install/install-deps.sh
.PHONY: .gitvalidation .PHONY: .gitvalidation
# When this is running in travis, it will only check the travis commit range. # When this is running in travis, it will only check the travis commit range.

View File

@ -1,154 +0,0 @@
#!/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.
# Dependencies:
# runc:
# - libseccomp-dev(Ubuntu,Debian)/libseccomp-devel(Fedora, CentOS, RHEL). Note that
# libseccomp in ubuntu <=trusty and debian <=jessie is not new enough, backport
# is required.
# - libapparmor-dev(Ubuntu,Debian)/libapparmor-devel(Fedora, CentOS, RHEL)
# containerd:
# - btrfs-tools(Ubuntu,Debian)/btrfs-progs-devel(Fedora, CentOS, RHEL)
set -o errexit
set -o nounset
set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
# 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
# INSTALL_CNI indicates whether to install CNI. CNI installation
# makes sense for local testing, but doesn't make sense for cluster
# setup, because CNI daemonset is usually used to deploy CNI binaries
# and configurations in cluster.
INSTALL_CNI=${INSTALL_CNI:-true}
CONTAINERD_DIR=${DESTDIR}/usr/local
RUNC_DIR=${DESTDIR}
CNI_DIR=${DESTDIR}/opt/cni
CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d
CRICTL_DIR=${DESTDIR}/usr/local/bin
CRICTL_CONFIG_DIR=${DESTDIR}/etc
RUNC_PKG=github.com/opencontainers/runc
CNI_PKG=github.com/containernetworking/plugins
CONTAINERD_PKG=github.com/containerd/containerd
CRITOOL_PKG=github.com/kubernetes-incubator/cri-tools
CRI_CONTAINERD_PKG=github.com/containerd/cri
# Create a temporary GOPATH for make install.deps.
TMPGOPATH=$(mktemp -d /tmp/cri-containerd-install-deps.XXXX)
GOPATH=${TMPGOPATH}
# checkout_repo checks out specified repository
# and switch to specified version.
# Varset:
# 1) Pkg name;
# 2) Version;
# 3) Repo name;
checkout_repo() {
local -r pkg=$1
local -r version=$2
local -r repo=$3
path="${GOPATH}/src/${pkg}"
if [ ! -d ${path} ]; then
mkdir -p ${path}
git clone https://${repo} ${path}
fi
cd ${path}
git fetch --all
git checkout ${version}
}
# Install runc
checkout_repo ${RUNC_PKG} ${RUNC_VERSION} ${RUNC_REPO}
cd ${GOPATH}/src/${RUNC_PKG}
BUILDTAGS=${BUILDTAGS:-seccomp apparmor}
make static BUILDTAGS="$BUILDTAGS"
${sudo} make install -e DESTDIR=${RUNC_DIR}
# Install cni
if ${INSTALL_CNI}; then
checkout_repo ${CNI_PKG} ${CNI_VERSION} ${CNI_REPO}
cd ${GOPATH}/src/${CNI_PKG}
FASTBUILD=true ./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
{
"cniVersion": "0.3.1",
"name": "containerd-net",
"plugins": [
{
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"promiscMode": true,
"ipam": {
"type": "host-local",
"subnet": "10.88.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
},
{
"type": "portmap",
"capabilities": {"portMappings": true}
}
]
}
EOF'
fi
# Install containerd
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
cd ${GOPATH}/src/${CONTAINERD_PKG}
make BUILDTAGS="${BUILDTAGS}"
# containerd make install requires `go` to work. Explicitly
# set PATH to make sure it can find `go` even with `sudo`.
${sudo} sh -c "PATH=${PATH} make install -e DESTDIR=${CONTAINERD_DIR}"
#Install crictl
checkout_repo ${CRITOOL_PKG} ${CRITOOL_VERSION} ${CRITOOL_REPO}
cd ${GOPATH}/src/${CRITOOL_PKG}
make crictl
${sudo} make install-crictl -e BINDIR=${CRICTL_DIR} GOPATH=${GOPATH}
${sudo} mkdir -p ${CRICTL_CONFIG_DIR}
${sudo} bash -c 'cat >'${CRICTL_CONFIG_DIR}'/crictl.yaml <<EOF
runtime-endpoint: /run/containerd/containerd.sock
EOF'
# Clean the tmp GOPATH dir. Use sudo because runc build generates
# some privileged files.
${sudo} rm -rf ${TMPGOPATH}

66
hack/install/install-cni.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
# Copyright 2018 The containerd 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
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
CNI_DIR=${DESTDIR}/opt/cni
CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d
CNI_PKG=github.com/containernetworking/plugins
# Create a temporary GOPATH for cni installation.
TMPGOPATH=$(mktemp -d /tmp/cri-install-cni.XXXX)
GOPATH=${TMPGOPATH}
# Install cni
from-vendor CNI github.com/containernetworking/plugins
checkout_repo ${CNI_PKG} ${CNI_VERSION} ${CNI_REPO}
cd ${GOPATH}/src/${CNI_PKG}
FASTBUILD=true ./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
{
"cniVersion": "0.3.1",
"name": "containerd-net",
"plugins": [
{
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"promiscMode": true,
"ipam": {
"type": "host-local",
"subnet": "10.88.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
},
{
"type": "portmap",
"capabilities": {"portMappings": true}
}
]
}
EOF'
# Clean the tmp GOPATH dir.
rm -rf ${TMPGOPATH}

View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2018 The containerd 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
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
CONTAINERD_DIR=${DESTDIR}/usr/local
CONTAINERD_PKG=github.com/containerd/containerd
# CHECKOUT_CONTAINERD indicates whether to checkout containerd repo.
# This is useful for build containerd from existing repo, currently
# used by containerd CI test.
CHECKOUT_CONTAINERD=${CHECKOUT_CONTAINERD:-true}
if ${CHECKOUT_CONTAINERD}; then
# Create a temporary GOPATH for containerd installation.
TMPGOPATH=$(mktemp -d /tmp/cri-install-containerd.XXXX)
GOPATH=${TMPGOPATH}
from-vendor CONTAINERD github.com/containerd/containerd
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
fi
# Install containerd
cd ${GOPATH}/src/${CONTAINERD_PKG}
make BUILDTAGS="${BUILDTAGS}"
# containerd make install requires `go` to work. Explicitly
# set PATH to make sure it can find `go` even with `sudo`.
${SUDO} sh -c "PATH=${PATH} make install -e DESTDIR=${CONTAINERD_DIR}"
# Clean the tmp GOPATH dir.
if ${CHECKOUT_CONTAINERD}; then
rm -rf ${TMPGOPATH}
fi

40
hack/install/install-crictl.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# Copyright 2018 The containerd 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
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
CRICTL_DIR=${DESTDIR}/usr/local/bin
CRICTL_CONFIG_DIR=${DESTDIR}/etc
# Create a temporary GOPATH for crictl installation.
TMPGOPATH=$(mktemp -d /tmp/cri-install-crictl.XXXX)
GOPATH=${TMPGOPATH}
#Install crictl
checkout_repo ${CRITOOL_PKG} ${CRITOOL_VERSION} ${CRITOOL_REPO}
cd ${GOPATH}/src/${CRITOOL_PKG}
make crictl
${SUDO} make install-crictl -e BINDIR=${CRICTL_DIR} GOPATH=${GOPATH}
${SUDO} mkdir -p ${CRICTL_CONFIG_DIR}
${SUDO} bash -c 'cat >'${CRICTL_CONFIG_DIR}'/crictl.yaml <<EOF
runtime-endpoint: /run/containerd/containerd.sock
EOF'
# Clean the tmp GOPATH dir.
rm -rf ${TMPGOPATH}

50
hack/install/install-deps.sh Executable file
View File

@ -0,0 +1,50 @@
#!/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.
# Dependencies:
# runc:
# - libseccomp-dev(Ubuntu,Debian)/libseccomp-devel(Fedora, CentOS, RHEL). Note that
# libseccomp in ubuntu <=trusty and debian <=jessie is not new enough, backport
# is required.
# - libapparmor-dev(Ubuntu,Debian)/libapparmor-devel(Fedora, CentOS, RHEL)
# containerd:
# - btrfs-tools(Ubuntu,Debian)/btrfs-progs-devel(Fedora, CentOS, RHEL)
set -o errexit
set -o nounset
set -o pipefail
cd $(dirname "${BASH_SOURCE[0]}")
# INSTALL_CNI indicates whether to install CNI. CNI installation
# makes sense for local testing, but doesn't make sense for cluster
# setup, because CNI daemonset is usually used to deploy CNI binaries
# and configurations in cluster.
INSTALL_CNI=${INSTALL_CNI:-true}
# Install runc
./install-runc.sh
# Install cni
if ${INSTALL_CNI}; then
./install-cni.sh
fi
# Install containerd
./install-containerd.sh
#Install crictl
./install-crictl.sh

38
hack/install/install-runc.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# Copyright 2018 The containerd 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
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
RUNC_DIR=${DESTDIR}
RUNC_PKG=github.com/opencontainers/runc
# Create a temporary GOPATH for runc installation.
TMPGOPATH=$(mktemp -d /tmp/cri-install-runc.XXXX)
GOPATH=${TMPGOPATH}
# Install runc
from-vendor RUNC github.com/opencontainers/runc
checkout_repo ${RUNC_PKG} ${RUNC_VERSION} ${RUNC_REPO}
cd ${GOPATH}/src/${RUNC_PKG}
make static BUILDTAGS="$BUILDTAGS"
${SUDO} make install -e DESTDIR=${RUNC_DIR}
# Clean the tmp GOPATH dir. Use sudo because runc build generates
# some privileged files.
${SUDO} rm -rf ${TMPGOPATH}

54
hack/install/utils.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# Copyright 2018 The containerd 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.
source $(dirname "${BASH_SOURCE[0]}")/../utils.sh
# 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
# BUILDTAGS are bulid tags for runc and containerd.
BUILDTAGS=${BUILDTAGS:-seccomp apparmor}
# checkout_repo checks out specified repository
# and switch to specified version.
# Varset:
# 1) Pkg name;
# 2) Version;
# 3) Repo name;
checkout_repo() {
local -r pkg=$1
local -r version=$2
local -r repo=$3
path="${GOPATH}/src/${pkg}"
if [ ! -d ${path} ]; then
mkdir -p ${path}
git clone https://${repo} ${path}
fi
cd ${path}
git fetch --all
git checkout ${version}
}

View File

@ -38,7 +38,7 @@ destdir=${BUILD_DIR}/release-stage
rm -rf ${destdir} rm -rf ${destdir}
# Install dependencies into release stage. # Install dependencies into release stage.
NOSUDO=true INSTALL_CNI=${INCLUDE_CNI} DESTDIR=${destdir} ./hack/install-deps.sh NOSUDO=true INSTALL_CNI=${INCLUDE_CNI} DESTDIR=${destdir} ./hack/install/install-deps.sh
if ${CUSTOM_CONTAINERD}; then if ${CUSTOM_CONTAINERD}; then
make install -e DESTDIR=${destdir} make install -e DESTDIR=${destdir}

View File

@ -24,6 +24,7 @@ cd ${ROOT}
echo "Compare vendor with containerd vendors..." echo "Compare vendor with containerd vendors..."
containerd_vendor=$(mktemp /tmp/containerd-vendor.conf.XXXX) containerd_vendor=$(mktemp /tmp/containerd-vendor.conf.XXXX)
from-vendor CONTAINERD github.com/containerd/containerd
curl -s https://raw.githubusercontent.com/${CONTAINERD_REPO#*/}/${CONTAINERD_VERSION}/vendor.conf > ${containerd_vendor} curl -s https://raw.githubusercontent.com/${CONTAINERD_REPO#*/}/${CONTAINERD_VERSION}/vendor.conf > ${containerd_vendor}
# Create a temporary vendor file to update. # Create a temporary vendor file to update.
tmp_vendor=$(mktemp /tmp/vendor.conf.XXXX) tmp_vendor=$(mktemp /tmp/vendor.conf.XXXX)

View File

@ -36,7 +36,6 @@ fi
GOPATH=${GOPATH%%:*} GOPATH=${GOPATH%%:*}
CRITEST=${GOPATH}/bin/critest CRITEST=${GOPATH}/bin/critest
CRITOOL_PKG=github.com/kubernetes-incubator/cri-tools
# Install critest # Install critest
if [ ! -x "$(command -v ${CRITEST})" ]; then if [ ! -x "$(command -v ${CRITEST})" ]; then

View File

@ -59,6 +59,12 @@ fi
GOPATH=${GOPATH%%:*} GOPATH=${GOPATH%%:*}
# Get kubernetes # Get kubernetes
from-vendor KUBERNETES k8s.io/kubernetes
# k8s.io is actually a redirect, but we do not handle the go-import
# metadata which `go get` and `vndr` etc do. Handle it manually here.
if [ x"$KUBERNETES_REPO" = "xk8s.io" ] ; then
KUBERNETES_REPO="https://github.com/kubernetes/kubernetes"
fi
KUBERNETES_PATH="${GOPATH}/src/k8s.io/kubernetes" KUBERNETES_PATH="${GOPATH}/src/k8s.io/kubernetes"
if [ ! -d "${KUBERNETES_PATH}" ]; then if [ ! -d "${KUBERNETES_PATH}" ]; then
mkdir -p ${KUBERNETES_PATH} mkdir -p ${KUBERNETES_PATH}

View File

@ -18,8 +18,12 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
# Not from vendor.conf. # Not from vendor.conf.
CRITOOL_VERSION=b184f9aefe60a4441330e615ee20634ee26474fb CRITOOL_VERSION=b184f9aefe60a4441330e615ee20634ee26474fb
CRITOOL_PKG=github.com/kubernetes-incubator/cri-tools
CRITOOL_REPO=github.com/kubernetes-incubator/cri-tools CRITOOL_REPO=github.com/kubernetes-incubator/cri-tools
# VENDOR is the path to vendor.conf.
VENDOR=${VENDOR:-"${ROOT}/vendor.conf"}
# upload_logs_to_gcs uploads test logs to gcs. # upload_logs_to_gcs uploads test logs to gcs.
# Var set: # Var set:
# 1. Bucket: gcs bucket to upload logs. # 1. Bucket: gcs bucket to upload logs.
@ -72,7 +76,7 @@ sha256() {
from-vendor() { from-vendor() {
local what=$1 local what=$1
local repo=$2 local repo=$2
local vendor=$(dirname "${BASH_SOURCE[0]}")/../vendor.conf local vendor=$VENDOR
setvars=$(awk -v REPO=$repo -v WHAT=$what -- ' setvars=$(awk -v REPO=$repo -v WHAT=$what -- '
BEGIN { rc=1 } # Assume we did not find what we were looking for. BEGIN { rc=1 } # Assume we did not find what we were looking for.
// { // {
@ -91,14 +95,3 @@ from-vendor() {
fi fi
eval $setvars eval $setvars
} }
from-vendor RUNC github.com/opencontainers/runc
from-vendor CNI github.com/containernetworking/plugins
from-vendor CONTAINERD github.com/containerd/containerd
from-vendor KUBERNETES k8s.io/kubernetes
# k8s.io is actually a redirect, but we do not handle the go-import
# metadata which `go get` and `vndr` etc do. Handle it manually here.
if [ x"$KUBERNETES_REPO" = "xk8s.io" ] ; then
KUBERNETES_REPO="https://github.com/kubernetes/kubernetes"
fi

46
test/build-containerd.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright 2018 The containerd 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.
# This script is used to build and upload latest containerd from
# containerd/containerd in gcr.io/k8s-testimages/kubekins-e2e.
set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/build-utils.sh
cd "${ROOT}"
if [ -z "${GOPATH}" ]; then
echo "GOPATH is not set"
exit 1
fi
CONTAINERD_PATH=${GOPATH}/src/github.com/containerd/containerd
if [ ! -d "${CONTAINERD_PATH}" ]; then
echo "containerd repo does not exist"
exit 1
fi
# Make sure output directory is clean.
make clean
# Build and push test tarball.
PUSH_VERSION=true DEPLOY_DIR=${DEPLOY_DIR:-""} \
make push TARBALL_PREFIX=containerd-cni \
INCLUDE_CNI=true \
CHECKOUT_CONTAINERD=false \
VENDOR=${CONTAINERD_PATH}/vendor.conf

42
test/build-utils.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright 2018 The containerd 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.
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
# PROJECT is the gce project to upload tarball.
PROJECT=${PROJECT:-"k8s-cri-containerd"}
# GOOGLE_APPLICATION_CREDENTIALS is the path of service account file.
if [ -z ${GOOGLE_APPLICATION_CREDENTIALS} ]; then
echo "GOOGLE_APPLICATION_CREDENTIALS is not set"
exit 1
fi
# Activate gcloud service account.
gcloud auth activate-service-account --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" --project="${PROJECT}"
# Install dependent libraries.
sh -c "echo 'deb http://ftp.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list"
apt-get update
apt-get install -y btrfs-tools
apt-get install -y libseccomp2/jessie-backports
apt-get install -y libseccomp-dev/jessie-backports
apt-get install -y libapparmor-dev
# PULL_REFS is from prow.
if [ ! -z "${PULL_REFS:-""}" ]; then
DEPLOY_DIR=$(echo "${PULL_REFS}" | sha1sum | awk '{print $1}')
fi

View File

@ -14,45 +14,19 @@
# 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 is used to build and upload cri-containerd in gcr.io/k8s-testimages/kubekins-e2e. # This script is used to build and upload containerd with latest CRI plugin
# from containerd/cri in gcr.io/k8s-testimages/kubekins-e2e.
set -o xtrace set -o xtrace
set -o errexit set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/.. source $(dirname "${BASH_SOURCE[0]}")/build-utils.sh
cd "${ROOT}" cd "${ROOT}"
# PROJECT is the gce project to upload tarball.
PROJECT=${PROJECT:-"k8s-cri-containerd"}
# GOOGLE_APPLICATION_CREDENTIALS is the path of service account file.
if [ -z ${GOOGLE_APPLICATION_CREDENTIALS} ]; then
echo "GOOGLE_APPLICATION_CREDENTIALS is not set"
exit 1
fi
# Activate gcloud service account.
gcloud auth activate-service-account --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" --project="${PROJECT}"
# Install dependent libraries.
sh -c "echo 'deb http://ftp.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list"
apt-get update
apt-get install -y btrfs-tools
apt-get install -y libseccomp2/jessie-backports
apt-get install -y libseccomp-dev/jessie-backports
apt-get install -y libapparmor-dev
# PULL_REFS is from prow.
if [ ! -z "${PULL_REFS:-""}" ]; then
DEPLOY_DIR=$(echo "${PULL_REFS}" | sha1sum | awk '{print $1}')
fi
# Make sure output directory is clean. # Make sure output directory is clean.
make clean make clean
# Build and push e2e tarball. # Build and push test tarball.
DEPLOY_DIR=${DEPLOY_DIR:-""} make push
# Build and push node e2e tarball.
PUSH_VERSION=true DEPLOY_DIR=${DEPLOY_DIR:-""} \ PUSH_VERSION=true DEPLOY_DIR=${DEPLOY_DIR:-""} \
make push TARBALL_PREFIX=cri-containerd-cni INCLUDE_CNI=true CUSTOM_CONTAINERD=true make push TARBALL_PREFIX=cri-containerd-cni INCLUDE_CNI=true CUSTOM_CONTAINERD=true

View File

@ -50,7 +50,7 @@ fi
# By default use the release tarball with cni built in. # By default use the release tarball with cni built in.
PKG_PREFIX=${PKG_PREFIX:-"cri-containerd-cni"} PKG_PREFIX=${PKG_PREFIX:-"cri-containerd-cni"}
# PKG_PREFIX_METADATA is the metadata key of PKG_PREFIX. # PKG_PREFIX_METADATA is the metadata key of PKG_PREFIX.
PKG_PREFIX_METADATA="pkg_prefix" PKG_PREFIX_METADATA="pkg-prefix"
pkg_prefix=$(fetch_metadata "${PKG_PREFIX_METADATA}") pkg_prefix=$(fetch_metadata "${PKG_PREFIX_METADATA}")
if [ ! -z "${pkg_prefix}" ]; then if [ ! -z "${pkg_prefix}" ]; then
PKG_PREFIX=${pkg_prefix} PKG_PREFIX=${pkg_prefix}

View File

@ -0,0 +1,9 @@
images:
ubuntu:
image: ubuntu-gke-1604-xenial-v20170420-1
project: ubuntu-os-gke-cloud
metadata: "user-data<test/e2e_node/init.yaml,containerd-configure-sh<test/configure.sh,pkg-prefix=containerd-cni"
cos-stable:
image_regex: cos-stable-60-9592-84-0
project: cos-cloud
metadata: "user-data<test/e2e_node/init.yaml,containerd-configure-sh<test/configure.sh,extra-init-sh<test/e2e_node/gci-init.sh,gci-update-strategy=update_disabled,pkg-prefix=containerd-cni"