mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 00:46:38 +00:00
Merge pull request #141 from jodh-intel/ci-test-install-guides
CI: test installation guides
This commit is contained in:
@@ -8,4 +8,4 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
cidir=$(dirname "$0")
|
cidir=$(dirname "$0")
|
||||||
bash "${cidir}/static-checks.sh"
|
bash "${cidir}/test-install-docs.sh"
|
||||||
|
11
.ci/setup.sh
Executable file
11
.ci/setup.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cidir=$(dirname "$0")
|
||||||
|
bash "${cidir}/static-checks.sh"
|
86
.ci/test-install-docs.sh
Executable file
86
.ci/test-install-docs.sh
Executable file
@@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
info()
|
||||||
|
{
|
||||||
|
msg="$*"
|
||||||
|
echo "INFO: $msg"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Detect if any installation guides changed. If so, run the
|
||||||
|
# kata manager to "execute" the install guide to ensure the
|
||||||
|
# commands it specified result in a working system.
|
||||||
|
check_install_guides()
|
||||||
|
{
|
||||||
|
local -r install_guide_suffix="-installation-guide.md"
|
||||||
|
|
||||||
|
# List of filters used to restrict the types of file changes.
|
||||||
|
# See git-diff-tree(1) for further info.
|
||||||
|
local filters=""
|
||||||
|
|
||||||
|
# Added file
|
||||||
|
filters+="A"
|
||||||
|
|
||||||
|
# Copied file
|
||||||
|
filters+="C"
|
||||||
|
|
||||||
|
# Modified file
|
||||||
|
filters+="M"
|
||||||
|
|
||||||
|
# Renamed file
|
||||||
|
filters+="R"
|
||||||
|
|
||||||
|
# Unmerged (U) and Unknown (X) files. These particular filters
|
||||||
|
# shouldn't be necessary but just in case...
|
||||||
|
filters+="UX"
|
||||||
|
|
||||||
|
# List of changed files
|
||||||
|
local files=$(git diff-tree \
|
||||||
|
--name-only \
|
||||||
|
--no-commit-id \
|
||||||
|
--diff-filter="${filters}" \
|
||||||
|
-r \
|
||||||
|
origin/master HEAD || true)
|
||||||
|
|
||||||
|
# No files were changed
|
||||||
|
[ -z "$files" ] && return
|
||||||
|
|
||||||
|
changed=$(echo "$files" | grep "install/.*${install_guide_suffix}$" || true)
|
||||||
|
|
||||||
|
[ -z "$changed" ] && info "No install guides modified" && return
|
||||||
|
|
||||||
|
info "Found modified install guides: $changed"
|
||||||
|
|
||||||
|
# Regardless of which distro install guide(s) were changed, we test
|
||||||
|
# them all where possible.
|
||||||
|
|
||||||
|
local -r GOPATH=$(go env GOPATH)
|
||||||
|
[ -z "$GOPATH" ] && die "cannot determine GOPATH"
|
||||||
|
|
||||||
|
local -r mgr="${GOPATH}/src/github.com/kata-containers/tests/cmd/kata-manager/kata-manager.sh"
|
||||||
|
|
||||||
|
[ ! -e "$GOPATH" ] && die "cannot find $mgr"
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
|
||||||
|
info "Installing system from the $ID install guide"
|
||||||
|
|
||||||
|
$mgr install-packages
|
||||||
|
|
||||||
|
[ -n "$TRAVIS" ] && info "Not creating container as Travis lacks VT-x" && return
|
||||||
|
|
||||||
|
$mgr configure-image
|
||||||
|
$mgr enable-debug
|
||||||
|
|
||||||
|
msg="INFO: Successfully tested install guide for distro '$ID' $VERSION"
|
||||||
|
|
||||||
|
# Perform a basic test
|
||||||
|
sudo -E docker run --rm -i --runtime "kata-runtime" busybox echo "$msg"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_install_guides
|
@@ -8,5 +8,8 @@ dist: trusty
|
|||||||
|
|
||||||
language: bash
|
language: bash
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- ".ci/setup.sh"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ".ci/run.sh"
|
- ".ci/run.sh"
|
||||||
|
Reference in New Issue
Block a user