Merge pull request #600 from mikebrow/cleanup-hack-versions

removes hack versions; splits update vendor into optional sort and sync operations
This commit is contained in:
Lantao Liu 2018-02-14 16:42:55 -08:00 committed by GitHub
commit 454f583d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 67 additions and 35 deletions

View File

@ -57,8 +57,9 @@ help:
@echo " * 'install.deps' - Install dependencies of cri-containerd (containerd, runc, cni) Note: BUILDTAGS defaults to 'seccomp apparmor' for runc build"
@echo " * 'uninstall' - Remove installed binaries from system locations"
@echo " * 'version' - Print current cri-containerd release version"
@echo " * 'update-vendor' - Syncs containerd/vendor.conf -> vendor.conf and sorts vendor.conf"
verify: lint gofmt boiler deps-version
verify: lint gofmt boiler
version:
@echo $(VERSION)
@ -75,9 +76,17 @@ boiler:
@echo "checking boilerplate"
@./hack/verify-boilerplate.sh
deps-version:
@echo "checking /hack/versions"
@./hack/update-vendor.sh -only-verify
.PHONY: sort-vendor sync-vendor update-vendor
sort-vendor:
@echo "sorting vendor.conf"
@./hack/sort-vendor.sh
sync-vendor:
@echo "syncing vendor.conf from containerd"
@./hack/sync-vendor.sh
update-vendor: sync-vendor sort-vendor
$(BUILD_DIR)/cri-containerd: $(SOURCES)
$(GO) build -o $@ \
@ -134,7 +143,7 @@ uninstall:
rm -f $(BINDIR)/cri-containerd
rm -f $(BINDIR)/ctrcri
$(BUILD_DIR)/$(TARBALL): static-binaries hack/versions
$(BUILD_DIR)/$(TARBALL): static-binaries vendor.conf
@BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) ./hack/release.sh
release: $(BUILD_DIR)/$(TARBALL)

View File

@ -39,7 +39,7 @@ The current release of `cri-containerd` has the following dependencies:
* [runc](https://github.com/opencontainers/runc)
* [CNI](https://github.com/containernetworking/cni)
See [versions](./hack/versions) of these dependencies `cri-containerd` is tested with.
See [versions](./vendor.conf) of these dependencies `cri-containerd` is tested with.
As containerd and runc move to their respective general availability releases,
we will do our best to rebase/retest `cri-containerd` with these releases on a

View File

@ -13,7 +13,7 @@ or `crictl` please make sure the issue has not already been submitted.
If you have not already installed crictl please install the version compatible
with the `cri-containerd` you are using. If you are a user, your deployment
should have installed crictl for you. If not, get it from your release tarball.
If you are a developer the current version of crictl is specified [here](../hack/versions).
If you are a developer the current version of crictl is specified [here](../hack/utils.sh).
A helper command has been included to install the dependencies at the right version:
```console
$ make install.deps

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..."

1
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.

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