Accepting request 428793 from Virtualization:containers

- fix go_arches definition: use global instead of define, otherwise
  it fails to build 

- Add dockerd(8) man page.

- add missing patch to changelog

- fix integration test case
- add integration-cli-fix-TestInfoEnsureSucceeds.patch

- update rpmlintrc

- make test timeout configurable

- Remove noarch from docker-test, which was causing lots of fun issues when
  trying to run them.

- Fix build for ppc64le: use static libgo for dockerd and docker-proxy
  as in docker build.

- Update docker to 1.12.1 (bsc#996015)
  see changelog in https://github.com/docker/docker/releases/tag/v1.12.1

- Add asaurin@suse.com's test.sh test script.
- Add integration test binary in docker.spec file. This is work done by
  asaurin@suse.com.

- Package docker-proxy (which was split out of the docker binary in 1.12).
  boo#995620

OBS-URL: https://build.opensuse.org/request/show/428793
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/docker?expand=0&rev=42
This commit is contained in:
Dominique Leuenberger 2016-09-21 16:49:51 +00:00 committed by Git OBS Bridge
commit 3a114d5adb
13 changed files with 663 additions and 175 deletions

View File

@ -3,8 +3,8 @@
<param name="url">https://github.com/docker/docker.git</param> <param name="url">https://github.com/docker/docker.git</param>
<param name="scm">git</param> <param name="scm">git</param>
<param name="exclude">.git</param> <param name="exclude">.git</param>
<param name="versionformat">1.11.2</param> <param name="versionformat">1.12.1</param>
<param name="revision">v1.11.2</param> <param name="revision">v1.12.1</param>
</service> </service>
<service name="recompress" mode="disabled"> <service name="recompress" mode="disabled">
<param name="file">docker-*.tar</param> <param name="file">docker-*.tar</param>

View File

@ -1,95 +0,0 @@
From 8f0e47cee034cdc08ca515d98a6733130908fc26 Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <asarai@suse.de>
Date: Mon, 16 May 2016 23:53:46 +1000
Subject: [PATCH] db: fix recovery from unsynced metadata
Bolt stores the two latest transactions' metadata, but previously did
not recover from validation failures in the latest by using the second
latest. Fix this by correctly handling validation failures in db.go, as
well as returning the metadata with highest txid which is also valid in
DB.meta().
Signed-off-by: Aleksa Sarai <asarai@suse.de>
---
vendor/src/github.com/boltdb/bolt/db.go | 49 +++++++++++++++++++++++++--------
1 file changed, 38 insertions(+), 11 deletions(-)
diff --git a/vendor/src/github.com/boltdb/bolt/db.go b/vendor/src/github.com/boltdb/bolt/db.go
index 501d36aac24a..f713485ffab6 100644
--- a/vendor/src/github.com/boltdb/bolt/db.go
+++ b/vendor/src/github.com/boltdb/bolt/db.go
@@ -200,9 +200,15 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
if _, err := db.file.ReadAt(buf[:], 0); err == nil {
m := db.pageInBuffer(buf[:], 0).meta()
if err := m.validate(); err != nil {
- return nil, err
+ // If we can't read the page size, we can assume it's the same
+ // as the OS -- since that's how the page size was chosen in the
+ // first place.
+ // XXX: Does this cause issues with opening a database on a
+ // different OS than the one it was created on?
+ db.pageSize = os.Getpagesize()
+ } else {
+ db.pageSize = int(m.pageSize)
}
- db.pageSize = int(m.pageSize)
}
}
@@ -262,12 +268,13 @@ func (db *DB) mmap(minsz int) error {
db.meta0 = db.page(0).meta()
db.meta1 = db.page(1).meta()
- // Validate the meta pages.
- if err := db.meta0.validate(); err != nil {
- return err
- }
- if err := db.meta1.validate(); err != nil {
- return err
+ // Validate the meta pages. We only return an error if both meta pages fail
+ // validation, since meta0 failing validation means that it wasn't saved
+ // properly -- but we can recover using meta1. And vice-versa.
+ err0 := db.meta0.validate()
+ err1 := db.meta1.validate()
+ if err0 != nil && err1 != nil {
+ return fmt.Errorf("meta0(%v) meta1(%v)", err0, err1)
}
return nil
@@ -778,10 +785,30 @@ func (db *DB) pageInBuffer(b []byte, id pgid) *page {
// meta retrieves the current meta page reference.
func (db *DB) meta() *meta {
- if db.meta0.txid > db.meta1.txid {
- return db.meta0
+ // We have to return the meta with the highest txid which doesn't fail
+ // validation. Otherwise, we can cause errors when in fact the database is
+ // in a consistent state. metaA is the one with the higher txid.
+ metaA := db.meta0
+ metaB := db.meta1
+ if db.meta1.txid > db.meta0.txid {
+ metaA = db.meta1
+ metaB = db.meta0
}
- return db.meta1
+
+ errA := metaA.validate()
+ errB := metaB.validate()
+
+ if errA == nil {
+ return metaA
+ }
+
+ if errB == nil {
+ return metaB
+ }
+
+ // This should never be reached, because both meta1 and meta0 were validated
+ // on mmap() and we do fsync() on every write.
+ panic("both meta0 and meta1 could not be validated in DB.meta()!")
}
// allocate returns a contiguous block of memory starting at a given page.
--
2.8.2

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:279ade8e90c40e4a9b10fe570313aef0672b9ee3858d6ce78295ee448775db34
size 8797368

3
docker-1.12.1.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2be25806e95123b8bea2808b41505375e5e39fdf36a189b6765779fc6f7d1c34
size 10814732

View File

@ -21,10 +21,10 @@ Signed-off-by: Aleksa Sarai <asarai@suse.de>
6 files changed, 314 insertions(+), 2 deletions(-) 6 files changed, 314 insertions(+), 2 deletions(-)
create mode 100644 daemon/suse_secrets.go create mode 100644 daemon/suse_secrets.go
Index: docker-1.11.0/container/container_unix.go diff --git a/container/container_unix.go b/container/container_unix.go
=================================================================== index 8273bdb..d86d783 100644
--- docker-1.11.0.orig/container/container_unix.go --- a/container/container_unix.go
+++ docker-1.11.0/container/container_unix.go +++ b/container/container_unix.go
@@ -34,6 +34,8 @@ type Container struct { @@ -34,6 +34,8 @@ type Container struct {
HostsPath string HostsPath string
ShmPath string ShmPath string
@ -34,7 +34,7 @@ Index: docker-1.11.0/container/container_unix.go
SeccompProfile string SeccompProfile string
NoNewPrivileges bool NoNewPrivileges bool
} }
@@ -243,6 +245,67 @@ func (container *Container) IpcMounts() @@ -243,6 +245,67 @@ func (container *Container) IpcMounts() []Mount {
return mounts return mounts
} }
@ -102,11 +102,11 @@ Index: docker-1.11.0/container/container_unix.go
// UpdateContainer updates configuration of a container. // UpdateContainer updates configuration of a container.
func (container *Container) UpdateContainer(hostConfig *containertypes.HostConfig) error { func (container *Container) UpdateContainer(hostConfig *containertypes.HostConfig) error {
container.Lock() container.Lock()
Index: docker-1.11.0/daemon/container_operations_unix.go diff --git a/daemon/container_operations_unix.go b/daemon/container_operations_unix.go
=================================================================== index c8a0b93..036c65a 100644
--- docker-1.11.0.orig/daemon/container_operations_unix.go --- a/daemon/container_operations_unix.go
+++ docker-1.11.0/daemon/container_operations_unix.go +++ b/daemon/container_operations_unix.go
@@ -182,6 +182,56 @@ func (daemon *Daemon) getIpcContainer(co @@ -168,6 +168,56 @@ func (daemon *Daemon) getIpcContainer(container *container.Container) (*containe
return c, nil return c, nil
} }
@ -163,11 +163,11 @@ Index: docker-1.11.0/daemon/container_operations_unix.go
func (daemon *Daemon) setupIpcDirs(c *container.Container) error { func (daemon *Daemon) setupIpcDirs(c *container.Container) error {
var err error var err error
Index: docker-1.11.0/daemon/daemon_unix.go diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go
=================================================================== index 9e231c5..1138c9a 100644
--- docker-1.11.0.orig/daemon/daemon_unix.go --- a/daemon/daemon_unix.go
+++ docker-1.11.0/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go
@@ -786,8 +786,10 @@ func initBridgeDriver(controller libnetw @@ -795,8 +795,10 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *Config) e
// the container from unwanted side-effects on the rw layer. // the container from unwanted side-effects on the rw layer.
func setupInitLayer(initLayer string, rootUID, rootGID int) error { func setupInitLayer(initLayer string, rootUID, rootGID int) error {
for pth, typ := range map[string]string{ for pth, typ := range map[string]string{
@ -180,35 +180,35 @@ Index: docker-1.11.0/daemon/daemon_unix.go
"/proc": "dir", "/proc": "dir",
"/sys": "dir", "/sys": "dir",
"/.dockerenv": "file", "/.dockerenv": "file",
Index: docker-1.11.0/daemon/oci_linux.go diff --git a/daemon/oci_linux.go b/daemon/oci_linux.go
=================================================================== index e238640..0d8bb47 100644
--- docker-1.11.0.orig/daemon/oci_linux.go --- a/daemon/oci_linux.go
+++ docker-1.11.0/daemon/oci_linux.go +++ b/daemon/oci_linux.go
@@ -634,12 +634,19 @@ func (daemon *Daemon) createSpec(c *cont @@ -655,6 +655,10 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
if err := daemon.setupIpcDirs(c); err != nil {
return nil, err return nil, err
} }
+ // SUSE:secrets :: We need to set up the container-specific secrets tmpfs here. + // SUSE:secrets :: We need to set up the container-specific secrets tmpfs here.
+ if err := daemon.setupSuseSecrets(c); err != nil { + if err := daemon.setupSuseSecrets(c); err != nil {
+ return nil, err + return nil, err
+ } + }
+
mounts, err := daemon.setupMounts(c) ms, err := daemon.setupMounts(c)
if err != nil { if err != nil {
return nil, err @@ -662,6 +666,8 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
} }
mounts = append(mounts, c.IpcMounts()...) ms = append(ms, c.IpcMounts()...)
mounts = append(mounts, c.TmpfsMounts()...) ms = append(ms, c.TmpfsMounts()...)
+ // SUSE:secrets :: We add the mounts to the OCI config which containerd then uses. + // SUSE:secrets :: We add the mounts to the OCI config which containerd then uses.
+ mounts = append(mounts, c.SuseSecretMounts()...) + ms = append(ms, c.SuseSecretMounts()...)
if err := setMounts(daemon, &s, c, mounts); err != nil { sort.Sort(mounts(ms))
if err := setMounts(daemon, &s, c, ms); err != nil {
return nil, fmt.Errorf("linux mounts: %v", err) return nil, fmt.Errorf("linux mounts: %v", err)
} diff --git a/daemon/start.go b/daemon/start.go
Index: docker-1.11.0/daemon/start.go index 4862969..6d3b56e 100644
=================================================================== --- a/daemon/start.go
--- docker-1.11.0.orig/daemon/start.go +++ b/daemon/start.go
+++ docker-1.11.0/daemon/start.go @@ -164,6 +164,12 @@ func (daemon *Daemon) Cleanup(container *container.Container) {
@@ -164,6 +164,12 @@ func (daemon *Daemon) Cleanup(container
container.UnmountIpcMounts(detachMounted) container.UnmountIpcMounts(detachMounted)
@ -221,10 +221,11 @@ Index: docker-1.11.0/daemon/start.go
if err := daemon.conditionalUnmountOnCleanup(container); err != nil { if err := daemon.conditionalUnmountOnCleanup(container); err != nil {
// FIXME: remove once reference counting for graphdrivers has been refactored // FIXME: remove once reference counting for graphdrivers has been refactored
// Ensure that all the mounts are gone // Ensure that all the mounts are gone
Index: docker-1.11.0/daemon/suse_secrets.go diff --git a/daemon/suse_secrets.go b/daemon/suse_secrets.go
=================================================================== new file mode 100644
index 0000000..417a1a9
--- /dev/null --- /dev/null
+++ docker-1.11.0/daemon/suse_secrets.go +++ b/daemon/suse_secrets.go
@@ -0,0 +1,184 @@ @@ -0,0 +1,184 @@
+package daemon +package daemon
+ +
@ -410,3 +411,6 @@ Index: docker-1.11.0/daemon/suse_secrets.go
+ +
+ return secrets, nil + return secrets, nil
+} +}
--
2.8.1

View File

@ -4,5 +4,4 @@ addFilter ("^docker.x86_64: W: statically-linked-binary /usr/lib/docker/dockerin
addFilter ("^docker.x86_64: W: unstripped-binary-or-object /usr/lib/docker/dockerinit") addFilter ("^docker.x86_64: W: unstripped-binary-or-object /usr/lib/docker/dockerinit")
addFilter ("^docker.x86_64: W: no-manual-page-for-binary docker") addFilter ("^docker.x86_64: W: no-manual-page-for-binary docker")
addFilter ("^docker.x86_64: W: no-manual-page-for-binary nsinit") addFilter ("^docker.x86_64: W: no-manual-page-for-binary nsinit")
addFilter ("^docker-test.noarch: W:.*") addFilter ("^docker-test.*")
addFilter ("^docker-test.noarch: E:.*")

View File

@ -1,3 +1,128 @@
-------------------------------------------------------------------
Mon Sep 19 11:56:15 UTC 2016 - jmassaguerpla@suse.com
- fix go_arches definition: use global instead of define, otherwise
it fails to build
-------------------------------------------------------------------
Wed Sep 14 09:41:57 UTC 2016 - asarai@suse.com
- Add dockerd(8) man page.
-------------------------------------------------------------------
Fri Sep 9 12:42:24 UTC 2016 - thipp@suse.de
- add missing patch to changelog
-------------------------------------------------------------------
Wed Sep 7 16:33:59 UTC 2016 - thipp@suse.de
- fix integration test case
- add integration-cli-fix-TestInfoEnsureSucceeds.patch
-------------------------------------------------------------------
Tue Sep 6 13:28:38 UTC 2016 - thipp@suse.de
- update rpmlintrc
-------------------------------------------------------------------
Fri Sep 2 12:02:23 UTC 2016 - thipp@suse.de
- make test timeout configurable
-------------------------------------------------------------------
Fri Sep 2 10:25:27 UTC 2016 - asarai@suse.com
- Remove noarch from docker-test, which was causing lots of fun issues when
trying to run them.
-------------------------------------------------------------------
Tue Aug 30 09:07:19 UTC 2016 - jmassaguerpla@suse.com
- Fix build for ppc64le: use static libgo for dockerd and docker-proxy
as in docker build.
-------------------------------------------------------------------
Mon Aug 29 12:11:21 UTC 2016 - jmassaguerpla@suse.com
- Update docker to 1.12.1 (bsc#996015)
see changelog in https://github.com/docker/docker/releases/tag/v1.12.1
-------------------------------------------------------------------
Fri Aug 26 12:02:35 UTC 2016 - cbrauner@suse.de
- Add asaurin@suse.com's test.sh test script.
- Add integration test binary in docker.spec file. This is work done by
asaurin@suse.com.
-------------------------------------------------------------------
Fri Aug 26 10:43:38 UTC 2016 - asarai@suse.com
- Package docker-proxy (which was split out of the docker binary in 1.12).
boo#995620
-------------------------------------------------------------------
Fri Aug 26 10:00:36 UTC 2016 - jmassaguerpla@suse.com
- fix bsc#995102 - Docker "migrator" prevents installing "docker",
if docker 1.9 was installed before but there were no images
-------------------------------------------------------------------
Fri Aug 26 08:49:15 UTC 2016 - asarai@suse.com
- Update docker.service file with several changes.
* Reapply fix for bsc#983015 (Limit*=infinity).
* Specify an "OCI" runtime for our runc package explicitly. bsc#978260
-------------------------------------------------------------------
Thu Aug 25 14:02:04 UTC 2016 - jmassaguerpla@suse.com
- remove disable-pprof-trace.patch: We can remove this patch because
we use go 1.6, either gcc6-go or gc-go. This patch was for gcc5-go
-------------------------------------------------------------------
Wed Aug 24 12:31:23 UTC 2016 - jmassaguerpla@suse.com
- add go_arches in project configuration: this way, we can use the
same spec file but decide in the project configuration if to
use gc-go or gcc-go for some archs.
-------------------------------------------------------------------
Tue Aug 23 11:35:09 UTC 2016 - jmassaguerpla@suse.com
- use gcc6-go instead of gcc5-go (bsc#988408)
- build ppc64le with gc-go because this version builds with gc-go 1.6
- remove bnc964673-boltdb-metadata-recovery.patch because it has already
been merged
-------------------------------------------------------------------
Tue Aug 23 11:34:09 UTC 2016 - cbrauner@suse.com
- update to v1.12.0 (bsc#995058)
see detailed changelog at
https://github.com/docker/docker/releases/tag/v1.12.0
- disable test that fail in obs build context
- only run unit tests on architectures that provide the go list and go test
tools
- disable dockerd, parser, integration test, and devicemapper related tests
on versions below SLE12 and openSUSE_13.2
- bump test timeout to 10m (for aarch64)
- run unit tests during the build
- Adapt docker.service file.
- adapt install sections for gccgo builds: gccgo build are not built in separate
folders for client and daemon. They both reside in dyngccgo.
- gcc-go-patch: link against systemd when compiling the daemon.
- Add disable-pprof-trace.patch
pprof.Trace() is not available in go version <= 1.4 which we use to build SLES
packages. This patch comments out the pprof.Trace() section.
- update gcc-go-patch and docker-mount-secrets.patch
-------------------------------------------------------------------
Tue Aug 23 11:34:09 UTC 2016 - tboerger@suse.com
- Fixed binary split, install both required binaries correctly
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Aug 16 09:39:11 UTC 2016 - asarai@suse.com Tue Aug 16 09:39:11 UTC 2016 - asarai@suse.com

View File

@ -6,20 +6,35 @@ Requires=docker.socket containerd.socket
[Service] [Service]
EnvironmentFile=/etc/sysconfig/docker EnvironmentFile=/etc/sysconfig/docker
ExecStart=/usr/bin/docker daemon -H fd:// --containerd /run/containerd/containerd.sock $DOCKER_NETWORK_OPTIONS $DOCKER_OPTS
# Quick rundown of options, so we can keep track of them. Upstream's
# service file only contains -H.
#
# * -H tells Docker that it's running as a socket-activated service.
# * --containerd tells Docker to not manage the running of containerd.
# * --add-runtime and --default-runtime tell Docker to not try to use
# its "bundled" runC version (which is not shipped by us) but rather use
# the runC version provided as by the runc package.
ExecStart=/usr/bin/dockerd -H fd:// --containerd /run/containerd/containerd.sock --add-runtime oci=/usr/sbin/runc --default-runtime oci $DOCKER_NETWORK_OPTIONS $DOCKER_OPTS
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead # Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting. # in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity LimitNOFILE=infinity
LimitNPROC=infinity LimitNPROC=infinity
LimitCORE=infinity LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it. # Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this property. # Only systemd 226 and above support this property.
#TasksMax=infinity #TasksMax=infinity
# Set delegate yes so that systemd does not reset the cgroups of docker containers # Set delegate yes so that systemd does not reset the cgroups of docker containers
# Only systemd 218 and above support this property. # Only systemd 218 and above support this property.
#Delegate=yes #Delegate=yes
# KillMode=process is not necessary because of how we set up containerd.
# Tis is not necessary because of how we set up containerd.
#KillMode=process
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -17,13 +17,27 @@
# nodebuginfo # nodebuginfo
# Check if go_arches is defined in the project configuration
# Otherwise, define it here
# In order to define it in the project configuration, see
#
# https://en.opensuse.org/openSUSE:Build%20Service%20prjconf#Macros
#
# The Macros tag is the one that defines the go_arches variable to be used
# in the spec file.
# The "define" one is to help the specfile parser of the buildservice
# to see what packages are being built. You also want to define it here
# for keeping things consistent.
%{!?go_arches: %global go_arches %ix86 x86_64 aarch64 ppc64le}
%global docker_store %{_localstatedir}/lib/docker %global docker_store %{_localstatedir}/lib/docker
%global docker_migration_testfile %{docker_store}/.suse-image-migration-v1to2-complete %global docker_migration_testfile %{docker_store}/.suse-image-migration-v1to2-complete
%global docker_migration_warnfile %{docker_store}/docker-update-message.txt %global docker_migration_warnfile %{docker_store}/docker-update-message.txt
%define docker_graph %{docker_store}/graph %define docker_graph %{docker_store}/graph
%define git_version 9e83765 %define git_version 8eab29e
%define go_arches %ix86 x86_64 aarch64 %define version_unconverted 1.12.1
%define version_unconverted 1.11.2 %define docker_version 1.12.1
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true %define __arch_install_post export NO_BRP_STRIP_DEBUG=true
# When upgrading to a new version requires the service not to be restarted # When upgrading to a new version requires the service not to be restarted
# Due to a long migration process update last_migration_version to the new version # Due to a long migration process update last_migration_version to the new version
@ -31,7 +45,7 @@
# 1.10.1 # 1.10.1
%global last_migration_version 1.10.1 %global last_migration_version 1.10.1
Name: docker Name: docker
Version: 1.11.2 Version: 1.12.1
Release: 0 Release: 0
Summary: The Linux container runtime Summary: The Linux container runtime
License: Apache-2.0 License: Apache-2.0
@ -45,15 +59,13 @@ Source6: docker-rpmlintrc
Source7: README_SUSE.md Source7: README_SUSE.md
Source8: docker-audit.rules Source8: docker-audit.rules
Source9: docker-update-message.txt Source9: docker-update-message.txt
# Required to overcome some limitations of gcc-go: https://groups.google.com/forum/#!msg/golang-nuts/SlGCPYkjxo4/4DjcjXRCqAkJ Source10: tests.sh
Patch101: gcc-go-patches.patch # Fixes for architecture-specific issues (gcc-go).
Patch102: netlink_gcc_go.patch Patch100: gcc-go-patches.patch
Patch103: netlink_netns_powerpc.patch Patch101: netlink_gcc_go.patch
Patch102: netlink_netns_powerpc.patch
Patch200: docker-mount-secrets.patch Patch200: docker-mount-secrets.patch
# This fixes bnc#964673. This fix is in boltdb upstream, but has yet to be Patch300: integration-cli-fix-TestInfoEnsureSucceeds.patch
# merged into Docker (in a vendor commit). This patch was cherry-picked from
# bolt#555.
Patch302: bnc964673-boltdb-metadata-recovery.patch
BuildRequires: audit BuildRequires: audit
BuildRequires: bash-completion BuildRequires: bash-completion
BuildRequires: device-mapper-devel >= 1.2.68 BuildRequires: device-mapper-devel >= 1.2.68
@ -71,8 +83,8 @@ Requires: ca-certificates-mozilla
# execdrivers of Docker. NOTE: The version pinning here matches upstream's # execdrivers of Docker. NOTE: The version pinning here matches upstream's
# Dockerfile to ensure that we don't use a slightly incompatible version of # Dockerfile to ensure that we don't use a slightly incompatible version of
# runC or containerd (which would be bad). # runC or containerd (which would be bad).
Requires: containerd = 0.2.2 Requires: containerd = 0.2.3
Requires: runc = 0.1.1 Requires: runc = 0.1.1+gitcc29e3d
# Provides mkfs.ext4 - used by Docker when devicemapper storage driver is used # Provides mkfs.ext4 - used by Docker when devicemapper storage driver is used
Requires: e2fsprogs Requires: e2fsprogs
Requires: git-core >= 1.7 Requires: git-core >= 1.7
@ -98,7 +110,7 @@ Source5: docker_systemd_lt_214.socket
BuildRequires: go >= 1.5 BuildRequires: go >= 1.5
BuildRequires: go-go-md2man BuildRequires: go-go-md2man
%else %else
BuildRequires: gcc5-go >= 5.0 BuildRequires: gcc6-go >= 6.1
%endif %endif
%if 0%{?is_opensuse} %if 0%{?is_opensuse}
ExcludeArch: s390x ExcludeArch: s390x
@ -146,11 +158,10 @@ Requires: libapparmor-devel
Requires: libbtrfs-devel >= 3.8 Requires: libbtrfs-devel >= 3.8
Requires: procps Requires: procps
Requires: sqlite3-devel Requires: sqlite3-devel
BuildArch: noarch
%ifarch %{go_arches} %ifarch %{go_arches}
Requires: go >= 1.4 Requires: go >= 1.4
%else %else
Requires: gcc5-go >= 5.0 Requires: gcc6-go >= 6.1
%endif %endif
%description test %description test
@ -164,20 +175,20 @@ Test package for docker. It contains the source code and the tests.
%patch200 -p1 %patch200 -p1
%endif %endif
%ifnarch %{go_arches} %ifnarch %{go_arches}
%patch100 -p1
%patch101 -p1 %patch101 -p1
%patch102 -p1 %patch102 -p1
%patch103 -p1
%endif %endif
# bnc#964673 %patch300 -p1
%patch302 -p1
cp %{SOURCE7} . cp %{SOURCE7} .
cp %{SOURCE10} .
%build %build
%ifnarch %{go_arches} %ifnarch %{go_arches}
tmphack=/tmp/dirty-hack tmphack=/tmp/dirty-hack
[ -e $tmphack ] && rm -rf $tmphack [ -e $tmphack ] && rm -rf $tmphack
mkdir $tmphack mkdir $tmphack
ln -s %{_bindir}/go-5 $tmphack/go ln -s %{_bindir}/go-6 $tmphack/go
export PATH=$tmphack:$PATH export PATH=$tmphack:$PATH
%endif %endif
@ -196,26 +207,111 @@ man/md2man-all.sh
./hack/make.sh dyngccgo ./hack/make.sh dyngccgo
%endif %endif
# build the tests binary
GOPATH=$(pwd)/vendor:$(pwd)/.gopath/ go test \
-tags "$DOCKER_BUILDTAGS daemon autogen" \
-c github.com/docker/docker/integration-cli -o tests.main
# remove other than systemd # remove other than systemd
# otherwise the resulting package will have extra requires # otherwise the resulting package will have extra requires
rm -rf hack/make/.build-deb rm -rf hack/make/.build-deb
%ifarch %go_arches
%check
. ./docker_build_env
# go test will look in github.com/docker/docker/vendor for vendored packages but
# Docker keeps them in github.com/docker/docker/vendor/src. Let's do it like
# Docker does it and append github.com/docker/docker/vendor to the GOPATH so the
# packages are found by go test.
export GOPATH=$HOME/go/src/github.com/docker/docker/vendor:$GOPATH
# Create or dir if it doesn't exist already
mkdir -p $HOME/go/src/github.com/docker
# Remove any existing symlinks.
rm -rf $HOME/go/src/github.com/docker/*
# go list -e ... doesn't seem to work with symlinks so do a full copy instead.
cp -avr %{buildroot}/usr/src/%{name} $HOME/go/src/github.com/docker/docker
cd $HOME/go/src/github.com/docker/docker
# Note that these commands do not allow %%elseif.
# For versions equal to or below SLE12 && openSUSE_13.2 libdevmapper.h is not
# recent enough to define dm_task_deferred_remove(). (This is not true of
# SLE12_SP1 but we cannot distinguish it with this macro.)
EXCLUDE_TAGS=
%if 0%{?suse_version} <= 1320
EXCLUDE_TAGS="libdm_no_deferred_remove $EXCLUDE_TAGS"
%endif
# The command is taken from hack/make/test-unit and various test runs.
# Everything that follows github.com/docker/pkg/integration-cli are packages
# containing tests that cannot run in an obs build context.
PKG_LIST=$(go list -e \
-f '{{if ne .Name "github.com/docker/docker"}} {{.ImportPath}}
{{end}}' \
-tags $EXCLUDE_TAGS \
-a "${BUILDFLAGS[@]}" ... \
| grep 'github.com/docker/docker' \
| grep -v 'github.com/docker/docker/vendor' \
| grep -v 'github.com/docker/docker/integration-cli' \
| grep -v 'github.com/docker/docker/pkg/archive$' \
| grep -v 'github.com/docker/docker/pkg/chrootarchive$' \
| grep -v 'github.com/docker/docker/pkg/gitutils$' \
| grep -v 'github.com/docker/docker/pkg/idtools$' \
| grep -v 'github.com/docker/docker/pkg/jsonlog$' \
| grep -v 'github.com/docker/docker/pkg/mount$' \
| grep -v 'github.com/docker/docker/pkg/sysinfo$' \
| grep -v 'github.com/docker/docker/registry$' \
| grep -v 'github.com/docker/docker/volume/local$' \
| grep -v 'github.com/docker/docker/builder$' \
| grep -v 'github.com/docker/docker/daemon$' \
| grep -v 'github.com/docker/docker/daemon/graphdriver/btrfs$' \
| grep -v 'github.com/docker/docker/daemon/graphdriver/devmapper$' \
| grep -v 'github.com/docker/docker/daemon/graphdriver/vfs$' \
| grep -v 'github.com/docker/docker/builder/dockerfile$' \
| grep -v 'github.com/docker/docker/cmd/dockerd$' \
| grep -v 'github.com/docker/docker/builder/dockerfile/parser$' \
| grep -v 'github.com/docker/docker/man$' \
| grep -v 'github.com/docker/docker/pkg/integration$')
go test -cover -ldflags -w -tags $EXCLUDE_TAGS -a -test.timeout=10m $PKG_LIST
%endif
%install %install
install -d %{buildroot}%{go_contribdir} install -d %{buildroot}%{go_contribdir}
install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_bindir}
%ifarch %{go_arches} %ifarch %{go_arches}
install -D -m755 bundles/%{version}/dynbinary/%{name}-%{version} %{buildroot}/%{_bindir}/%{name} install -D -m755 bundles/latest/dynbinary-client/%{name} %{buildroot}/%{_bindir}/%{name}
install -D -m755 bundles/latest/dynbinary-daemon/%{name}d %{buildroot}/%{_bindir}/%{name}d
install -D -m755 bundles/latest/dynbinary-daemon/%{name}-proxy %{buildroot}/%{_bindir}/%{name}-proxy
%else %else
install -D -m755 bundles/%{version}/dyngccgo/%{name}-%{version} %{buildroot}/%{_bindir}/%{name} install -D -m755 bundles/latest/dyngccgo/%{name} %{buildroot}/%{_bindir}/%{name}
install -D -m755 bundles/latest/dyngccgo/%{name}d %{buildroot}/%{_bindir}/%{name}d
install -D -m755 bundles/latest/dyngccgo/%{name}-proxy %{buildroot}/%{_bindir}/%{name}-proxy
%endif %endif
install -d %{buildroot}/%{_prefix}/lib/docker install -d %{buildroot}/%{_prefix}/lib/docker
install -Dd -m 0755 %{buildroot}%{_sbindir} install -Dd -m 0755 \
%{buildroot}%{_sysconfdir}/init.d \
%{buildroot}%{_sbindir}
install -D -m0644 contrib/completion/bash/docker "%{buildroot}%{_sysconfdir}/bash_completion.d/%{name}" install -D -m0644 contrib/completion/bash/docker "%{buildroot}%{_sysconfdir}/bash_completion.d/%{name}"
install -D -m0644 contrib/completion/zsh/_docker "%{buildroot}%{_sysconfdir}/zsh_completion.d/%{name}" install -D -m0644 contrib/completion/zsh/_docker "%{buildroot}%{_sysconfdir}/zsh_completion.d/%{name}"
# copy all for the test package # copy all for the test package
install -d %{buildroot}%{_prefix}/src/docker/ install -d %{buildroot}%{_prefix}/src/docker/
cp -av . %{buildroot}%{_prefix}/src/docker/ cp -av . %{buildroot}%{_prefix}/src/docker/
cp -av contrib %{buildroot}%{_prefix}/src/docker/
cp -av hack %{buildroot}%{_prefix}/src/docker/
cp -av integration-cli %{buildroot}%{_prefix}/src/docker/
cp -av VERSION Dockerfile %{buildroot}%{_prefix}/src/docker/
cp -av tests.main tests.sh %{buildroot}%{_prefix}/src/docker/hack/
# clean some things we don't need in the test package
(cd %{buildroot}%{_prefix}/src/docker/contrib && rm -rf builder completion desktop-integration init mkimage* syntax vagrant-docker)
(cd %{buildroot}%{_prefix}/src/docker/hack && rm -rf Jenkins dind generate-authors.sh install.sh make.sh release.sh vendor.sh .vendor-helpers.sh)
(cd %{buildroot}%{_prefix}/src/docker/integration-cli && rm -rf *.go)
# #
# systemd service # systemd service
@ -242,6 +338,8 @@ install -d %{buildroot}%{_mandir}/man1
install -p -m 644 man/man1/*.1 %{buildroot}%{_mandir}/man1 install -p -m 644 man/man1/*.1 %{buildroot}%{_mandir}/man1
install -d %{buildroot}%{_mandir}/man5 install -d %{buildroot}%{_mandir}/man5
install -p -m 644 man/man5/Dockerfile.5 %{buildroot}%{_mandir}/man5 install -p -m 644 man/man5/Dockerfile.5 %{buildroot}%{_mandir}/man5
install -d %{buildroot}%{_mandir}/man8
install -p -m 644 man/man8/*.8 %{buildroot}%{_mandir}/man8
%endif %endif
install -D -m 0644 %{SOURCE9} %{buildroot}%{docker_migration_warnfile} install -D -m 0644 %{SOURCE9} %{buildroot}%{docker_migration_warnfile}
@ -257,7 +355,7 @@ install -D -m 0644 %{SOURCE9} %{buildroot}%{docker_migration_warnfile}
# will stick around if it has been migrated -- which is why we need the # will stick around if it has been migrated -- which is why we need the
# MIGRATION_TESTFILE check). # MIGRATION_TESTFILE check).
# 4. Check that there are images in the graph/ directory. # 4. Check that there are images in the graph/ directory.
if [[ -d "%{docker_store}" && -n "$(find "%{docker_store}" -maxdepth 1 -type d 2>/dev/null | grep -Ev '_tmp|^%{docker_store}$')" ]]; then if [[ -d "%{docker_store}" && -n "$(find "%{docker_graph}" -maxdepth 1 -type d 2>/dev/null | grep -Ev '_tmp|^%{docker_graph}$')" ]]; then
# Check if currently installed version of docker is old enough to need migration. # Check if currently installed version of docker is old enough to need migration.
CURRENT_DOCKER_VERSION=$(docker -v | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/') CURRENT_DOCKER_VERSION=$(docker -v | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
# This variable will contain the current docker version if migration is needed otherwise it will contain the upgrade point. # This variable will contain the current docker version if migration is needed otherwise it will contain the upgrade point.
@ -297,6 +395,8 @@ fi
%defattr(-,root,root) %defattr(-,root,root)
%doc README.md LICENSE README_SUSE.md %doc README.md LICENSE README_SUSE.md
%{_bindir}/docker %{_bindir}/docker
%{_bindir}/dockerd
%{_bindir}/docker-proxy
%{_sbindir}/rcdocker %{_sbindir}/rcdocker
%{_libexecdir}/docker/ %{_libexecdir}/docker/
%{_unitdir}/%{name}.service %{_unitdir}/%{name}.service
@ -309,6 +409,7 @@ fi
%{_mandir}/man1/docker-*.1%{ext_man} %{_mandir}/man1/docker-*.1%{ext_man}
%{_mandir}/man1/docker.1%{ext_man} %{_mandir}/man1/docker.1%{ext_man}
%{_mandir}/man5/Dockerfile.5%{ext_man} %{_mandir}/man5/Dockerfile.5%{ext_man}
%{_mandir}/man8/dockerd.8%{ext_man}
%endif %endif
%files bash-completion %files bash-completion

View File

@ -1,5 +1,5 @@
diff --git a/hack/make/gccgo b/hack/make/gccgo diff --git a/hack/make/gccgo b/hack/make/gccgo
index 878c814..84b7f69 100644 index 54c983e..1c11bbf 100644
--- a/hack/make/gccgo --- a/hack/make/gccgo
+++ b/hack/make/gccgo +++ b/hack/make/gccgo
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
@ -7,9 +7,9 @@ index 878c814..84b7f69 100644
-set -e -set -e
+set -ex +set -ex
BINARY_NAME="docker-$VERSION" BINARY_NAME="dockerd-$VERSION"
BINARY_EXTENSION="$(binary_extension)" BINARY_EXTENSION="$(binary_extension)"
@@ -16,9 +16,11 @@ go build -compiler=gccgo \ @@ -22,9 +22,11 @@ go build -compiler=gccgo \
"${BUILDFLAGS[@]}" \ "${BUILDFLAGS[@]}" \
-gccgoflags " -gccgoflags "
-g -g
@ -21,4 +21,27 @@ index 878c814..84b7f69 100644
+ -ldl -lselinux -lsystemd + -ldl -lselinux -lsystemd
-pthread -pthread
" \ " \
./docker ./cmd/dockerd
@@ -37,7 +39,9 @@ go build -compiler=gccgo \
"${BUILDFLAGS[@]}" \
-gccgoflags "
-g
+ -Wl,--add-needed -Wl,--no-as-needed
$EXTLDFLAGS_STATIC
+ -static-libgo
-Wl,--no-export-dynamic
-ldl
-pthread
@@ -55,9 +59,11 @@ go build -compiler=gccgo \
"${BUILDFLAGS[@]}" \
-gccgoflags "
-g
+ -Wl,--add-needed -Wl,--no-as-needed
$EXTLDFLAGS_STATIC
+ -static-libgo
-Wl,--no-export-dynamic
- -ldl
+ -ldl -lselinux -lsystemd
-pthread
" \
./cmd/docker

View File

@ -0,0 +1,26 @@
From 0f0c0fcb5b956782385e25c7c6c625e6c79ac78f Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thipp@suse.de>
Date: Wed, 7 Sep 2016 10:54:09 +0200
Subject: [PATCH] integration-cli: fix TestInfoEnsureSucceeds
Signed-off-by: Thomas Hipp <thipp@suse.de>
---
integration-cli/docker_cli_info_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integration-cli/docker_cli_info_test.go b/integration-cli/docker_cli_info_test.go
index a48e69a..c265a36 100644
--- a/integration-cli/docker_cli_info_test.go
+++ b/integration-cli/docker_cli_info_test.go
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
}
if DaemonIsLinux.Condition() {
- stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: runc")
+ stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: oci")
}
if utils.ExperimentalBuild() {
--
2.9.3

View File

@ -6,5 +6,3 @@
## ServiceRestart : docker ## ServiceRestart : docker
# #
DOCKER_OPTS="" DOCKER_OPTS=""
DOCKER_NETWORK_OPTIONS=""

292
tests.sh Normal file
View File

@ -0,0 +1,292 @@
#!/bin/bash
#
# Script for launching the Docker integration tests
#
#set -x
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCKER_DIR=/usr/src/docker
SCRIPTS_DIR=$DOCKER_DIR/hack
TESTS_EXE=$SCRIPTS_DIR/tests.main
VERSION=$(cat $DOCKER_DIR/VERSION)
# working dirs
TESTS_DIR=/tmp/docker-int-tests
BUNDLES_DIR=$TESTS_DIR/run/bundles
FAKE_GOPATH=$TESTS_DIR/go
# some test expect the containerd socket here
CONTAINERD_SOCK=/run/containerd/containerd.sock
EXPECTED_CONTAINERD_SOCK=/var/run/docker/libcontainerd/docker-containerd.sock
# ... and some programs
CONTAINERD_CTR=/usr/sbin/containerd-ctr
EXPECTED_CONTAINERD_CTR=/usr/local/bin/docker-containerd-ctr
CHECK_TIMEOUT="${CHECK_TIMEOUT:-5m}"
TEST_TIMEOUT="${TEST_TIMEOUT:-60m}"
TEST_ARGS="-check.vv -check.timeout=${CHECK_TIMEOUT} -test.timeout=${TEST_TIMEOUT}"
TEST_SELECT=
TEST_LOG=/tmp/docker-tests.log
ENABLE_XUNIT=${ENABLE_XUNIT:-yes}
# the sysconfig file for Docker
SYSCFG_DOCKER=/etc/sysconfig/docker
# some vars from the Dockerfile
ENABLE_NOTARY=${ENABLE_NOTARY:-}
ENABLE_REGISTRY=${ENABLE_REGISTRY:-}
REGISTRY_COMMIT_SCHEMA1=ec87e9b6971d831f0eff752ddb54fb64693e51cd
REGISTRY_COMMIT=47a064d4195a9b56133891bbb13620c3ac83a827
NOTARY_VERSION=v0.3.0
################################################################################
log() { echo ">>> $@" ; }
warn() { log "WARNING: $@" ; }
error() { log "ERROR: $@" ; }
abort() { log "FATAL: $@" ; exit 1 ; }
usage() { echo "$USAGE" ; }
abort_usage() { usage ; abort $@ ; }
bundle() {
local bundle="$1"; shift
log "Making bundle: $(basename "$bundle") (in $DEST)"
source "$SCRIPTS_DIR/make/$bundle" "$@"
}
set_opts() {
OPT="$1"
VALUE="$2"
FILE=$3
perl -pi -e "s/^$OPT=.*$//g" $FILE
echo "$OPT=\"$VALUE\"" >> $FILE
}
set_docker_opts() { set_opts "DOCKER_OPTS" "$DOCKER_OPTS" /etc/sysconfig/docker ; }
set_containerd_opts() { set_opts "CONTAINERD_OPTS" "$CONTAINERD_OPTS" /etc/sysconfig/containerd ; }
fix_expected() {
EXPECTED=$1
EXISTING=$2
exp_base=$(basename $EXPECTED)
exp_dir=$(dirname $EXPECTED)
[ -d $exp_dir ] || mkdir -p $exp_dir
rm -f $exp_dir/$exp_base
(cd $exp_dir && ln -sf $EXISTING $exp_base)
}
save_backup() {
for x in $@ ; do
if [ ! -f $x ] ; then
touch $x.nbak
elif [ -f $x.bak ] ; then
warn "$x.bak already exists: no backup will be done"
else
cp -f $x $x.bak
fi
done
}
restore_backup() {
for x in $@ ; do
if [ -f $x.nbak ] ; then
rm -f $x.nbak
else
if [ -f $x.bak ] ; then
mv -f $x.bak $x
fi
fi
done
}
require_go() { go version >/dev/null 2>&1 ; }
require_git() { git version >/dev/null 2>&1 ; }
################################################################################
[ -x $TESTS_EXE ] || abort "integration tests executable not found at $TESTS_EXE"
[ $EUID -eq 0 ] || abort "this script must be run as root"
[ -n "$VERSION" ] || abort "could not obtain version"
[ -e $CONTAINERD_SOCK ] || abort "containerd socket not found at $CONTAINERD_SOCK"
[ -x $CONTAINERD_CTR ] || abort "containerd-ctr not found at $CONTAINERD_CTR"
if [ $# -gt 0 ] ; then
# run only some specific tests
TEST_SELECT="-check.f=$(echo $@ | tr ' ' '|')"
fi
# We want this to fail if the bundles already exist and cannot be removed.
# This is to avoid mixing bundles from different versions of the code.
mkdir -p $BUNDLES_DIR
if [ -e "$BUNDLES_DIR/$VERSION" ] && [ -z "$KEEPBUNDLE" ]; then
log "$BUNDLES_DIR/$VERSION already exists. Removing."
rm -fr "$BUNDLES_DIR/$VERSION" && mkdir "$BUNDLES_DIR/$VERSION" || exit 1
echo
fi
DEST="$BUNDLES_DIR/$VERSION/"
mkdir -p "$DEST"
export DEST=$(realpath $DEST)
# create a fake go path
rm -rf $FAKE_GOPATH
mkdir -p $FAKE_GOPATH/src/github.com/docker
(cd $FAKE_GOPATH/src/github.com/docker && ln -sf $DOCKER_DIR docker)
if [ -n "$ENABLE_REGISTRY" ] ; then
# build the Docker registry
if [ ! -x /usr/local/bin/registry-v2 ] ; then
log "Building registry (commit:$REGISTRY_COMMIT)"
require_git || abort "git is not installed"
require_go || abort "the Go compiler is not installed"
export GOPATH="$(mktemp -d)"
git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution"
(cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT")
GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry
(cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1")
GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry
chmod 755 /usr/local/bin/registry-v2
[ -x /usr/local/bin/registry-v2 ] || abort "registry-v2 could not be built"
rm -rf "$GOPATH"
export -n GOPATH
fi
fi
if [ -n "$ENABLE_NOTARY" ] ; then
# build the Docker notary
if [ ! -x /usr/local/bin/notary-server ] ; then
export GO15VENDOREXPERIMENT=1
export GOPATH="$(mktemp -d)"
require_git || abort "git is not installed"
require_go || abort "the Go compiler is not installed"
log "Building notary (version:$NOTARY_VERSION)"
git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary"
(cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION")
GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server
GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary
chmod 755 /usr/local/bin/notary-server
[ -x /usr/local/bin/notary-server ] || abort "notary could not be built"
export -n GO15VENDOREXPERIMENT
rm -rf "$GOPATH"
export -n GOPATH
fi
fi
if [ -n "$ENABLE_XUNIT" ] ; then
if [ ! -x /usr/local/bin/go2xunit ] ; then
echo >&2 "Installing go2xunit."
require_go || abort "the Go compiler is not installed"
export GOPATH="$(mktemp -d)"
go get -d github.com/tebeka/go2xunit
cd $GOPATH/src/github.com/tebeka/go2xunit && go build -o /usr/local/bin/go2xunit .
chmod 755 /usr/local/bin/go2xunit
[ -x /usr/local/bin/go2xunit ] || abort "go2xunit could not be built"
rm -rf "$GOPATH"
export -n GOPATH
fi
fi
# tests require this user and group
/usr/sbin/groupadd -r docker >/dev/null 2>&1 || /bin/true
/usr/sbin/useradd --create-home --gid docker unprivilegeduser >/dev/null 2>&1 || /bin/true
# prepare some expected dirs, files, etc...
fix_expected $TESTS_DIR/contrib $DOCKER_DIR/contrib
fix_expected $DEST/fixtures $DOCKER_DIR/integration-cli/fixtures
fix_expected $EXPECTED_CONTAINERD_SOCK $CONTAINERD_SOCK
fix_expected $EXPECTED_CONTAINERD_CTR $CONTAINERD_CTR
export DOCKER_TEST_HOST="tcp://127.0.0.1:2375"
export PATH=/usr/local/bin:$PATH
export TZ=utc
export GOPATH="$FAKE_GOPATH"
export DOCKER_GRAPHDRIVER="${DOCKER_GRAPHDRIVER:-vfs}"
export DOCKER_USERLANDPROXY="${DOCKER_USERLANDPROXY:-true}"
#export DOCKER_REMAP_ROOT=default
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
storage_params=""
if [ -n "$DOCKER_STORAGE_OPTS" ]; then
IFS=','
for i in ${DOCKER_STORAGE_OPTS}; do
storage_params="--storage-opt $i $storage_params"
done
unset IFS
fi
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
extra_params=""
# deal with remapping
save_backup /etc/subuid /etc/subgid
echo "dockremap:500000:65536" > /etc/subuid
echo "dockremap:500000:65536" > /etc/subgid
groupadd dockremap >/dev/null 2>&1 || /bin/true
useradd -g dockremap dockremap >/dev/null 2>&1 || /bin/true
# make sure Docker is stopped, set our config file and then start again
save_backup $SYSCFG_DOCKER
cat <<SYSCFG_DOCKER_EOF > $SYSCFG_DOCKER
DOCKER_OPTS="--log-level=debug \
--pidfile=$DEST/docker.pid \
-H tcp://127.0.0.1:2375 \
--storage-driver=$DOCKER_GRAPHDRIVER \
--userland-proxy=$DOCKER_USERLANDPROXY"
DOCKER_NETWORK_OPTIONS=""
SYSCFG_DOCKER_EOF
systemctl reload-or-restart docker.service
cleanup() {
log "Restoring the Docker service..."
restore_backup $SYSCFG_DOCKER
systemctl reload-or-restart docker.service
log "Removing extra files and restoring backups..."
restore_backup /etc/subuid /etc/subgid
rm -f $TESTS_DIR/contrib \
$DEST/fixtures \
$EXPECTED_CONTAINERD_SOCK \
$EXPECTED_CONTAINERD_CTR
}
trap cleanup EXIT
cd $DOCKER_DIR
log "Preparing the environment..."
bundle .integration-daemon-start
bundle .integration-daemon-setup
log "Running integration tests..."
export DOCKER_HOST=$DOCKER_TEST_HOST
cd $DEST && $TESTS_EXE $TEST_ARGS $TEST_SELECT | tee $TEST_LOG || /bin/true
if [ -n "$ENABLE_XUNIT" ] ; then
log "Generating xunit logs..."
go2xunit -fail -gocheck -input $TEST_LOG -output $TEST_LOG.xml
fi
export -n DOCKER_HOST
bundle .integration-daemon-stop