many: support debian in our CI #3156

Merged
merged 20 commits into from Apr 27, 2017

Conversation

Projects
None yet
3 participants
Contributor

morphis commented Apr 10, 2017

This adds support for debian based images on Linode to our CI infrastructure.

packaging/ubuntu-16.04/rules
@@ -54,7 +54,7 @@ ifeq ($(shell dpkg-vendor --query Vendor),Ubuntu)
# libudev and udevd so we need to link with it dynamically.
VENDOR_ARGS=--enable-nvidia-ubuntu --enable-static-libcap --enable-static-libapparmor --enable-static-libseccomp
else
- VENDOR_ARGS=--disable-apparmor
+ VENDOR_ARGS=--disable-apparmor --disable-seccomp
@zyga

zyga Apr 10, 2017

Contributor

Can you do a second ifeq and check for Debian, the else part should be empty.

@morphis

morphis Apr 19, 2017

Contributor

@zyga You mean a second ifeq within the else part or dropping the else part completely?

@zyga

zyga Apr 25, 2017

Contributor

A second, chained ifeq so that the else is applied to !ubuntu and !debian

packaging/ubuntu-16.04/snapd.install
@@ -17,7 +17,7 @@ data/udev/rules.d/66-snapd-autoimport.rules /lib/udev/rules.d
data/info /usr/lib/snapd/
# snap-confine stuff
-etc/apparmor.d/usr.lib.snapd.snap-confine.real
+# etc/apparmor.d/usr.lib.snapd.snap-confine.real
@zyga

zyga Apr 10, 2017

Contributor

Perhaps we should remove the top-level symlink and just add packaging/debian-9 and let the CI part add the relevant stuff. Note that for fedora the process is totally different so we need to re-think how this is done.

spread.yaml
@@ -54,6 +54,9 @@ backends:
kernel: Direct Disk
image: ubuntu-16.04-64
workers: 2
+ - debian-9-64:
+ kernel: GRUB 2
@zyga

zyga Apr 10, 2017

Contributor

Not sure what kernel this will be for Debian TBH

@morphis morphis changed the title from WIP: debian support for spread testing to Support debian in our CI Apr 19, 2017

@morphis morphis changed the title from Support debian in our CI to many: support debian in our CI Apr 19, 2017

Quick comment on disabling tests on Debian.

cmd/snap/cmd_is_forced_devmode.go
+func init() {
+ cmd := addCommand("is-forced-devmode",
+ i18n.G("Check if forced devmode is enabled or not"),
+ i18n.G("Check if forced devmode is enabled or not"),
@zyga

zyga Apr 19, 2017

Contributor

I suspect this part doesn't respect the rules for command help and long description. Have a look at other commands and what they do.

tests/main/completion/task.yaml
@@ -1,7 +1,7 @@
summary: Check different completions
# ppc64el disabled because of https://github.com/snapcore/snapd/issues/2502
-systems: [-ubuntu-core-16-*, -ubuntu-*-ppc64el]
+systems: [-ubuntu-core-16-*, -ubuntu-*-ppc64el, -debian-*]
@zyga

zyga Apr 19, 2017

Contributor

Why is this disabled on Debian?

@morphis

morphis Apr 19, 2017

Contributor

As commit message says it's somehow failing as the expected output is different. Something I am still looking into.

tests/main/install-sideload/task.yaml
@@ -1,5 +1,7 @@
summary: Checks for snap sideload install
+systems: [-debian-*]
@zyga

zyga Apr 19, 2017

Contributor

Please always indicate why something is disabled on any given system. Otherwise it is just a bug waiting to be discovered.

@morphis

morphis Apr 19, 2017

Contributor

Will add comments for each.

@zyga

zyga Apr 19, 2017

Contributor

Thanks!

One more comment

tests/main/confinement-classic/task.yaml
-systems: [-ubuntu-core-16-*,-debian-*]
+systems:
+ - -ubuntu-core-16
+ # No confinement (AppArmor, Seccomp) available on these systems
@zyga

zyga Apr 19, 2017

Contributor

But this is classic confinement :) It should just work, except for jailmode. I think we should not disable any such test but instead make the part that exercises confinement dependant on the hidden command that tells us if confinement is enabled or not.

@morphis

morphis Apr 20, 2017

Contributor

Exactly that is the plan but in a second wave. As soon as all tests are green I want a first version landed. Using a snap is-forced-devmode check will then require some refactoring in the tests which I want clearly separate from this to not make the PRs bigger as needed.

This is classic confinement but fails because of jailmode. Lets enable this again in the second wave. Its not like I am throwing a PR and will never care again :-)

Contributor

zyga commented Apr 24, 2017

There are still a few failures in tests, do you want to get a full review of the branch before those go green?

Contributor

morphis commented Apr 24, 2017

@zyga If you want, please shoot your comments. I am still working on the remaining test cases but another review should be fine already at this stage.

