Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ubuntu-18.04 to CI testing #1578

Merged
merged 1 commit into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 71 additions & 0 deletions .ubuntu_prepare.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions libpod/container_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1342,3 +1342,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
}
3 changes: 2 additions & 1 deletion libpod/runtime_pod_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions libpod/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this change in runtime_pod_linux.go line 268

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

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")
}
Expand Down
25 changes: 25 additions & 0 deletions libpod/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
}
}
17 changes: 16 additions & 1 deletion test/e2e/libpod_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type PodmanTest struct {
ArtifactPath string
TempDir string
CgroupManager string
Host HostOS
}

// HostOS is a simple struct for the test os
Expand Down Expand Up @@ -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")
Expand All @@ -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{
Expand All @@ -164,6 +178,7 @@ func PodmanCreate(tempDir string) PodmanTest {
ArtifactPath: ARTIFACT_DIR,
TempDir: tempDir,
CgroupManager: cgroupManager,
Host: host,
}

// Setup registries.conf ENV variable
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/run_cgroup_parent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand All @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/run_memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down