diff --git a/.travis.yml b/.travis.yml index 6d5ca171c7..247421c730 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,6 +56,7 @@ jobs: - name: ppc64le test os: linux-ppc64le install: skip + script: skip allow_failures: - name: ppc64le test fast_finish: true diff --git a/docs/CODEOWNERS b/CODEOWNERS similarity index 90% rename from docs/CODEOWNERS rename to CODEOWNERS index e48c094af2..f82bae0d54 100644 --- a/docs/CODEOWNERS +++ b/CODEOWNERS @@ -1,4 +1,4 @@ -# Copyright 2019 Intel Corporation. +# Copyright (c) 2019 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 # @@ -10,4 +10,3 @@ # used. See https://help.github.com/articles/about-code-owners/ *.md @kata-containers/documentation - diff --git a/ci/go-no-os-exit.sh b/ci/go-no-os-exit.sh new file mode 100755 index 0000000000..5f0f98436a --- /dev/null +++ b/ci/go-no-os-exit.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# +# Check there are no os.Exit() calls creeping into the code +# We don't use that exit path in the Kata codebase. + +# Allow the path to check to be over-ridden. +# Default to the current directory. +go_packages=${1:-.} + +echo "Checking for no os.Exit() calls for package [${go_packages}]" + +candidates=`go list -f '{{.Dir}}/*.go' $go_packages` +for f in $candidates; do + filename=`basename $f` + # skip all go test files + [[ $filename == *_test.go ]] && continue + # skip exit.go where, the only file we should call os.Exit() from. + [[ $filename == "exit.go" ]] && continue + files="$f $files" +done + +[ -z "$files" ] && echo "No files to check, skipping" && exit 0 + +if egrep -n '\' $files; then + echo "Direct calls to os.Exit() are forbidden, please use exit() so atexit() works" + exit 1 +fi diff --git a/ci/lib.sh b/ci/lib.sh index 3aa9c5c30e..f9a94bdd9f 100644 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -5,6 +5,7 @@ export tests_repo="${tests_repo:-github.com/kata-containers/tests}" export tests_repo_dir="$GOPATH/src/$tests_repo" +export branch="2.0-dev" clone_tests_repo() { @@ -17,14 +18,15 @@ clone_tests_repo() go get -d -u "$tests_repo" || true - if [ -n "${TRAVIS_BRANCH:-}" ]; then - ( cd "${tests_repo_dir}" && git checkout "${TRAVIS_BRANCH}" ) - fi + pushd "${tests_repo_dir}" && git checkout "${branch}" && popd } run_static_checks() { clone_tests_repo + # Make sure we have the targeting branch + git remote set-branches --add origin "${branch}" + git fetch -a bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/kata-containers" } diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md deleted file mode 100644 index 6460adf39d..0000000000 --- a/docs/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,3 +0,0 @@ -## Kata Containers Documentation Code of Conduct - -Kata Containers follows the [OpenStack Foundation Code of Conduct](https://www.openstack.org/legal/community-code-of-conduct/). diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md deleted file mode 100644 index 8a3af744a6..0000000000 --- a/docs/CONTRIBUTING.md +++ /dev/null @@ -1,5 +0,0 @@ -# Contributing - -## This repo is part of [Kata Containers](https://katacontainers.io) - -For details on how to contribute to the Kata Containers project, please see the main [contributing document](https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md). \ No newline at end of file diff --git a/docs/Developer-Guide.md b/docs/Developer-Guide.md index b66f02b1ee..20293490b1 100644 --- a/docs/Developer-Guide.md +++ b/docs/Developer-Guide.md @@ -39,15 +39,13 @@ * [Enable agent debug console](#enable-agent-debug-console) * [Start `kata-monitor`](#start-kata-monitor) * [Connect to debug console](#connect-to-debug-console) - * [Traditional debug console setup](#traditional-simple-debug-console-setup) + * [Traditional debug console setup](#traditional-debug-console-setup) * [Create a custom image containing a shell](#create-a-custom-image-containing-a-shell) * [Create a debug systemd service](#create-a-debug-systemd-service) * [Build the debug image](#build-the-debug-image) * [Configure runtime for custom debug image](#configure-runtime-for-custom-debug-image) - * [Ensure debug options are valid](#ensure-debug-options-are-valid) * [Create a container](#create-a-container) * [Connect to the virtual machine using the debug console](#connect-to-the-virtual-machine-using-the-debug-console) - * [Obtain details of the image](#obtain-details-of-the-image) * [Capturing kernel boot logs](#capturing-kernel-boot-logs) # Warning @@ -450,7 +448,7 @@ contain either `/bin/sh` or `/bin/bash`. #### Enable agent debug console -Enable debug_console_enabled in the configuration.toml configuration file: +Enable debug_console_enabled in the `configuration.toml` configuration file: ``` [agent.kata] @@ -461,7 +459,7 @@ This will pass `agent.debug_console agent.debug_console_vport=1026` to agent as #### Start `kata-monitor` -The `kata-runtime exec` command needs `kata-monitor` to get the sandbox's `vsock` address to connect to, firt start `kata-monitor`. +The `kata-runtime exec` command needs `kata-monitor` to get the sandbox's `vsock` address to connect to, first start `kata-monitor`. ``` $ sudo kata-monitor @@ -503,7 +501,7 @@ the following steps (using rootfs or initrd image). > > Look for `INIT_PROCESS=systemd` in the `config.sh` osbuilder rootfs config file > to verify an osbuilder distro supports systemd for the distro you want to build rootfs for. -> For an example, see the [Clear Linux config.sh file](../tools/osbuilder/blob/master/rootfs-builder/clearlinux/config.sh). +> For an example, see the [Clear Linux config.sh file](../tools/osbuilder/rootfs-builder/clearlinux/config.sh). > > For a non-systemd-based distro, create an equivalent system > service using that distro’s init system syntax. Alternatively, you can build a distro @@ -589,7 +587,7 @@ to avoid all subsequently created containers from using the debug image. #### Create a container -Create a container as normal. For example using crictl: +Create a container as normal. For example using `crictl`: ``` $ sudo crictl run -r kata container.yaml pod.yaml diff --git a/docs/README.md b/docs/README.md index 8a5c6daa3d..efea181844 100644 --- a/docs/README.md +++ b/docs/README.md @@ -54,7 +54,7 @@ Documents that help to understand and contribute to Kata Containers. * [Developer Guide](Developer-Guide.md): Setup the Kata Containers developing environments * [How to contribute to Kata Containers](https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md) -* [Code of Conduct](CODE_OF_CONDUCT.md) +* [Code of Conduct](../CODE_OF_CONDUCT.md) ### Code Licensing diff --git a/snap/README.md b/snap/README.md index f0982adb8b..b2e69e5ee1 100644 --- a/snap/README.md +++ b/snap/README.md @@ -84,12 +84,12 @@ then a new configuration file can be [created](#configure-kata-containers) and [configured][7]. [1]: https://docs.snapcraft.io/snaps/intro -[2]: ../../../docs/design/architecture.md#root-filesystem-image +[2]: ../docs/design/architecture.md#root-filesystem-image [3]: https://docs.snapcraft.io/reference/confinement#classic [4]: https://github.com/kata-containers/runtime#configuration [5]: https://docs.docker.com/engine/reference/commandline/dockerd -[6]: ../../../docs/install/docker/ubuntu-docker-install.md -[7]: ../../../docs/Developer-Guide.md#configure-to-use-initrd-or-rootfs-image +[6]: ../docs/install/docker/ubuntu-docker-install.md +[7]: ../docs/Developer-Guide.md#configure-to-use-initrd-or-rootfs-image [8]: https://snapcraft.io/kata-containers -[9]: ../../../docs/Developer-Guide.md#run-kata-containers-with-docker -[10]: ../../../docs/Developer-Guide.md#run-kata-containers-with-kubernetes +[9]: ../docs/Developer-Guide.md#run-kata-containers-with-docker +[10]: ../docs/Developer-Guide.md#run-kata-containers-with-kubernetes diff --git a/src/agent/protocols/src/lib.rs b/src/agent/protocols/src/lib.rs index 2f6d77babe..5637a648ab 100644 --- a/src/agent/protocols/src/lib.rs +++ b/src/agent/protocols/src/lib.rs @@ -6,11 +6,11 @@ pub mod agent; pub mod agent_ttrpc; +pub mod empty; pub mod health; pub mod health_ttrpc; pub mod oci; pub mod types; -pub mod empty; #[cfg(test)] mod tests { diff --git a/src/runtime/CONTRIBUTING.md b/src/runtime/CONTRIBUTING.md deleted file mode 100644 index 8a3af744a6..0000000000 --- a/src/runtime/CONTRIBUTING.md +++ /dev/null @@ -1,5 +0,0 @@ -# Contributing - -## This repo is part of [Kata Containers](https://katacontainers.io) - -For details on how to contribute to the Kata Containers project, please see the main [contributing document](https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md). \ No newline at end of file diff --git a/src/runtime/Makefile b/src/runtime/Makefile index f4c2bf661b..8cf73abeb9 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -582,7 +582,6 @@ $(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) .PHONY: \ check \ check-go-static \ - check-go-test \ coverage \ default \ install \ @@ -688,9 +687,9 @@ go-test: $(GENERATED_FILES) go test -v -mod=vendor ./... check-go-static: - $(QUIET_CHECK).ci/static-checks.sh - $(QUIET_CHECK).ci/go-no-os-exit.sh ./cli - $(QUIET_CHECK).ci/go-no-os-exit.sh ./virtcontainers + $(QUIET_CHECK)../../ci/static-checks.sh + $(QUIET_CHECK)../../ci/go-no-os-exit.sh ./cli + $(QUIET_CHECK)../../ci/go-no-os-exit.sh ./virtcontainers coverage: go test -v -mod=vendor -covermode=atomic -coverprofile=coverage.txt ./... diff --git a/src/runtime/cli/console_test.go b/src/runtime/cli/console_test.go index 951c9c24c0..80700ba463 100644 --- a/src/runtime/cli/console_test.go +++ b/src/runtime/cli/console_test.go @@ -10,6 +10,7 @@ import ( "os" "testing" + ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils" "github.com/stretchr/testify/assert" ) @@ -22,6 +23,9 @@ func TestConsoleFromFile(t *testing.T) { } func TestNewConsole(t *testing.T) { + if tc.NotValid(ktu.NeedRoot()) { + t.Skip(testDisabledAsNonRoot) + } assert := assert.New(t) console, err := newConsole() @@ -34,6 +38,9 @@ func TestNewConsole(t *testing.T) { } func TestIsTerminal(t *testing.T) { + if tc.NotValid(ktu.NeedRoot()) { + t.Skip(testDisabledAsNonRoot) + } assert := assert.New(t) var fd uintptr = 4 diff --git a/src/runtime/containerd-shim-v2/shim_metrics_test.go b/src/runtime/containerd-shim-v2/shim_metrics_test.go index ba1afe552a..03b09ee991 100644 --- a/src/runtime/containerd-shim-v2/shim_metrics_test.go +++ b/src/runtime/containerd-shim-v2/shim_metrics_test.go @@ -68,10 +68,10 @@ func TestStatsSandbox(t *testing.T) { StatsFunc: getSandboxCPUFunc(1000, 100000), StatsContainerFunc: getStatsContainerCPUFunc(100, 200, 10000, 20000), MockContainers: []*vcmock.Container{ - &vcmock.Container{ + { MockID: "foo", }, - &vcmock.Container{ + { MockID: "bar", }, }, diff --git a/src/runtime/virtcontainers/device/manager/utils_test.go b/src/runtime/virtcontainers/device/manager/utils_test.go index cbf18e35d0..baf8aa95bb 100644 --- a/src/runtime/virtcontainers/device/manager/utils_test.go +++ b/src/runtime/virtcontainers/device/manager/utils_test.go @@ -75,7 +75,7 @@ func TestIsVhostUserBlk(t *testing.T) { isVhostUserBlk := isVhostUserBlk( config.DeviceInfo{ DevType: d.devType, - Major: d.major, + Major: d.major, }) assert.Equal(t, d.expected, isVhostUserBlk) } @@ -100,7 +100,7 @@ func TestIsVhostUserSCSI(t *testing.T) { isVhostUserSCSI := isVhostUserSCSI( config.DeviceInfo{ DevType: d.devType, - Major: d.major, + Major: d.major, }) assert.Equal(t, d.expected, isVhostUserSCSI) } diff --git a/src/runtime/virtcontainers/documentation/Developers.md b/src/runtime/virtcontainers/documentation/Developers.md index 81d5021b9c..6ec807658b 100644 --- a/src/runtime/virtcontainers/documentation/Developers.md +++ b/src/runtime/virtcontainers/documentation/Developers.md @@ -51,5 +51,5 @@ This will: # Submitting changes For details on the format and how to submit changes, refer to the -[Contributing](../../CONTRIBUTING.md) document. +[Contributing](../../../../CONTRIBUTING.md) document. diff --git a/src/runtime/virtcontainers/pkg/agent/protocols/client/client.go b/src/runtime/virtcontainers/pkg/agent/protocols/client/client.go index c3b1c9390b..db6a4f1123 100644 --- a/src/runtime/virtcontainers/pkg/agent/protocols/client/client.go +++ b/src/runtime/virtcontainers/pkg/agent/protocols/client/client.go @@ -1,4 +1,4 @@ -// Copyright 2017 HyperHQ Inc. +// Copyright (c) 2017 HyperHQ Inc. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/runtime/virtcontainers/qemu_arch_base.go b/src/runtime/virtcontainers/qemu_arch_base.go index 363bc3fd93..ba1f66b52a 100644 --- a/src/runtime/virtcontainers/qemu_arch_base.go +++ b/src/runtime/virtcontainers/qemu_arch_base.go @@ -136,18 +136,18 @@ type qemuArch interface { } type qemuArchBase struct { - qemuMachine govmmQemu.Machine - qemuExePath string - memoryOffset uint32 - nestedRun bool - vhost bool - disableNvdimm bool - dax bool - networkIndex int - kernelParamsNonDebug []Param - kernelParamsDebug []Param - kernelParams []Param - Bridges []types.Bridge + qemuMachine govmmQemu.Machine + qemuExePath string + memoryOffset uint32 + nestedRun bool + vhost bool + disableNvdimm bool + dax bool + networkIndex int + kernelParamsNonDebug []Param + kernelParamsDebug []Param + kernelParams []Param + Bridges []types.Bridge } const ( diff --git a/src/runtime/virtcontainers/qemu_ppc64le.go b/src/runtime/virtcontainers/qemu_ppc64le.go index e19340da28..86fc141d79 100644 --- a/src/runtime/virtcontainers/qemu_ppc64le.go +++ b/src/runtime/virtcontainers/qemu_ppc64le.go @@ -36,7 +36,7 @@ var kernelParams = []Param{ {"net.ifnames", "0"}, } -var supportedQemuMachine = govmmQemu.Machine { +var supportedQemuMachine = govmmQemu.Machine{ Type: QemuPseries, Options: defaultQemuMachineOptions, } @@ -63,12 +63,12 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) { q := &qemuPPC64le{ qemuArchBase{ - qemuMachine: supportedQemuMachine, - qemuExePath: defaultQemuPath, - memoryOffset: config.MemOffset, - kernelParamsNonDebug: kernelParamsNonDebug, - kernelParamsDebug: kernelParamsDebug, - kernelParams: kernelParams, + qemuMachine: supportedQemuMachine, + qemuExePath: defaultQemuPath, + memoryOffset: config.MemOffset, + kernelParamsNonDebug: kernelParamsNonDebug, + kernelParamsDebug: kernelParamsDebug, + kernelParams: kernelParams, }, } diff --git a/src/runtime/virtcontainers/qemu_s390x.go b/src/runtime/virtcontainers/qemu_s390x.go index 132d7d7813..a43fe4bff8 100644 --- a/src/runtime/virtcontainers/qemu_s390x.go +++ b/src/runtime/virtcontainers/qemu_s390x.go @@ -36,7 +36,7 @@ var kernelParams = []Param{ var ccwbridge = types.NewBridge(types.CCW, "", make(map[uint32]string, types.CCWBridgeMaxCapacity), 0) -var supportedQemuMachine = govmmQemu.Machine { +var supportedQemuMachine = govmmQemu.Machine{ Type: QemuCCWVirtio, Options: defaultQemuMachineOptions, } @@ -61,12 +61,12 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) { q := &qemuS390x{ qemuArchBase{ - qemuMachine: supportedQemuMachine, - qemuExePath: defaultQemuPath, - memoryOffset: config.MemOffset, - kernelParamsNonDebug: kernelParamsNonDebug, - kernelParamsDebug: kernelParamsDebug, - kernelParams: kernelParams, + qemuMachine: supportedQemuMachine, + qemuExePath: defaultQemuPath, + memoryOffset: config.MemOffset, + kernelParamsNonDebug: kernelParamsNonDebug, + kernelParamsDebug: kernelParamsDebug, + kernelParams: kernelParams, }, } // Set first bridge type to CCW diff --git a/tools/packaging/CODE_OF_CONDUCT.md b/tools/packaging/CODE_OF_CONDUCT.md deleted file mode 100644 index 1d9d931ad4..0000000000 --- a/tools/packaging/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,3 +0,0 @@ -## Kata Containers CI Code of Conduct - -Kata Containers follows the [OpenStack Foundation Code of Conduct](https://www.openstack.org/legal/community-code-of-conduct/). diff --git a/tools/packaging/CONTRIBUTING.md b/tools/packaging/CONTRIBUTING.md deleted file mode 100644 index bdeeb024a9..0000000000 --- a/tools/packaging/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -For details on how to contribute to the Kata Containers project, please see the main [contributing document](https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md). diff --git a/tools/packaging/README.md b/tools/packaging/README.md index 69d09c556d..7a8a7125ec 100644 --- a/tools/packaging/README.md +++ b/tools/packaging/README.md @@ -31,7 +31,7 @@ running Kubernetes Cluster very straightforward. ## Build a snap package -See [the snap documentation](snap). +See [the snap documentation](../../snap). ## Build static binaries @@ -61,6 +61,10 @@ See [the Jenkins documentation](Jenkinsfiles). See the [scripts documentation](scripts). +## Sync packages + +See [the `kata-pkgsync` documentation](cmd/kata-pkgsync). + ## Credits Kata Containers packaging uses [packagecloud](https://packagecloud.io) for