зеркало из https://github.com/microsoft/docker.git
Merge pull request #7097 from LK4D4/fix_eof_dockerignore_#7093
Skip whole dir dockerignoring with warning
This commit is contained in:
Коммит
7978b32127
|
@ -356,6 +356,10 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if matched {
|
if matched {
|
||||||
|
if filepath.Clean(relFilePath) == "." {
|
||||||
|
utils.Errorf("Can't exclude whole path, excluding pattern: %s", exclude)
|
||||||
|
continue
|
||||||
|
}
|
||||||
utils.Debugf("Skipping excluded path: %s", relFilePath)
|
utils.Debugf("Skipping excluded path: %s", relFilePath)
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
|
|
|
@ -1577,6 +1577,29 @@ func TestDockerignoringDockerfile(t *testing.T) {
|
||||||
logDone("build - test .dockerignore of Dockerfile")
|
logDone("build - test .dockerignore of Dockerfile")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDockerignoringWholeDir(t *testing.T) {
|
||||||
|
name := "testbuilddockerignorewholedir"
|
||||||
|
defer deleteImages(name)
|
||||||
|
dockerfile := `
|
||||||
|
FROM busybox
|
||||||
|
COPY . /
|
||||||
|
RUN [[ ! -e /.gitignore ]]
|
||||||
|
RUN [[ -f /Makefile ]]`
|
||||||
|
ctx, err := fakeContext(dockerfile, map[string]string{
|
||||||
|
"Dockerfile": "FROM scratch",
|
||||||
|
"Makefile": "all:",
|
||||||
|
".dockerignore": ".*\n",
|
||||||
|
})
|
||||||
|
defer ctx.Close()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err = buildImageFromContext(name, ctx, true); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
logDone("build - test .dockerignore whole dir with .*")
|
||||||
|
}
|
||||||
|
|
||||||
func TestBuildLineBreak(t *testing.T) {
|
func TestBuildLineBreak(t *testing.T) {
|
||||||
name := "testbuildlinebreak"
|
name := "testbuildlinebreak"
|
||||||
defer deleteImages(name)
|
defer deleteImages(name)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче