Add test-containerd for plugin mode test
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
45b6e75803
commit
cc2726054d
@ -32,13 +32,13 @@ jobs:
|
|||||||
- make install.tools
|
- make install.tools
|
||||||
- make .gitvalidation
|
- make .gitvalidation
|
||||||
- make binaries
|
- make binaries
|
||||||
- make plugin
|
- make containerd
|
||||||
go: 1.9.x
|
go: 1.9.x
|
||||||
- script:
|
- script:
|
||||||
- make install.tools
|
- make install.tools
|
||||||
- make .gitvalidation
|
- make .gitvalidation
|
||||||
- make binaries
|
- make binaries
|
||||||
- make plugin
|
- make containerd
|
||||||
go: tip
|
go: tip
|
||||||
- stage: Test
|
- stage: Test
|
||||||
script:
|
script:
|
||||||
@ -54,7 +54,9 @@ jobs:
|
|||||||
- cat /tmp/test-cri/containerd.log
|
- cat /tmp/test-cri/containerd.log
|
||||||
go: 1.9.x
|
go: 1.9.x
|
||||||
- script:
|
- script:
|
||||||
- make install.deps COOK_CONTAINERD=true
|
- make install.deps
|
||||||
|
- make containerd
|
||||||
|
- sudo make install-containerd
|
||||||
- make test-integration STANDALONE_CRI_CONTAINERD=false
|
- make test-integration STANDALONE_CRI_CONTAINERD=false
|
||||||
- make test-cri STANDALONE_CRI_CONTAINERD=false
|
- make test-cri STANDALONE_CRI_CONTAINERD=false
|
||||||
after_script:
|
after_script:
|
||||||
|
59
Makefile
59
Makefile
@ -40,24 +40,25 @@ default: help
|
|||||||
help:
|
help:
|
||||||
@echo "Usage: make <target>"
|
@echo "Usage: make <target>"
|
||||||
@echo
|
@echo
|
||||||
@echo " * 'install' - Install binaries to system locations"
|
@echo " * 'install' - Install binaries to system locations"
|
||||||
@echo " * 'binaries' - Build cri-containerd and ctrcri"
|
@echo " * 'binaries' - Build cri-containerd and ctrcri"
|
||||||
@echo " * 'plugin' - Build cri-containerd as a plugin package"
|
@echo " * 'static-binaries - Build static cri-containerd and ctrcri"
|
||||||
@echo " * 'static-binaries - Build static cri-containerd and ctrcri"
|
@echo " * 'release' - Build release tarball"
|
||||||
@echo " * 'release' - Build release tarball"
|
@echo " * 'push' - Push release tarball to GCS"
|
||||||
@echo " * 'push' - Push release tarball to GCS"
|
@echo " * 'containerd' - Build a customized containerd with CRI plugin for testing"
|
||||||
@echo " * 'test' - Test cri-containerd with unit test"
|
@echo " * 'install-containerd' - Install customized containerd to system location"
|
||||||
@echo " * 'test-integration' - Test cri-containerd with integration test"
|
@echo " * 'test' - Test cri-containerd with unit test"
|
||||||
@echo " * 'test-cri' - Test cri-containerd with cri validation test"
|
@echo " * 'test-integration' - Test cri-containerd with integration test"
|
||||||
@echo " * 'test-e2e-node' - Test cri-containerd with Kubernetes node e2e test"
|
@echo " * 'test-cri' - Test cri-containerd with cri validation test"
|
||||||
@echo " * 'clean' - Clean artifacts"
|
@echo " * 'test-e2e-node' - Test cri-containerd with Kubernetes node e2e test"
|
||||||
@echo " * 'verify' - Execute the source code verification tools"
|
@echo " * 'clean' - Clean artifacts"
|
||||||
@echo " * 'proto' - Update protobuf of cri-containerd api"
|
@echo " * 'verify' - Execute the source code verification tools"
|
||||||
@echo " * 'install.tools' - Install tools used by verify"
|
@echo " * 'proto' - Update protobuf of cri-containerd api"
|
||||||
@echo " * 'install.deps' - Install dependencies of cri-containerd (containerd, runc, cni) Note: BUILDTAGS defaults to 'seccomp apparmor' for runc build"
|
@echo " * 'install.tools' - Install tools used by verify"
|
||||||
@echo " * 'uninstall' - Remove installed binaries from system locations"
|
@echo " * 'install.deps' - Install dependencies of cri-containerd (containerd, runc, cni) Note: BUILDTAGS defaults to 'seccomp apparmor' for runc build"
|
||||||
@echo " * 'version' - Print current cri-containerd release version"
|
@echo " * 'uninstall' - Remove installed binaries from system locations"
|
||||||
@echo " * 'update-vendor' - Syncs containerd/vendor.conf -> vendor.conf and sorts vendor.conf"
|
@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
|
verify: lint gofmt boiler
|
||||||
|
|
||||||
@ -102,6 +103,13 @@ $(BUILD_DIR)/ctrcri: $(SOURCES)
|
|||||||
-gcflags '$(GO_GCFLAGS)' \
|
-gcflags '$(GO_GCFLAGS)' \
|
||||||
$(PROJECT)/cmd/ctrcri
|
$(PROJECT)/cmd/ctrcri
|
||||||
|
|
||||||
|
$(BUILD_DIR)/containerd: $(SOURCES) $(PLUGIN_SOURCES)
|
||||||
|
$(GO) build -o $@ \
|
||||||
|
-tags '$(BUILD_TAGS)' \
|
||||||
|
-ldflags '$(GO_LDFLAGS)' \
|
||||||
|
-gcflags '$(GO_GCFLAGS)' \
|
||||||
|
$(PROJECT)/cmd/containerd
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(GO) test -timeout=10m -race ./pkg/... \
|
$(GO) test -timeout=10m -race ./pkg/... \
|
||||||
-tags '$(BUILD_TAGS)' \
|
-tags '$(BUILD_TAGS)' \
|
||||||
@ -125,13 +133,6 @@ clean:
|
|||||||
|
|
||||||
binaries: $(BUILD_DIR)/cri-containerd $(BUILD_DIR)/ctrcri
|
binaries: $(BUILD_DIR)/cri-containerd $(BUILD_DIR)/ctrcri
|
||||||
|
|
||||||
# TODO(random-liu): Make this only build when source files change and
|
|
||||||
# add this to target all.
|
|
||||||
plugin: $(PLUGIN_SOURCES) $(SOURCES)
|
|
||||||
$(GO) build -tags '$(BUILD_TAGS)' \
|
|
||||||
-ldflags '$(GO_LDFLAGS)' \
|
|
||||||
-gcflags '$(GO_GCFLAGS)' \
|
|
||||||
|
|
||||||
static-binaries: GO_LDFLAGS += -extldflags "-fno-PIC -static"
|
static-binaries: GO_LDFLAGS += -extldflags "-fno-PIC -static"
|
||||||
static-binaries: $(BUILD_DIR)/cri-containerd $(BUILD_DIR)/ctrcri
|
static-binaries: $(BUILD_DIR)/cri-containerd $(BUILD_DIR)/ctrcri
|
||||||
|
|
||||||
@ -151,6 +152,11 @@ release: $(BUILD_DIR)/$(TARBALL)
|
|||||||
push: $(BUILD_DIR)/$(TARBALL)
|
push: $(BUILD_DIR)/$(TARBALL)
|
||||||
@BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) VERSION=$(VERSION) ./hack/push.sh
|
@BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) VERSION=$(VERSION) ./hack/push.sh
|
||||||
|
|
||||||
|
containerd: $(BUILD_DIR)/containerd
|
||||||
|
|
||||||
|
install-containerd: containerd
|
||||||
|
install -D -m 755 $(BUILD_DIR)/containerd $(BINDIR)/containerd
|
||||||
|
|
||||||
proto:
|
proto:
|
||||||
@hack/update-proto.sh
|
@hack/update-proto.sh
|
||||||
|
|
||||||
@ -183,7 +189,6 @@ install.tools: .install.gitvalidation .install.gometalinter
|
|||||||
.PHONY: \
|
.PHONY: \
|
||||||
binaries \
|
binaries \
|
||||||
static-binaries \
|
static-binaries \
|
||||||
plugin \
|
|
||||||
release \
|
release \
|
||||||
push \
|
push \
|
||||||
boiler \
|
boiler \
|
||||||
@ -193,6 +198,8 @@ install.tools: .install.gitvalidation .install.gometalinter
|
|||||||
help \
|
help \
|
||||||
install \
|
install \
|
||||||
lint \
|
lint \
|
||||||
|
containerd \
|
||||||
|
install-containerd \
|
||||||
test \
|
test \
|
||||||
test-integration \
|
test-integration \
|
||||||
test-cri \
|
test-cri \
|
||||||
|
56
cmd/containerd/containerd.go
Normal file
56
cmd/containerd/containerd.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
_ "github.com/containerd/containerd/diff/walking/plugin"
|
||||||
|
_ "github.com/containerd/containerd/gc/scheduler"
|
||||||
|
_ "github.com/containerd/containerd/linux"
|
||||||
|
_ "github.com/containerd/containerd/metrics/cgroups"
|
||||||
|
_ "github.com/containerd/containerd/services/containers"
|
||||||
|
_ "github.com/containerd/containerd/services/content"
|
||||||
|
_ "github.com/containerd/containerd/services/diff"
|
||||||
|
_ "github.com/containerd/containerd/services/events"
|
||||||
|
_ "github.com/containerd/containerd/services/healthcheck"
|
||||||
|
_ "github.com/containerd/containerd/services/images"
|
||||||
|
_ "github.com/containerd/containerd/services/introspection"
|
||||||
|
_ "github.com/containerd/containerd/services/leases"
|
||||||
|
_ "github.com/containerd/containerd/services/namespaces"
|
||||||
|
_ "github.com/containerd/containerd/services/snapshots"
|
||||||
|
_ "github.com/containerd/containerd/services/tasks"
|
||||||
|
_ "github.com/containerd/containerd/services/version"
|
||||||
|
_ "github.com/containerd/containerd/snapshots/overlay"
|
||||||
|
_ "github.com/containerd/cri-containerd"
|
||||||
|
|
||||||
|
"github.com/containerd/containerd/cmd/containerd/command"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/containerd/cri-containerd/pkg/version"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := command.App()
|
||||||
|
app.Version = version.CRIContainerdVersion + "-TEST-with-cri-plugin"
|
||||||
|
logrus.Warn("This customized containerd is only for CI test, DO NOT use it for distribution.")
|
||||||
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "containerd: %s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
@ -51,11 +51,6 @@ fi
|
|||||||
# and configurations in cluster.
|
# and configurations in cluster.
|
||||||
INSTALL_CNI=${INSTALL_CNI:-true}
|
INSTALL_CNI=${INSTALL_CNI:-true}
|
||||||
|
|
||||||
# COOK_CONTAINERD indicates whether to update containerd with newest
|
|
||||||
# cri plugin before install. This is mainly used for testing new cri
|
|
||||||
# plugin change.
|
|
||||||
COOK_CONTAINERD=${COOK_CONTAINERD:-false}
|
|
||||||
|
|
||||||
CONTAINERD_DIR=${DESTDIR}/usr/local
|
CONTAINERD_DIR=${DESTDIR}/usr/local
|
||||||
RUNC_DIR=${DESTDIR}
|
RUNC_DIR=${DESTDIR}
|
||||||
CNI_DIR=${DESTDIR}/opt/cni
|
CNI_DIR=${DESTDIR}/opt/cni
|
||||||
@ -138,37 +133,6 @@ fi
|
|||||||
# Install containerd
|
# Install containerd
|
||||||
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
|
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
|
||||||
cd ${GOPATH}/src/${CONTAINERD_PKG}
|
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 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.
|
|
||||||
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
|
|
||||||
# be unnecessary vendors introduced, but it still builds.
|
|
||||||
cp -rT ${ROOT}/vendor/ vendor/
|
|
||||||
# 2. Remove containerd repo itself from vendor.
|
|
||||||
rm -rf vendor/${CONTAINERD_PKG}
|
|
||||||
# 3. Create cri-containerd vendor in containerd vendor, and copy the newest
|
|
||||||
# cri-containerd there.
|
|
||||||
if [ -d "vendor/${CRI_CONTAINERD_PKG}" ]; then
|
|
||||||
rm -rf vendor/${CRI_CONTAINERD_PKG}/*
|
|
||||||
else
|
|
||||||
mkdir -p vendor/${CRI_CONTAINERD_PKG}
|
|
||||||
fi
|
|
||||||
cp -rT ${ROOT} vendor/${CRI_CONTAINERD_PKG}
|
|
||||||
# 4. Remove the extra vendor in cri-containerd.
|
|
||||||
rm -rf vendor/${CRI_CONTAINERD_PKG}/vendor
|
|
||||||
# After the 4 steps above done, we have a containerd with newest cri-containerd
|
|
||||||
# plugin.
|
|
||||||
fi
|
|
||||||
make BUILDTAGS="${BUILDTAGS}"
|
make BUILDTAGS="${BUILDTAGS}"
|
||||||
# containerd make install requires `go` to work. Explicitly
|
# containerd make install requires `go` to work. Explicitly
|
||||||
# set PATH to make sure it can find `go` even with `sudo`.
|
# set PATH to make sure it can find `go` even with `sudo`.
|
||||||
|
Loading…
Reference in New Issue
Block a user