Merge pull request #1578 from baude/addubuntuci

Add Ubuntu-18.04 to CI testing
This commit is contained in:
OpenShift Merge Robot 2018-10-03 11:35:13 -07:00 committed by GitHub
commit 3750b35ae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 130 additions and 30 deletions

View file

@ -26,37 +26,14 @@ env:
jobs:
include:
- stage: Build and Verify
script:
- make gofmt
- make lint
go: 1.10.x
- script:
- make gofmt
- make lint
go: 1.10.x
os: osx
- script:
- make testunit
go: 1.9.x
- stage: Build and Verify
script:
- make testunit
go: 1.10.x
- script:
- make --keep-going local-cross
go: 1.10.x
- script:
- make --keep-going local-cross
go: 1.10.x
os: osx
env: ALLOWED_TO_FAIL=true
- stage: Integration Test
script:
- make integration
go: 1.9.x
allow_failures:
- env: ALLOWED_TO_FAIL=true
notifications:
irc: "chat.freenode.net#podman"

71
.ubuntu_prepare.sh Normal file
View file

@ -0,0 +1,71 @@
#!/bin/bash
set -xeuo pipefail
export GOPATH=/go
export PATH=$HOME/gopath/bin:$PATH:$GOPATH/bin
runc=0
conmon=0
cni=0
podman_conf=0
conmon_source=/go/src/github.com/containers/conmon
cni_source=/go/src/github.com/containernetworking/plugins
runc_source=/go/src/github.com/opencontainers/runc
podman_source=/var/tmp/checkout
while getopts "cnrf" opt; do
case "$opt" in
c) conmon=1
;;
f) podman_conf=1
;;
n) cni=1
;;
r) runc=1
;;
*) echo "Nothing to do ... exiting."
exit 0
;;
esac
done
if [ $conmon -eq 1 ]; then
# Build and install conmon from source
echo "Building conmon ..."
git clone http://github.com/containers/conmon $conmon_source
cd $conmon_source && make install PREFIX=/usr
fi
if [ $cni -eq 1 ]; then
# Build and install containernetworking plugins from source
echo "Building containernetworking-plugins..."
git clone http://github.com/containernetworking/plugins $cni_source
cd $cni_source
./build.sh
mkdir -p /usr/libexec/cni
cp -v bin/* /usr/libexec/cni/
fi
if [ $runc -eq 1 ]; then
# Build and install runc
echo "Building runc..."
git clone http://github.com/opencontainers/runc $runc_source
cd $runc_source
make install PREFIX=/usr
fi
if [ $podman_conf -eq 1 ]; then
# Install various configuration files required by libpod
# Install CNI conf file for podman
mkdir -p /etc/cni/net.d
cp -v $podman_source/cni/87-podman-bridge.conflist /etc/cni/net.d/
# Install registries.conf
mkdir -p /etc/containers
cp -v $podman_source/test/registries.conf /etc/containers/
cp -v $podman_source/test/policy.json /etc/containers/
fi

View file

@ -1333,3 +1333,10 @@ func (c *Container) unmount(force bool) error {
return nil
}
// getExcludedCGroups returns a string slice of cgroups we want to exclude
// because runc or other components are unaware of them.
func getExcludedCGroups() (excludes []string) {
excludes = []string{"rdma"}
return
}

View file

@ -265,7 +265,8 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool)
}
case CgroupfsCgroupsManager:
// Delete the cgroupfs cgroup
cgroup, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(p.state.CgroupPath))
v1CGroups := GetV1CGroups(getExcludedCGroups())
cgroup, err := cgroups.Load(v1CGroups, cgroups.StaticPath(p.state.CgroupPath))
if err != nil && err != cgroups.ErrCgroupDeleted {
return err
} else if err == nil {

View file

@ -33,13 +33,14 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container
if err != nil {
return nil, err
}
cgroup, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(cgroupPath))
v1CGroups := GetV1CGroups(getExcludedCGroups())
cgroup, err := cgroups.Load(v1CGroups, cgroups.StaticPath(cgroupPath))
if err != nil {
return stats, errors.Wrapf(err, "unable to load cgroup at %s", cgroupPath)
}
cgroupStats, err := cgroup.Stat()
// Ubuntu does not have swap memory in cgroups because swap is often not enabled.
cgroupStats, err := cgroup.Stat(cgroups.IgnoreNotExist)
if err != nil {
return stats, errors.Wrapf(err, "unable to obtain cgroup stats")
}

View file

@ -9,8 +9,10 @@ import (
"strings"
"time"
"github.com/containerd/cgroups"
"github.com/containers/image/signature"
"github.com/containers/image/types"
"github.com/containers/libpod/pkg/util"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
@ -160,3 +162,26 @@ func validPodNSOption(p *Pod, ctrPod string) error {
}
return nil
}
// GetV1CGroups gets the V1 cgroup subsystems and then "filters"
// out any subsystems that are provided by the caller. Passing nil
// for excludes will return the subsystems unfiltered.
//func GetV1CGroups(excludes []string) ([]cgroups.Subsystem, error) {
func GetV1CGroups(excludes []string) cgroups.Hierarchy {
return func() ([]cgroups.Subsystem, error) {
var filtered []cgroups.Subsystem
subSystem, err := cgroups.V1()
if err != nil {
return nil, err
}
for _, s := range subSystem {
// If the name of the subsystem is not in the list of excludes, then
// add it as a keeper.
if !util.StringInSlice(string(s.Name()), excludes) {
filtered = append(filtered, s)
}
}
return filtered, nil
}
}

View file

@ -63,6 +63,7 @@ type PodmanTest struct {
ArtifactPath string
TempDir string
CgroupManager string
Host HostOS
}
// HostOS is a simple struct for the test os
@ -126,6 +127,7 @@ func CreateTempDirInTempDir() (string, error) {
// PodmanCreate creates a PodmanTest instance for the tests
func PodmanCreate(tempDir string) PodmanTest {
host := GetHostDistributionInfo()
cwd, _ := os.Getwd()
podmanBinary := filepath.Join(cwd, "../../bin/podman")
@ -149,7 +151,19 @@ func PodmanCreate(tempDir string) PodmanTest {
cgroupManager = os.Getenv("CGROUP_MANAGER")
}
runCBinary := "/usr/bin/runc"
// Ubuntu doesn't use systemd cgroups
if host.Distribution == "ubuntu" {
cgroupManager = "cgroupfs"
}
runCBinary, err := exec.LookPath("runc")
// If we cannot find the runc binary, setting to something static as we have no way
// to return an error. The tests will fail and point out that the runc binary could
// not be found nicely.
if err != nil {
runCBinary = "/usr/bin/runc"
}
CNIConfigDir := "/etc/cni/net.d"
p := PodmanTest{
@ -164,6 +178,7 @@ func PodmanCreate(tempDir string) PodmanTest {
ArtifactPath: ARTIFACT_DIR,
TempDir: tempDir,
CgroupManager: cgroupManager,
Host: host,
}
// Setup registries.conf ENV variable

View file

@ -45,7 +45,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
Specify("no --cgroup-parent", func() {
cgroup := "/libpod_parent"
if !containerized() {
if !containerized() && podmanTest.CgroupManager != "cgroupfs" {
cgroup = "/machine.slice"
}
run := podmanTest.Podman([]string{"run", fedoraMinimal, "cat", "/proc/self/cgroup"})
@ -56,7 +56,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
})
Specify("valid --cgroup-parent using slice", func() {
if containerized() {
if containerized() || podmanTest.CgroupManager == "cgroupfs" {
Skip("Requires Systemd cgroup manager support")
}
cgroup := "aaaa.slice"

View file

@ -39,6 +39,9 @@ var _ = Describe("Podman run memory", func() {
})
It("podman run memory-reservation test", func() {
if podmanTest.Host.Distribution == "ubuntu" {
Skip("Unable to perform test on Ubuntu distributions due to memory management")
}
session := podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))