removes hack versions; splits update vendor and makes it optional

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
This commit is contained in:
Mike Brown
2018-02-06 19:58:28 -06:00
parent 561d045d71
commit 84139b4241
9 changed files with 67 additions and 35 deletions

View File

@@ -30,7 +30,6 @@ set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
. ${ROOT}/hack/versions
# DESTDIR is the dest path to install dependencies.
DESTDIR=${DESTDIR:-"/"}
@@ -141,13 +140,15 @@ checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
cd ${GOPATH}/src/${CONTAINERD_PKG}
if ${COOK_CONTAINERD}; then
# Verify that vendor.conf is in sync with containerd before cook containerd,
# this is a hard requirement.
if ! ${ROOT}/hack/update-vendor.sh -only-verify; then
echo "Please run hack/update-vendor.sh before cook containerd."
# this is a hard requirement for now because of below overwrite of
# containerd's vendor tree.
# TODO(random-liu): Remove this and the below import code after containerd
# starts to vendor cri plugin.
if ! ${ROOT}/hack/sync-vendor.sh -only-verify; then
echo "Please run hack/sync-vendor.sh before cook containerd."
exit 1
fi
# Import cri plugin into containerd.
# TODO(random-liu): Remove this after containerd starts to vendor cri plugin.
echo "import _ \"${CRI_CONTAINERD_PKG}\"" >> cmd/containerd/builtins_linux.go
# 1. Copy all cri-containerd vendors into containerd vendor. This makes sure
# all dependencies introduced by cri-containerd will be updated. There might

28
hack/sort-vendor.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
# 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
cd ${ROOT}
echo "Sort vendor.conf..."
sort vendor.conf -o vendor.conf
echo "Please commit the change made by this file..."

View File

@@ -1,6 +1,7 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
# 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.
@@ -21,9 +22,7 @@ set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
cd ${ROOT}
# hack/versions should be correct now.
echo "Compare vendor with containerd vendors..."
source hack/versions
containerd_vendor=$(mktemp /tmp/containerd-vendor.conf.XXXX)
curl -s https://raw.githubusercontent.com/${CONTAINERD_REPO#*/}/${CONTAINERD_VERSION}/vendor.conf > ${containerd_vendor}
# Create a temporary vendor file to update.
@@ -58,8 +57,3 @@ if ! diff vendor.conf ${tmp_vendor} > /dev/null; then
fi
fi
rm ${containerd_vendor}
echo "Sort vendor.conf..."
sort vendor.conf -o vendor.conf
echo "Please commit the change made by this file..."

3
hack/test-utils.sh Normal file → Executable file
View File

@@ -16,7 +16,6 @@
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
source ${ROOT}/hack/versions
# CRI_CONTAINERD_FLAGS are the extra flags to use when start cri-containerd.
CRI_CONTAINERD_FLAGS=${CRI_CONTAINERD_FLAGS:-""}
# RESTART_WAIT_PERIOD is the period to wait before restarting cri-containerd/containerd.
@@ -34,7 +33,7 @@ containerd_pid=
# test_setup starts containerd and cri-containerd.
test_setup() {
local report_dir=$1
local report_dir=$1
if [ ! -x ${ROOT}/_output/cri-containerd ]; then
echo "cri-containerd is not built"
exit 1

15
hack/utils.sh Normal file → Executable file
View File

@@ -16,6 +16,10 @@
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
# Not from vendor.conf.
CRITOOL_VERSION=c87ea764cecbcbabbb51c5bdd10ea317181fdd62
CRITOOL_REPO=github.com/kubernetes-incubator/cri-tools
# upload_logs_to_gcs uploads test logs to gcs.
# Var set:
# 1. Bucket: gcs bucket to upload logs.
@@ -87,3 +91,14 @@ from-vendor() {
fi
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

View File

@@ -1,14 +0,0 @@
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
# Not from vendor.conf.
CRITOOL_VERSION=c87ea764cecbcbabbb51c5bdd10ea317181fdd62
CRITOOL_REPO=github.com/kubernetes-incubator/cri-tools