tests/main/confinement-classic/task.yaml
+ # FIXME jailmode doesn't work on debian type systems due to missing
+ # confinement yet. This check will be replaced with proper detection
+ # if confinement is supported on the platform we're running.
+ if [ "$SPREAD_SYSTEM" != "debian-*" ]; then
@zyga

zyga Apr 25, 2017

Contributor

I would not expect globbing to work this way? Are you sure?

@zyga

zyga Apr 25, 2017

Contributor

Per discussion on IRC this is incorrect.

@morphis

morphis Apr 25, 2017

Contributor

Yeah, thanks for spotting this. One I missed after I found this out myself.

Looks good, thanks for doing this work. I'm impressed to see that Debian is now actually passing! Some small suggestion inline but I think this is very close.

@@ -1,7 +1,9 @@
summary: Check different completions
-# ppc64el disabled because of https://github.com/snapcore/snapd/issues/2502
-systems: [-ubuntu-core-16-*, -ubuntu-*-ppc64el]
+systems:
@mvo5

mvo5 Apr 26, 2017

Collaborator

(nitpick) this change looks unrelated. Fine to have it, just point this out. I guess initially debian was disabled here?

@morphis

morphis Apr 26, 2017

Contributor

Yeah, let me revert that.

@morphis

morphis Apr 26, 2017

Contributor

Ok, I remember my intention for this. The comment above only applies for ppc so I moved this to an expanded yaml array to put the comment directly above the ppc line.

@@ -68,6 +68,13 @@ execute: |
echo "And plug is disconnected by default"
snap interfaces | MATCH "$DISCONNECTED_PATTERN"
+ # FIXME This is a pretty bad check for unsupported confinement
@mvo5

mvo5 Apr 26, 2017

Collaborator

I wonder if we should just skip the entire test on debian (avoiding this slightly ugly thing in the middle).

@morphis

morphis Apr 26, 2017

Contributor

I would like to run the first part of this as it exercise the dbus service setup through the configuration in the snap.yaml. snapd still puts the dbus configuration file in place to allow ownership over bus names which will be still validated if we have snap confinement or not.

tests/upgrade/basic/task.yaml
- echo Hello > /var/tmp/myevil.txt
- test-snapd-tools.cat /var/tmp/myevil.txt && exit 1 || true
+
+ if [ -e /sys/kernel/security/apparmor ]; then
@mvo5

mvo5 Apr 26, 2017

Collaborator

Maybe a small comment like: only test if confinement works if we actually have apparmor available ?

Contributor

zyga commented Apr 26, 2017

I think you need to disable one more test:

Expected permission error accessing openvswitch socket with disconnected plug

This is on the openvswitch interface test.

Contributor

morphis commented Apr 26, 2017

This is on the openvswitch interface test.

Looks like that one was added in between.

Just two more things and we can merge this.

tests/main/confinement-classic/task.yaml
- make -C test-snapd-hello-classic clean
- make -C test-snapd-hello-classic
- snap install $INSTALL_FLAGS --dangerous ./test-snapd-hello-classic/test-snapd-hello-classic_0.1_*.snap
+ run_install() {
@zyga

zyga Apr 26, 2017

Contributor

I don't get one thing. The environment section above spawns two instances of this test, each with its own prepare code. Now you roll this into one where we run_install --classic and run_install --jailmode in one prepare step. This effectively means that we no longer test --classic sans --jailmode. Am I missing anything?

@morphis

morphis Apr 27, 2017

Contributor

Good spot!

@morphis

morphis Apr 27, 2017

Contributor

Will see how I can workaround that.

@zyga

zyga Apr 27, 2017

Contributor

This looks correct now.

tests/upgrade/basic/task.yaml
- test-snapd-tools.cat /var/tmp/myevil.txt && exit 1 || true
+
+ # only test if confinement works and we actually have apparmor available
+ if [ -e /sys/kernel/security/apparmor ]; then
@zyga

zyga Apr 26, 2017

Contributor

Can you please add a note that says this should migrate to the internal command that queries forced devmode.

@morphis

morphis Apr 27, 2017

Contributor

Done

Simon Fels added some commits Apr 18, 2017

debian: when we disable apparmor also disable seccomp
Having only seccomp enabled will give us code paths which are not
properly tested and not yet designed to wok well together.
tests: blacklist test cases not applicable for debian systems
Those test case will be reworked in a second phase to properly check
for confinement support and mark themself as not applicable.
tests: disable a few more test cases which don't work on debian (yet)
The completion test case should generally work but there seem to be a
few differences between Ubuntu and debian which need further
investigation before we can enable the test case again.
tests/main/completion: reset env before starting bash
Required as on Debian the whole env leaks into the spawned shell
when starting bash with --norc -i.

zyga approved these changes Apr 27, 2017

mvo5 approved these changes Apr 27, 2017

Nice job!

@mvo5 mvo5 merged commit 64f2a3f into snapcore:master Apr 27, 2017

5 of 6 checks passed

xenial-amd64 autopkgtest finished (failure)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-i386 autopkgtest finished (success)
Details
xenial-ppc64el autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details
zesty-amd64 autopkgtest finished (success)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment