Commit graph

65 commits

Author SHA1 Message Date
John Howard
65cbc7cb25 Windows: Docker build starting to work
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-06-17 10:41:28 -07:00
unclejack
bfdf63d37c linting changes
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-06-17 01:16:57 +03:00
Michael Crosby
faab76452b Merge pull request #13344 from hqhq/hq_fix_arm64_test
Fix unit-test build error on ARM64
2015-06-12 17:11:18 -07:00
Arnaud Porterie
a551a25faa Merge pull request #12833 from burke/faster-changes
Optimize archive.ChangesDirs on Linux
2015-06-12 17:05:34 -07:00
Shijiang Wei
e10c7b3f07 Add the parent directory to changes set if new files are generated
The "TestChangesWithChanges" case randomlly fails on my development
VM with the following errors:
```
--- FAIL: TestChangesWithChanges (0.00s)
        changes_test.go:201: no change for expected change C /dir1/subfolder != A /dir1/subfolder/newFile
```

If I apply the following patch to changes_test.go, the test passes.

```diff
diff --git a/pkg/archive/changes_test.go b/pkg/archive/changes_test.go
index 290b2dd..ba1aca0 100644
--- a/pkg/archive/changes_test.go
+++ b/pkg/archive/changes_test.go
@@ -156,6 +156,7 @@ func TestChangesWithChanges(t *testing.T) {
        }
        defer os.RemoveAll(layer)
        createSampleDir(t, layer)
+       time.Sleep(5 * time.Millisecond)
        os.MkdirAll(path.Join(layer, "dir1/subfolder"), 0740)

        // Let's modify modtime for dir1 to be sure it's the same for the two layer (to not having false positive)
```

It seems that if a file is created immediately after the directory is created,
the `archive.Changes` function could't recognize that the parent directory of
the new file is modified.

Perhaps the problem may reproduce on machines with low time precision?
I had successfully reproduced the failure on my development VM as well as
a VM on DigitalOcean.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-06-10 20:29:29 +08:00
John Howard
f883e81d79 Windows: Archive package changes for Windows daemon
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-20 08:55:54 -07:00
Qiang Huang
1aca4cb80e Fix unit-test build error on ARM64
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-20 10:45:04 +08:00
Jessie Frazelle
c754d1e989 Merge pull request #13059 from burke/no-fsync-on-temp-archive
Remove fsync in archive.NewTempArchive
2015-05-07 16:16:52 -07:00
Burke Libbey
a080d36f70 Remove Sync() call in NewTempArchive:
This makes the "Buffering to disk" part of `docker push` 70% faster in
my use-case (having already applied #12833).

fsync'ing here serves no valuable purpose: if the drive's operation is
interrupted, so it the program's, and this archive has no value other
than the immediate and transient one.

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
2015-05-07 12:58:12 -04:00
Burke Libbey
5ba8c22385 ino and dev must both match for a file to be identical.
This case is triggered frequently on ZFS.

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
2015-05-05 11:06:54 -04:00
Tianon Gravi
d05398f1e9 Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum!
IT'S ABOUT TIME. 🎉

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2015-05-01 16:01:10 -06:00
buddhamagnet
c09e1131bc add support for exclusion rules in dockerignore
Signed-off-by: Dave Goodchild <buddhamagnet@gmail.com>
2015-04-28 18:56:45 +01:00
Burke Libbey
a423e54ba4 archive: Optimize ChangesDirs on Linux
If we tear through a few layers of abstraction, we can get at the inodes
contained in a directory without having to stat all the files. This
allows us to eliminate identical files much earlier in the changelist
generation process.

Signed-off-by: Burke Libbey <burke@libbey.me>
2015-04-27 21:26:13 -04:00
David Mackey
b590208498 trivial: typo cleanup
Signed-off-by: David Mackey <tdmackey@booleanhaiku.com>
2015-04-27 13:35:08 -07:00
Vincent Demeester
bf4bc7f97f Add coverage on pkg/archive
Add tests on:
- changes.go
- archive.go
- wrap.go

Should fix #11603 as the coverage is now 81.2% on the ``pkg/archive``
package. There is still room for improvement though :).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-04-24 17:03:33 +02:00
Alexander Morozov
2f1072efe0 Fix vet warning
pkg/archive/archive_test.go:496: arg changes for printf verb %s of wrong type: []archive.Change

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-13 11:43:30 -07:00
Vincent Demeester
2fd964cc1d Add test on archive.go (#11603)
- Trying to add or complete unit test to each ``func``
- Removing dead code (``escapeName``)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-04-11 23:21:37 +02:00
7bde17186d Merge pull request #11099 from iavael/bugfix/tar-symlinks
Fixed handling hardlinks to symlinks in tar stream
2015-04-01 18:34:00 -04:00
Antonio Murdaca
18180bfabf Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-26 23:22:04 +01:00
Jimmy Puckett
4e4940d411 Changing bitflag checking style to preferred style. Fixes #11668
Signed-off-by: Jimmy Puckett <jimmy.puckett@spinen.com>
2015-03-24 21:09:25 -04:00
Jessie Frazelle
32cd20cfc3 Merge pull request #11422 from vbatts/vbatts-overlay_dir_mtime_changes
pkg/archive: ignore mtime changes on directories
2015-03-23 15:24:05 -07:00
Mitch Capper
1a26dcf2cb Change windows default permissions to 755 not 711, read access for all poses little security risk and prevents breaking existing Dockerfiles
Signed-off-by: Mitch Capper <mitch.capper@gmail.com>
2015-03-20 21:54:33 -07:00
Vincent Batts
233218e437 pkg/archive: ignore mtime changes on directories
on overlay fs, the mtime of directories changes in a container where new
files are added in an upper layer (e.g. '/etc'). This flags the
directory as a change where there was none.

Closes #9874

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2015-03-17 10:53:34 -04:00
Rik Nijessen
a5e54d5788 Make utils_daemon and volumes cross-platform compileable.
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
2015-03-16 11:46:07 +01:00
Arnaud Porterie
29e7195aaf Remove subdirectories MAINTAINERS files
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-06 18:21:51 -08:00
Tibor Vass
0a46fb04bc Merge pull request #11148 from ahmetalpbalkan/win-cli/chmod-x-fix
pkg/archive: adjust chmod bits on windows
2015-03-06 12:28:58 -05:00
Ahmet Alp Balkan
be592674ac pkg/archive_windows: make use of os.PathSeparator
cc: @jhowardmsft

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-05 17:15:11 -08:00
Ahmet Alp Balkan
276ed4fec4 pkg/archive: adjust chmod bits on windows
This change modifies the chmod bits of build context archives built on
windows to preserve the execute bit and remove the r/w bits from
grp/others.

Also adjusted integ-cli tests to verify permissions based on the platform
the tests are running.

Fixes #11047.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-04 14:10:37 -08:00
Ahmet Alp Balkan
d33c7828b7 pkg/archive: rm invalid test case from achive_windows_test.go
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-03 18:42:52 -08:00
Iavael
b3060011bb Fixed handling hardlinks to symlinks in tar stream
Signed-off-by: Iavael <iavaelooeyt@gmail.com>
2015-03-03 16:10:53 +03:00
Ahmet Alp Balkan
140f461f50 Support windows style dockerfile paths for build cmd
Currently TestBuildRenamedDockerfile fails since passing
custom dockerfile paths like:

    docker build -f dir/file .

fails on windows because those are unix paths. Instead, on
windows accept windows style paths like:

    docker build -f dir\file .

and convert them to unix style paths using the helper we
have in `pkg/archive` so that daemon can correctly locate
the path in the context.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-24 20:23:53 -08:00
Michael Crosby
c44eed6358 Merge pull request #10865 from ahmetalpbalkan/win-cli/tar-path
pkg/archive: Canonicalize stored paths
2015-02-20 17:20:51 -08:00
Ahmet Alp Balkan
588f95dca0 pkg/archive: Canonicalize stored paths
Currently pkg/archive stores nested windows files with
backslashes (e.g. `dir\`, `dir\file.txt`) and this causes
tar not being correctly extracted on Linux daemon.

This change assures we canonicalize all paths to unix
paths and add them to tar with that name independent of platform.

Fixes the following test cases for Windows CI:
- TestBuildAddFileWithWhitespace
- TestBuildCopyFileWithWhitespace
- TestBuildAddDirContentToRoot
- TestBuildAddDirContentToExistingDir
- TestBuildCopyDirContentToRoot
- TestBuildCopyDirContentToExistDir
- TestBuildDockerignore
- TestBuildEnvUsage
- TestBuildEnvUsage2

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-17 16:51:04 -08:00
Jason Sommer
eba8586d2b Fixed relative filepath check
Signed-off-by: Jason Sommer <jsdirv@gmail.com>
2015-02-16 20:38:52 -06:00
Vincent Batts
ecf82746a8 pkg/archive: test that confirms hardlink ordering
This test was written against
master(abdfb21e3a761efdd70614de42905ff7911c5372) as a failing test, but
works with this patch set.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2015-02-06 18:14:38 +01:00
Vincent Batts
c059e6d158 pkg/archive: sort files
sort changes found and exported.

Sorting the files before appending them to the tar archive
would mean a dependable ordering for types like hardlinks.

Also, combine sort logic used

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2015-02-06 18:13:57 +01:00
unclejack
4c55c3aa45 pkg/archive: remove tar autodetection log line
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-01-24 08:43:03 +02:00
Doug Davis
f8ec68ef67 Have .dockerignore support Dockerfile/.dockerignore
If .dockerignore mentions either then the client will send them to the
daemon but the daemon will erase them after the Dockerfile has been parsed
to simulate them never being sent in the first place.

an events test kept failing for me so I tried to fix that too

Closes #8330

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-06 10:57:48 -08:00
Josh Hawn
c57c03f841 Refactor to optimize storage driver ApplyDiff()
To avoid an expensive call to archive.ChangesDirs() which walks two directory
trees and compares every entry, archive.ApplyLayer() has been extended to
also return the size of the layer changes.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-17 21:54:23 -08:00
Michael Crosby
6454d26740 Decompress archive before streaming the unpack in a chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/archive.go
	pkg/chrootarchive/archive.go

Conflicts:
	pkg/archive/archive.go
2014-12-11 16:29:13 -05:00
Michael Crosby
eab5117c5c Update chroot apply layer to handle decompression outside chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/archive.go

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/diff.go
2014-12-11 16:28:24 -05:00
Andy Goldstein
5e3e0f129e Fix invalid argument error on push
With 32ba6ab from #9261, TempArchive now closes the underlying file and
cleans it up as soon as the file's contents have been read. When pushing
an image, PushImageLayerRegistry attempts to call Close() on the layer,
which is a TempArchive that has already been closed. In this situation,
Close() returns an "invalid argument" error.

Add a Close method to TempArchive that does a no-op if the underlying
file has already been closed.

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
2014-12-03 16:12:24 -05:00
Alexandr Morozov
2ebf95a81e Change path breakout detection logic in archive package
Fixes #9375

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-28 09:44:47 -08:00
Tibor Vass
bdff6d8011 archive: do not call FollowSymlinkInScope in createTarFile
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass
a80a838e6f archive: prevent breakout in ApplyLayer
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass
aa62eca940 archive: prevent breakout in Untar
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass
1752a203af archive: add breakout tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	pkg/archive/archive.go
		fixed conflict which git couldn't fix with the added BreakoutError

Conflicts:
	pkg/archive/archive_test.go
		fixed conflict in imports
2014-11-25 01:03:41 +02:00
unclejack
a590874f19 pkg/archive: fix TempArchive cleanup w/ one read
This fixes the removal of TempArchives which can read with only one
read. Such archives weren't getting removed because EOF wasn't being
triggered.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:34:35 +02:00
Ahmet Alp Balkan
718066ad61 Refactor pkg/archive with a platform-independent stat struct
pkg/archive contains code both invoked from cli (cross platform) and
daemon (linux only) and Unix-specific dependencies break compilation on
Windows. We extracted those stat-related funcs into platform specific
implementations at pkg/system and added unit tests.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan
515e7481de Extract mknod, umask, lstat to pkg/system
Some parts of pkg/archive is called on both client/daemon code. To get
it compiling on Windows, these funcs are extracted into files with
build tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00