Commit graph

37295 commits

Author SHA1 Message Date
Sebastiaan van Stijn
efacee1cdd
Jenkinsfile: move building e2e image to "unit-vendor" stage
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:56 +02:00
Sebastiaan van Stijn
781e79d1fa
Jenkinsfile: extract DOCKER_GRAPHDRIVER as environment variable
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:53 +02:00
Sebastiaan van Stijn
c75d7e0e22
Jenkinsfile: use overlay2 for Power and s390x as well
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:50 +02:00
Sebastiaan van Stijn
a2ad56dfad
Jenkinsfile: run check-config.sh to print system configuration
Having this information can help debugging issues in CI (which could
be caused by missing/incorrect configuration of the machines).

We ping to a fixed version of the script, because this script is ran
directly on the host, and we don't want pull-requests modifying this
script to have direct access to the machines.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:48 +02:00
Sebastiaan van Stijn
6523ced950
Jenkinsfile: remove ip_vs modprobe for unit/vendor stage
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:45 +02:00
Sebastiaan van Stijn
f2e09afff4
Jenkinsfile: standardize cointainer names and fix s390x cleanup
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:43 +02:00
Sebastiaan van Stijn
f51c139792
Jenkinsfile: combine "vendor" and "unit tests"
Both of these tests are fairly short, and shouldn't interfer with
eachother, so we can combine them and re-use the same dev-image
(so that it'll only be built once).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:39 +02:00
Sebastiaan van Stijn
be0e6e9d34
Jenkinsfile: use GIT_COMMIT from Git plugin instead of manually
This patch removes the manual steps to resolve the Git commit, and
instead, uses the `GIT_COMMIT` that's set by Jenkins's Git plugin.

Behavior changes slightly, because `GIT_PLUGIN` contains the full
commit-sha, not the short one.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-03 20:49:25 +02:00
Akihiro Suda
d1f4709466
Merge pull request #39645 from lzhfromustc/39503
container: avoid a data race in container/health.go
2019-08-04 01:33:23 +09:00
Akihiro Suda
a6aa11a3ef
Merge pull request #39655 from thaJeztah/fix_indentation
hack: fix mixed tabs/spaces for indentation
2019-08-03 14:50:32 +09:00
Tibor Vass
fbc3c06c76
Merge pull request #39656 from thaJeztah/jenkinsfile_cleanup
Jenkinsfile cleanup and improvements
2019-08-02 17:21:58 -07:00
Brian Goff
13064b155e Add support for setting a test filter
This is basically taking some stuff that make a custom shell function
for.
This takes a test filter, builds the appropriate TESTFLAGS, and sets the
integration API test dirs that match the given filter to avoid building
all test dirs.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-08-02 15:56:55 -07:00
Sebastiaan van Stijn
355bcf6d48
Jenkinsfile: disable buildkit on power and s390x
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:31:38 +02:00
Sebastiaan van Stijn
3897796548
Jenkinsfile: Add "info" step to all stages
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:20:22 +02:00
Sebastiaan van Stijn
b04c769d65
Jenkinsfile: split some shell steps
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:58 +02:00
Sebastiaan van Stijn
9f0e10fe24
Jenkinsfile: busybox is multi-arch
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:53 +02:00
Sebastiaan van Stijn
337d03a5f0
Jenkinsfile: remove arch-specific suffixes from names
Container and image names are already unique because they have
the git-sha or build-number, and a single machine won't be running
tests for multiple architectures.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:50 +02:00
Sebastiaan van Stijn
a0bf935f9c
Jenkinsfile: run "make clean" in cleanup step
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:47 +02:00
Sebastiaan van Stijn
79713d8d07
Jenkinsfile: use sub-stages to describe steps
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:44 +02:00
Sebastiaan van Stijn
f648964875
Jenkinsfile: set DOCKER_BUILDKIT globally
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:42 +02:00
Sebastiaan van Stijn
a28f2a2338
Jenkinsfile: set APT_MIRROR globally
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:39 +02:00
Sebastiaan van Stijn
61fd8b7384
Jenkinsfile: remove check for arch-specific Dockerfiles
The main Dockerfile is multi-arch now.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:37 +02:00
Sebastiaan van Stijn
722d582c92
Jenkinsfile: remove build --rm, because it's the default
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:35 +02:00
Sebastiaan van Stijn
a95f16ca28
Jenkinsfile: consistently indent with 4 spaces
From the code style guidelines;
https://wiki.jenkins.io/display/JENKINS/Code+Style+Guidelines

> 1. Use spaces. Tabs are banned.
> 2. Java blocks are 4 spaces. JavaScript blocks as for Java. XML nesting is 2 spaces

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 20:11:31 +02:00
Kir Kolyshkin
20a0e58a79 journald/read: fix/unify errors
1. Use "in-place" variables for if statements to limit their scope to
   the respectful `if` block.

2. Report the error returned from sd_journal_* by using CErr().

3. Use errors.New() instead of fmt.Errorf().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:35 -07:00
Kir Kolyshkin
dd4bfe30a8 journald: fix for --tail 0
From the first glance, `docker logs --tail 0` does not make sense,
as it is supposed to produce no output, but `tail -n 0` from GNU
coreutils is working like that, plus there is even a test case
(`TestLogsTail` in integration-cli/docker_cli_logs_test.go).

Now, something like `docker logs --follow --tail 0` makes total
sense, so let's make it work.

(NOTE if --tail is not used, config.Tail is set to -1)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:35 -07:00
Kir Kolyshkin
b73fb8fd5d journald/read: avoid piling up open files
If we take a long time to process log messages, and during that time
journal file rotation occurs, the journald client library will keep
those rotated files open until sd_journal_process() is called.

By periodically calling sd_journal_process() during the processing
loop we shrink the window of time a client instance has open file
descriptors for rotated (deleted) journal files.

This code is modelled after that of journalctl [1]; the above explanation
as well as the value of 1024 is taken from there.

[v2: fix CErr() argument]

[1] https://github.com/systemd/systemd/blob/dc16327c48d/src/journal/journalctl.c#L2676
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:35 -07:00
Kir Kolyshkin
f091febc94 journald/read: simplify/fix followJournal()
TL;DR: simplify the code, fix --follow hanging indefinitely

Do the following to simplify the followJournal() code:

1. Use Go-native select instead of C-native polling.

2. Use Watch{Producer,Consumer}Gone(), eliminating the need
to have journald.closed variable, and an extra goroutine.

3. Use sd_journal_wait(). In the words of its own man page:

> A synchronous alternative for using sd_journal_get_fd(),
> sd_journal_get_events(), sd_journal_get_timeout() and
> sd_journal_process() is sd_journal_wait().

Unfortunately, the logic is still not as simple as it
could be; the reason being, once the container has exited,
journald might still be writing some logs from its internal
buffers onto journal file(s), and there is no way to
figure out whether it's done so we are guaranteed to
read all of it back. This bug can be reproduced with
something like

> $ ID=$(docker run -d busybox seq 1 150000); docker logs --follow $ID
> ...
> 128123
> $

(The last expected output line should be `150000`).

To avoid exiting from followJournal() early, add the
following logic: once the container is gone, keep trying
to drain the journal until there's no new data for at
least `waitTimeout` time period.

Should fix https://github.com/docker/for-linux/issues/575

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:35 -07:00
Kir Kolyshkin
981c01665b Call sd_journal_get_fd() earlier, only if needed
1. The journald client library initializes inotify watch(es)
during the first call to sd_journal_get_fd(), and it make sense
to open it earlier in order to not lose any journal file rotation
events.

2. It only makes sense to call this if we're going to use it
later on -- so add a check for config.Follow.

3. Remove the redundant call to sd_journal_get_fd().

NOTE that any subsequent calls to sd_journal_get_fd() return
the same file descriptor, so there's no real need to save it
for later use in wait_for_data_cancelable().

Based on earlier patch by Nalin Dahyabhai <nalin@redhat.com>.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:34 -07:00
Kir Kolyshkin
79039720c8 journald/read: avoid being blocked on send
In case the LogConsumer is gone, the code that sends the message can
stuck forever. Wrap the code in select case, as all other loggers do.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:34 -07:00
Kir Kolyshkin
ff3cd167ea journald/read: simplify walking backwards
In case Tail=N parameter is requested, we need to show N lines.
It does not make sense to walk backwards one by one if we can
do it at once. Now, if Since=T is also provided, make sure we
haven't jumped too far (before T), and if we did, move forward.

The primary motivation for this was to make the code simpler.

This also fixes a tiny bug in the "since" implementation.

Before this commit:
> $ docker logs -t --tail=6000 --since="2019-03-10T03:54:25.00" $ID | head
> 2019-03-10T03:54:24.999821000Z 95981

After:
> $ docker logs -t --tail=6000 --since="2019-03-10T03:54:25.00" $ID | head
> 2019-03-10T03:54:25.000013000Z 95982

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:34 -07:00
Kir Kolyshkin
e8f6166791 journald/read: simplify code
Minor code simplification.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-02 10:02:34 -07:00
Nalin Dahyabhai
1ada3e85bf Small journal cleanup
Clean up a deferred function call in the journal reading logic.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-08-02 10:02:34 -07:00
Sebastiaan van Stijn
2cffe9be3d
hack: fix mixed tabs/spaces for indentation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 15:58:33 +02:00
Sebastiaan van Stijn
060f387c0b
Fix "no such file or directory" warning when unmounting IPC mount
When cleaning up IPC mounts, the daemon could log a warning if the IPC mount was not found;

```
cleanup: failed to unmount IPC: umount /var/lib/docker/containers/90f408e26e205d30676655a08504dddc0d17f5713c1dd4654cf67ded7d3bbb63/mounts/shm, flags: 0x2: no such file or directory"
```

These warnings are safe to ignore, but can cause some confusion;  `container.UnmountIpcMount()`
already attempted to suppress these warnings, however, `mount.Unmount()` returns a `mountError`,
which nests the original error, therefore detecting failed.

This parch uses `errors.Cause()` to get the _underlying_ error to detect if it's a "is not exist".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-02 12:36:54 +02:00
Vincent Demeester
4e83c90ae8
Merge pull request #39638 from tiborvass/unit-junit
added entry for running unit tests with junit report
2019-08-01 23:03:16 -04:00
Brian Goff
4fb5e9e696
Merge pull request #39628 from cpuguy83/test_setup_improvements
Improvements to the test runners
2019-08-01 15:45:16 -07:00
Brian Goff
41040b7998
Merge pull request #39644 from kolyshkin/quota-map
projectquota: protect concurrent map access
2019-08-01 13:02:09 -07:00
Kir Kolyshkin
1ac0a66a64 projectquota: protect concurrent map access
Protect access to q.quotas map, and lock around changing nextProjectID.

Techinically, the lock in findNextProjectID() is not needed as it is
only called during initialization, but one can never be too careful.

Fixes: 52897d1c09 ("projectquota: utility class for project quota controls")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-08-01 09:58:34 -07:00
Dominic
5f0231bca1
cast Dev and Rdev of Stat_t to uint64 for mips
Signed-off-by: Dominic <yindongchao@inspur.com>
Signed-off-by: Dominic Yin <yindongchao@inspur.com>
2019-08-01 20:22:49 +08:00
Andrew Hsu
42f0a0db75 run unit tests and generate junit report
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2019-08-01 06:08:35 +00:00
Brian Goff
abece9b562 Improvements to the test runners
1. Use `go list` to get list of integration dirs to build. This means we
   do not need to have a valid `.go` in every subdirectory and also
   filters out other dirs like "bundles" which may have been created.
2. Add option to specify custom flags for integration and
   integration-cli. This is needed so both suites can be run AND set
   custom flags... since the cli suite does not support standard go
   flags.
3. Add options to skip an entire integration suite.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-07-31 16:37:17 -07:00
Ziheng Liu
53e0c50126
Avoid a data race in container/health.go
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
2019-07-31 13:17:32 -07:00
Sebastiaan van Stijn
928381b221
Merge pull request #39633 from thaJeztah/bump_libnetwork
bump libnetwork to 09cdcc8c0eab3946c2d70e8f6225b05baf1e90d1
2019-07-31 08:03:26 -07:00
Kirill Kolyshkin
589f1dad8d
Merge pull request #39636 from thaJeztah/add_back_yamllint
Dockerfile: add back yamllint
2019-07-30 17:17:54 -07:00
Sebastiaan van Stijn
b1723b3721
Dockerfile: add back yamllint
This was inadvertedly removed in 7bfe48cc00,
because it was documented as a dependency for docker-py, but
actually used to validate the swagger file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-30 17:04:26 -07:00
Zuhayr Elahi
438c7eb606
Added information regarding our new Jenkins ci on moby/moby
Added link to header

Signed-off-by: Zuhayr Elahi <elahi.zuhayr@gmail.com>
2019-07-30 13:48:00 -07:00
Sebastiaan van Stijn
6f234db9fe
bump libnetwork to 09cdcc8c0eab3946c2d70e8f6225b05baf1e90d1
full diff: 83d30db536...09cdcc8c0e

changes included:

- docker/libnetwork#2416 Fix hardcoded AF_INET for IPv6 address handling
- docker/libnetwork#2411 Macvlan network handles netlabel.Internal wrong
  - fixes docker/libnetwork#2410 Macvlan network handles netlabel.Internal wrong
- docker/libnetwork#2414 Allow network with --config-from to be --internal
  - fixes docker/libnetwork#2413 Network with --config-from does not honor --internal
- docker/libnetwork#2351 Use fewer modprobes
  - relates to moby/moby#38930 Use fewer modprobes
- docker/libnetwork#2415 Support dockerd and system restarts for ipvlan and macvlan networks
  - carry of docker/libnetwork#2295 phantom ip/mac vlan network after a powercycle
  - fixes docker/libnetwork#1743 Phantom docker network

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-30 10:37:48 -07:00
Brian Goff
7cfd8146dc
Merge pull request #39629 from thaJeztah/switch_creack_pty
switch kr/pty to creack/pty v1.1.7
2019-07-30 09:41:51 -07:00
Sebastiaan van Stijn
0595c01718
switch kr/pty to creack/pty v1.1.7
kr/pty was moved to creak/pty and the old location was
archived.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-29 16:59:08 -07:00